0% found this document useful (0 votes)
8 views1 page

Worksheet 04

This worksheet focuses on numerical solutions of ordinary differential equations (ODEs) using Euler and Midpoint methods. It includes tasks for solving specific equations, estimating errors, and plotting results with given initial conditions. The total marks for the worksheet are 20, with detailed instructions for submission and documentation requirements.

Uploaded by

Anahita Kamra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views1 page

Worksheet 04

This worksheet focuses on numerical solutions of ordinary differential equations (ODEs) using Euler and Midpoint methods. It includes tasks for solving specific equations, estimating errors, and plotting results with given initial conditions. The total marks for the worksheet are 20, with detailed instructions for submission and documentation requirements.

Uploaded by

Anahita Kamra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

PH3205 :: Computational Physics Worksheet 3 Total marks: 20

Worksheet 4: Numerical solutions of ODEs


If you are using Julia or Python, we recommend using a jupyter notebook. In WeLearn, you need to
submit this file. Please clearly indicate in the markup cells, the number of the question for which you are
writing the program. Also, please remember to add documentation through comments in your program.

You may also use scripts and use REPL to evaluate them. In that case, please keep all your files for a
particular worksheet in a folder and you may upload the compressed archive of that folder.

Please feel free to ask for help!

1. (8 points) Consider the equation


dx
= −xt
dt
(a) (4 points) Use Euler and Midpoint methods to solve the equations using h = 0.01 from tini = 0
to tfinal = 15. The given initial condition is x(0) = 1.0. Plot the solutions along with the exact
solution.
(b) (2 points) Now choose h = 10.0n for n = −4 to n = −2 in steps of 0.2. For each h, keep
tfinal fixed and solve the above equations using the two methods. For each h, for each method,
estimate the error of the position value of the final point (absolute deviation from the exact
solution).
(c) (2 points) Plot and fit log10 h versus log10 of the error with a straight line to estimate the errors
of each of the method.

2. (12 points) Two coupled first-order equations

dy
=p
dt
dp
= −4π 2 y
dt
define simple harmonic motion with period 1.
(a) (8 points) Use Euler and Midpoint methods to solve the equations using h = 0.01 from tini = 0
to tfinal = 15. The given initial condition is y(0) = 1.0 and p(0) = 0.0. Plot the solutions along
with the exact solution.
(b) (2 points) Now choose h = 10.0n for n = −4 to n = −2 in steps of 0.2. For each h, keep
tfinal fixed and solve the above equations using the two methods. For each h, for each method,
estimate the error of the position value of the final point (absolute deviation from the exact
solution).
(c) (2 points) Plot and fit log10 h versus log10 of the error with a straight line to estimate the errors
of each of the method.

Page 1

You might also like