psol07 - Homework set #7 solutions, Math 128A J. Xia Sec...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Homework set #7 solutions, Math 128A J. Xia Sec 4.4: 1a, 2a, 3a, 7abc, 17 1a. Compute by hand or use a program. Matlab code for the Composite Trapezoidal rule: function integral = cmptrap(a,b,n,f) h = (b-a)/n; x = [a+h:h:b-h]; integral = h/2*(2*sum(feval(f,x))+feval(f,a)+feval(f,b)); Run with cmptrap(1,2,4,’f’) where ’f’ is the name of the function definition file function y = f(t) y = t.*log(t); % pay attention to the dot The result is 0 . 6399004. 2a. Matlab code for the Composite Simpson’s rule function integral = cmpsimp(a,b,n,f) h = (b-a)/n; xi0 = feval(’f’,a)+feval(’f’,b); xi1 = 0; xi2 = 0; for i = 1:n-1 x = a+i*h; if mod(i,2) == 0 xi2 = xi2+feval(’f’,x); else xi1 = xi1+feval(’f’,x); end end xi = h*(xi0+2*xi2+4*xi1)/3; xi Result: 0 . 6363098. 3a. Approximation: 2 ( 1 6 )( 7 6 ln 7 6 + 9 6 ln 9 6 + 11 6 ln 11 6 ) = 0 . 633096. 7. f ( x ) = e 2 x sin3 x f 00 ( x ) = - 5 e 2 x sin(3 x ) + 12 e 2 x cos(3 x ) f (4) ( x ) = - 119 e 2 x sin(3 x ) - 120 e 2 x cos(3 x ) 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
ξ (0 , 2) we look for an upper bound for f 00 ( ξ ) = e 2 ξ ( - 5sin3 ξ + 12cos3 ξ ) e 4 (5 + 12) . Or for a better upper bound f 00 ( ξ ) = e 2 ξ ( - 5sin3 ξ + 12cos3 ξ ) e 4 p 5 2 + 12 2 = 13 e 4 . We use the latter one(it’s OK if you use the first one; then you will get a larger n /smaller h ). Similarly f (4) ( ξ ) = - 119 e 2 x sin(3 ξx ) - 120 e 2 x cos(3 ξ ) e 4 p 119 2 + 120 2 120 2 e 4 . Thus by the error for the Composite Trapezoidal rule - b - a 12 h 2 f 00 ( ξ ) 2 12 h 2 13 e 4 < 10 - 4 = h < 9 . 1942 × 10 - 4 = n > 2175 . 3 ( choose 2176) . Note: it’s quite possible that you got a different answer because you used a different upper bound. That’s OK. Similarly for the Composite Simpson’s rule - b - a 180 h 4 f (4) ( ξ ) 2 180 h 4 120 2 e 4 < 10 - 4 = h < 0 . 033557 = n > 57 . 6 ( choose 58) . For the Composite Midpoint rule b - a 6 h 2 f 00 ( ξ ) 2 6 h 2 13 e 4 < 10 - 4 = h < 6 . 5013 × 10 - 4 = n > 3076 . 3 ( choose 3077) . 17. Use the parametric equations for the ellipse x = 3cos t y = 2sin t , t ( - π,π ] . Then by the arclength formula L = Z π - π p [ x 0 ( t )] 2 + [ y 0 ( t )] 2 dt = Z π - π p 9sin 2 t + 4cos 2 tdt = Z π - π p 4 + 5sin 2 tdt ( by sin 2 t + cos 2 t = 1) . 2
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 9

psol07 - Homework set #7 solutions, Math 128A J. Xia Sec...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online