hw24_derek_rampal

hw24_derek_rampal - Derek Rampal HW 24 24 Code: % % Derek...

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

View Full Document Right Arrow Icon
Derek Rampal HW 24 24 12/3 11.3 462 4(c, d) Code: % % Derek Rampal % HW 24 - 12/3 11.3 462 4(c, d) % format long ; clear; % Test lin_fin_diff(tt,vv,kk,cc,zz,P,Q,R) % Problem 5 % y''=2y'-y+x*exp(x)-x a = 0; b = 1; c = 1; d = exp(-10); n = 10; p = @(x) 0; q = @(x) 100; r = @(x) 0; answer = exp(-10*(.1:.1:1)); fd1 = lin_fin_diff(a,b,c,d,n,p,q,r); % Seems to work % For richardson. ..using book, % E1 = (4*w(h/2)-w(h))/3 % E2 = (4*w(h/4)-w(h/2))/3 % E3 = (16*E2-E1)/15 % 4c actual = @(x) (4./x-2./x.^2+log(x)-3/2); solution = actual(1.1:.1:2); a = 1; b = 2; c = .5; d = log(2); n = 10; p = @(x) -4/x; q = @(x) -2/x.^2; r = @(x) 2*log(x)./x.^2; fd1 = lin_fin_diff(a,b,c,d,n,p,q,r); n=20; fd2 = lin_fin_diff(a,b,c,d,n,p,q,r); fd2 = fd2(2:2:20); n=40; fd3 = lin_fin_diff(a,b,c,d,n,p,q,r); fd3 = fd3(4:4:40); E1 = (4*fd2-fd1)./3; E2 = (4*fd3-fd2)./3; E3 = (16*E2-E1)./15
Background image of page 1

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

View Full DocumentRight Arrow Icon
for i = 1:9 [sigdigs(1,i),t1,t2] = sigdig(solution(1,i),E3(1,i)); end sigdigs % 4d actual = @(x) (1/6*x.^3.*exp(x)-5/3*x.*exp(x)+2*exp(x)-x-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.

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 / 4

hw24_derek_rampal - Derek Rampal HW 24 24 Code: % % Derek...

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