hw15_derek_rampal

hw15_derek_rampal - Derek Rampal 10/14/2008 HW 15 15 10/15...

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

View Full Document Right Arrow Icon
Derek Rampal 10/14/2008 HW 15 15 10/15 5.2 190 3(c,d), 6(c,d) The formula for f(x) is given in exercise 4. Compute the actual values, the absolute and relative errors and the number of significant digits. Code: % % Derek Rampal % main15 % 15 10/15 5.2 190 3(c,d), 6(c,d) % clear; format long ; % 3c ffun = inline( '-1*(y+1)*(y+3)' , 't' , 'y' ); fact = inline( '-3+2*(1+exp(-2*t))^-1' , 't' ); yinit = -2; h = .2; a = 0; b = 2; answer(1,1) = euler(ffun,a,b,yinit,h); actual(1,1) = fact(b); [sigds(1,1),absolute(1,1),relative(1,1)] = sigdig(actual(1,1),answer(1,1)); % 3d gfun = inline( '-5*y+5*t^2+2*t' , 't' , 'y' ); gact = inline( 'x^2+1/3*exp(-5*x)' , 'x' ); yinit2 = 1/3; h2 = .1; a2 = 0; b2 = 1; answer(2,1) = euler(gfun,a2,b2,yinit2,h2); actual(2,1) = gact(b2); [sigds(2,1),absolute(2,1),relative(2,1)] = sigdig(actual(2,1),answer(2,1)); % 6c % original function = y' = -(y+1)(y+3) = -(y^2 +4 y +3) % y'' = (2*y+4)*(y+1)*(y+3) % fp = inline( '(2*y+4)*(y+1)*(y+3)' , 't' , 'y' );
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/19/2009 for the course MATH numerical taught by Professor Ford during the Spring '09 term at FAU.

Page1 / 3

hw15_derek_rampal - Derek Rampal 10/14/2008 HW 15 15 10/15...

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

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