0% found this document useful (0 votes)
8 views5 pages

Solving Initial Value Problems with Python

The document outlines an assignment focused on solving various initial value problems using Python programming. It includes multiple questions that require the application of Euler's method and modified Euler's method for different ordinary differential equations (ODEs) and plots of numerical solutions against analytic solutions. Additionally, it covers scenarios involving particles under gravity with air drag and a coupled oscillator system.

Uploaded by

REALL
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 views5 pages

Solving Initial Value Problems with Python

The document outlines an assignment focused on solving various initial value problems using Python programming. It includes multiple questions that require the application of Euler's method and modified Euler's method for different ordinary differential equations (ODEs) and plots of numerical solutions against analytic solutions. Additionally, it covers scenarios involving particles under gravity with air drag and a coupled oscillator system.

Uploaded by

REALL
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

Assignment on initial value problems March, 2025

Initial value problem

Q1. Consider the following initial value problem:

+ =0; with, (0) = 1


Write a Python programming to solve this ODE in the range: 0 ≤ ≤ 3 using
(a) Euler’s method with 30 data points
(b) and modified Euler’s method with 30 data points
(c) Plot (a) & (b) with its analytic solution: = in a same graph.

Q2. Consider the following initial value problem:

+ − =0; with, (0) = 0


Write a Python programming to solve this ODE in the range: 0 ≤ ≤ 4 using
(a) Euler’s method with 20 data points
(b) and modified Euler’s method with 20 data points
(c) Plot (a) & (b) with its analytic solution: = in a same graph.

Q3. Consider the following initial value problem:


+2 =0; with, (0) = 1
Write a Python programming to solve this ODE in the range: 0 ≤ ≤ 3 using
(a) Euler’s method with 20 data points
(b) and modified Euler’s method with 20 data points
(c) Plot (a) & (b) with its analytic solution: = exp(− ) in a same graph.

Q4. Consider the following initial value problem:


+ − cos =0; with, (0) = 0
Write a Python programming to solve this ODE in the range: 0 ≤ ≤ 10 using
(a) Euler’s method with 100 data points
(b) and modified Euler’s method with 100 data points
(c) Plot (a) & (b) with its analytic solution: = sin( ) in a same graph.

Q5. Consider the following initial value problem:


+ + = 0; with, (0) = 0 and (0) = 1
Write a Python programming to solve this ODE in the range: 0 ≤ ≤ 4 using
(a) Euler’s method with 40 data points
(b) and modified Euler’s method with 40 data points
(c) Plot (a) & (b) with its analytic solution: = in a same graph.

Prepared by Palash Nath (RKMVCC) Page: 1 of 5


Assignment on initial value problems March, 2025

Q6. Consider the following initial value problem:


+2 +2 =0; with, (0) = 1 and (0) = 0
Write a Python programming to solve this ODE in the range: 0 ≤ ≤ 3 using
(a) Euler’s method with 30 data points
(b) and modified Euler’s method with 30 data points
(c) Plot (a) & (b) with its analytic solution: = exp(− ) in a same graph.

Q7. Consider the following initial value problem:


+2 +2 =0; with, (0) = 0 and (0) = 1
Write a Python programming to solve this ODE in the range: 0 ≤ ≤ 10 using
(a) Euler’s method with 100 data points
(b) and modified Euler’s method with 100 data points
(c) Plot (a) & (b) with its analytic solution: = sin( ) in a same graph.

Q8. Consider the following 2nd order linear ODE


+2 +5 =0
Write a Python program to,
(a) Obtain numerical solution in the range 0 ≤ ≤ 2 with the initial conditions
(0) = 0, (0) = 2
(b) The ODE has analytic solution: ( ) = sin(2 ). Plot numerical solution along with
analytic solution.

Q9. Consider the following 2nd order linear ODE


+ − 4 = 14 − 2
Write a Python program to,
(a) Obtain numerical solution in the range −1 ≤ ≤ 1 with the initial conditions:
(−1) = 0, (−1) = −2
(b) The ODE has analytic solution: ( ) = − . Plot numerical solution along with
analytic solution.

Q10. Consider the following 2nd order linear ODE


+ + = 2( − 1) − +1
Write a Python program to,
(a) Obtain numerical solution in the range 0 ≤ ≤ 4 with the initial conditions:
(0) = 0, (0) = 1
(b) The ODE has analytic solution: ( ) = . Plot numerical solution along with analytic
solution.

Prepared by Palash Nath (RKMVCC) Page: 2 of 5


Assignment on initial value problems March, 2025

Q11.

Q12.

Q13. Consider a particle of mass is released from height ℎ, so that it is falling under uniform
gravity of acceleration and it is experiencing air drag proportional to its instantaneous
velocity having drag coefficient .
(a) Write down the equation of motion (EQM)
(b) Write a Python programming to solve this EQM until it hits the ground.
[Take: = 1, ℎ = 100, = 10 and = 0, 0.1, 0.2, … … …, and so on….]
(c) Hence to plot ( ) and ( ) throughout its motion in the air.
(d) Plot total energy of the particle: ( ) during its motion.

Q14. Consider a particle of mass is released from height ℎ, so that it is falling under uniform
gravity of acceleration and it is experiencing air drag proportional to square of its
instantaneous velocity having drag coefficient .
(a) Write down the equation of motion (EQM)
(b) Write a Python programming to solve this EQM until it hits the ground.
[Take: = 1, ℎ = 100, = 10 and = 0, 0.1, 0.2, … … …, and so on….]
(c) Hence to plot ( ) and ( ) throughout its motion in the air.
(d) Plot total energy of the particle: ( ) during its motion.

Prepared by Palash Nath (RKMVCC) Page: 3 of 5


Assignment on initial value problems March, 2025

Q15. Consider a particle of mass is thrown vertically upward with initial velocity from the
ground. It experiences uniform gravity of acceleration and air drag proportional to its
instantaneous velocity having drag coefficient .
(a) Write down the equation of motion (EQM)
(b) Write a Python programming to solve this EQM until it hits the ground.
[Take: = 1, ℎ = 100, = 10 and = 0, 0.1, 0.2, … … …, and so on….]
(c) Hence to plot ( ) and ( ) throughout its motion in the air.
(d) How long it is moving upward and downward?
(e) How much is the height reached by the particle?
(f) Plot total energy of the particle: ( ) during its motion.

Q16. Consider a particle of mass is thrown with initial velocity from the ground making
angle with the horizontal direction. It experiences uniform gravity of acceleration and
air drag proportional to its instantaneous velocity having drag coefficient .
(a) Write down the equations of motion (EQM)
(b) Write a Python programming to solve this EQM until it hits the ground.
[Take: = 1, ℎ = 100, = 10 and = 0, 0.1, 0.2, … … …, and so on….]
(c) Hence plot the trajectory of the particle.
(d) How long it is moving in the air?
(e) How much is the height reached by the particle?
(f) Plot total energy of the particle: ( ) during its motion.

Q17.

Q18. Consider the following spring mass system (coupled oscillator)

Let, ( ) and ( ) denotes the displacements of left and right blocks from their
equilibrium points.
The equations of motion:

Prepared by Palash Nath (RKMVCC) Page: 4 of 5


Assignment on initial value problems March, 2025

+( + ) − = 0 and +( + ) − =0
You take = 1, = 1 and vary ′ from 0.0 1.0 of step size 0.1.
Write a Python program to solve the equations of motion with the following initial
conditions in a suitable interval of time.

( ) (0) = 1, (0) = = =0

( ) (0) = − (0) = 1 = =0

( ) (0) = (0) = 1 = =0

Prepared by Palash Nath (RKMVCC) Page: 5 of 5

You might also like