Challenge

Week 3 - Solving second order ODEs

Objective:

the project aims to stimulate the movement of the simple pendulum (0-20s) which moves according to the below second order differential equation (ODE) and to create an animation of its movement using python.

Procedure:

The equation of simple pendulum using damping is a second-order differential equation (ODE). So, it must be divided into two lower-order differential equation 

d`theta`1/d`theta`2=`theta2`

d`theta2`/dt=-(b/m).`theta2`-(g/l).sin`theta1`

However, some assumption are made for converting the second order ode to first order ode.

thet are 

`theta`=`theta1`

d`theta/dt`=`d theta1 /dt`=`theta2`

`d^2 theta/dt=d/dt(d theta1/dt)=d theta2/dt`

As the material is fixed the damping coefficient 'b' is also fixed (because it is a material property ).length of the strings and mass of the bob are also specified.

Code:

  1. Import numpy,matplotlib, math modules for array, plottting and math operation respectively.
  2.  The 'odeint' module extracted from 'scipy.integrate' module to solve the given ode.
  3. Divide higher-order ODE into the first -order and define in the function.
  4. Define the initial condition and angular velocity and displacement. The simulation time is taken in the range of 0-20 seconds.
  5. To solve the ODE call the odeint module and given the define module and given the define variable Then plot araph between the time vs displacement and time     vs angular velocity.
  6. Create a loop to obtain animation of the motion of the simple pendulum bob and convert the obtained images into gif file by using the 'imgflip'.
Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.