Docsity

Assignment 4 in CMSC/MAPL 460: Numerical Integration using MATLAB - Prof. Peter Wolfe, Assignments of Mathematics

Toggle sidebar
bg1
CMSC/MAPL 460 Dr. Wolfe ASSIGNMENT #4 Due April 9, 2001
1. Write a MATLAB program to evaluate I=Rb
af(x)dx using the trapezoidal rule
with nsubdivisions, calling the result In. Use the program to calculate the following
integrals with n= 2,4,8,16,...,512.
(a) Z1
0
e−x2
dx (b) Z1
0
x3/2dx
Try to arrange your work so that you never compute the value of the integrand at
any point more than once. Analyze emperically the rate of convergence of Into Iby
calculating the ratios
Rn=I2n−In
I4n−I2n
and pn=log(Rn)
log(2)
2. Repeat problem 1 using Simpson’s rule.
3. Apply the corrected trapezoidal rule to the integrals in problem 1. Compare the
results with those of problem 2 for Simpson’s rule.
4. Use Gauss-Legendre integration with n= 2,4,8 nodes to the integrals of problem 1.
Compare the results with those for the trapezoidal and Simpson methods.
5. Use the MATLAB function QUADL to find approximate values of the integrals 1(a)
and 1(b).
6. Ex. 5.1, p.183, Shampine, Allen & Preuss.
7. The 11 point Newton-Cotes integration rule on [0,1] is
Z1
0
f(x)dx ≈
10
X
i=0
wif(i
10)
with the widetermined by requiring that the rule be exact for f(x) = 1, x, x2, . . . x10 .
(a) Use MATLAB to find the weights wi.
(b) Apply the rule to the integrals in 1(a) and 1(b). Note the errors.
8. We wish to estimate the value of
I=Z∞
0
exp(−x) cos2x dx =.6
(a) Truncate the integral and use QUADl on the finite part.
(b) Try the transformation x=−ln ton this integral and use QUADL on the new
integral.
(c) Use the 2, 4 and 8 point Gauss-Laguerre rules to estimate the integral. compare
your results with parts (a) and (b) above.
pf2

Partial preview of the text

Download Assignment 4 in CMSC/MAPL 460: Numerical Integration using MATLAB - Prof. Peter Wolfe and more Assignments Mathematics in PDF only on Docsity!

CMSC/MAPL 460 Dr. Wolfe ASSIGNMENT #4 Due April 9, 2001

  1. Write a MATLAB program to evaluate I =

∫ (^) b a f^ (x)^ dx^ using the trapezoidal rule with n subdivisions, calling the result In. Use the program to calculate the following integrals with n = 2, 4 , 8 , 16 ,... , 512.

(a)

0

e−x

2 dx (b)

0

x^3 /^2 dx

Try to arrange your work so that you never compute the value of the integrand at any point more than once. Analyze emperically the rate of convergence of In to I by calculating the ratios

Rn =

I 2 n − In I 4 n − I 2 n

and pn =

log(Rn) log(2)

  1. Repeat problem 1 using Simpson’s rule.
  2. Apply the corrected trapezoidal rule to the integrals in problem 1. Compare the results with those of problem 2 for Simpson’s rule.
  3. Use Gauss-Legendre integration with n = 2, 4 , 8 nodes to the integrals of problem 1. Compare the results with those for the trapezoidal and Simpson methods.
  4. Use the MATLAB function QUADL to find approximate values of the integrals 1(a) and 1(b).
  5. Ex. 5.1, p.183, Shampine, Allen & Preuss.
  6. The 11 point Newton-Cotes integration rule on [0, 1] is

∫ (^1)

0

f (x) dx ≈

∑^10

i=

wif (

i 10

with the wi determined by requiring that the rule be exact for f (x) = 1, x, x^2 ,... x^10. (a) Use MATLAB to find the weights wi. (b) Apply the rule to the integrals in 1(a) and 1(b). Note the errors.

  1. We wish to estimate the value of

I =

0

exp(−x) cos^2 x dx =. 6

(a) Truncate the integral and use QUADl on the finite part. (b) Try the transformation x = − ln t on this integral and use QUADL on the new integral. (c) Use the 2, 4 and 8 point Gauss-Laguerre rules to estimate the integral. compare your results with parts (a) and (b) above.

  1. In a standard shell and heat exchanger hot vapor condenses on the tube, maintaining a constant temperature Ts. If the input is at temperature T 1 and the output must be at temperature T 2 , then the length of tube required is given by

L =

m πD

∫ T 2

T 1

cρdT h(Ts − T )

(All quantities must be in consistent units.) Here T is the temperature in ◦F. T 1 = 0◦F is the inlet temperature. T 2 = 180◦F is the desired outlet temperature. Ts = 250◦F is the condensate temperature. m is the fluid flow rate = 45, 000 lb/hr. D is the diameter of the tube = 1.032 in. cρ is the specific heat of the fluid = (0.53 + 0. 00065 T ) BTU/(lb◦F). h is the local heat transfer coefficient = 0.^023 D k( (^) πDμ^4 m )^0.^8 ( μc kρ )^0.^4. k is the thermal conductivity of the fluid = 0.153 BTU/(hr ft◦F). μ is the viscosity of the fluid and has units lb/(ft hr). μ varies with temperature so that T 0 50 100 150 200 μ 242 82.1 30.5 12.6 5. Use spline interpolation to define μ for other values of T and calculate the required length of the heat exchanger. You will need to use the MATLAB functions SPLINE and QUADL. The answer is about 158.7 ft.