# Scientific Computing Lab Results Worksheet 2 Dr. Miriam Mehl Institut für Informatik Scientific Computing in Computer Science.

## Presentation on theme: "Scientific Computing Lab Results Worksheet 2 Dr. Miriam Mehl Institut für Informatik Scientific Computing in Computer Science."— Presentation transcript:

Scientific Computing Lab Results Worksheet 2 Dr. Miriam Mehl Institut für Informatik Scientific Computing in Computer Science

Worksheet 2 – Solution

1) m-file Euler_implicit.m for (k=2:size(tk,2)) y_it = y(k-1); dy=1.0; %Newton iteration while (abs(dy)>=0.0001) dy = (y(k-1) - y_it + dt*rhs(y_it))/ (dt*rhs_y(y_it)-1); y_it = y_it - dy; end y(k)=y_it; end

Worksheet 2 – Solution 2) m-file Adams_Moulton.m y_it = y(k-1); x = y_it + (1/2)*dt*rhs(y_it); %Newton iteration d=1-7*dt+(49/4)*dt^2+(7/5)*dt*x; if (d>0) dy=1; it=1; while (abs(dy)>0.0001) …

Worksheet 2 – Solution 3) m-file AdamsMoulton_linear_1.m for (k=2:size(tk,2)) a=(1/2)*dt*7*y(k-1); y(k)=(y(k-1)+2*a-(a/10)*y(k-1))/ (1+(a/10)); end

Worksheet 2 – Solution

dt1/21/41/81/161/32 error––2.05950.48540.1754 error red.–––4.242.77 explicit Euler q=1

Worksheet 2 – Solution dt1/21/41/81/161/32 error––0.09500.09380.0235 error red.–––1.013.99 Heun q=2

Worksheet 2 – Solution dt1/21/41/81/161/32 error0.57810.51510.36650.22330.1245 error red.–1.121.411.641.79 implicit Euler q=1

Worksheet 2 – Solution dt1/21/41/81/161/32 error–1.47300.30350.07040.0167 error red.––4.854.314.21 Adams Moulton q=2

Worksheet 2 – Solution dt1/21/41/81/161/32 error1.81960.84020.33420.12370.0488 error red.–2.172.512.692.53 Adams Moulton linearisation 1 q=1

Worksheet 2 – Solution dt1/21/41/81/161/32 error18.8562.15430.79900.23260.1220 error red.–8.752.702.732.40 Adams Moulton linearisation 2 q=1

Worksheet 2 – Solution dtExpl. Euler HeunImpl. Euler Adams Moulton Adams Moulton l1 Adams Moulton l2 1/2X–XO 1/4XXXX 1/8XXXXXX 1/16XXXXXX 1/32XXXXXX

Download ppt "Scientific Computing Lab Results Worksheet 2 Dr. Miriam Mehl Institut für Informatik Scientific Computing in Computer Science."

Similar presentations