Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


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

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

2 Worksheet 2 – Solution

3 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

4 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) …

5 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

6 Worksheet 2 – Solution

7

8

9

10

11

12

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

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

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

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

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

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

19 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


Ads by Google