Ordinary Differential Equations | CaseStudy


CO Laboratory Work nr. 1, by Istratii Andrei @ FAF-121

Introduction

A lot of processes in nature can be described through differential equation, thus a lot of problems in science are, in one way or another, connected to the subject of solving differential equations and related systems. However, it happens quite rarely that these problems which arise can be represented in the matters of sipmle ODEs that can be solved analyticaly, therefore one should use numerical methods in order to find an answer to more complex questions.

The purpose of this laboratory work is to analyze and solve numerically a problem related to ODE and, using the obtained solution, try to describe the physical process, relate it to the real world and after that reason about the correctness of the solution.

The Harmonic Oscillator

The problem is given as an equation of a spring oscillator which is influenced by the force of elasticity, the damping force (ex. resistance of the environment) and an external force that is represented as a function of time and can take a variety of different forms.

m\frac{d^2x}{dt^2}+c\frac{dx}{dt}+kx=F(t)

Now, our goal is, given the constants m, c, k and the function F(t), to compute the position x as a function of time. This requires a numerical method because the function of the external force is assumed to be unknown as it can be anything, thus we cannot program an analytic solution.

Runge-Kutta

The numerical solution of this problem is achieved using the Runge-Kutta method of order 4. In order to make it possible, the initial second order differential equation was transformed in a system of two first order differential equations:

y_0' = y_1, \qquad y_1' = \frac{F(t) - ky_1 - cy_0}{m}
Where:
y_0 = x, \qquad y_1 = x' = v, \qquad y_1' = x'' = v' = a

Given such a system and the initial state, the algorithm is able to iteratively generate values for the position and the velocity of the mass on the spring.


Spring properties

Mass { }
Elasticity { }
Damping { }

External Force

Amplitude { }
Pulsation { }
Phase { }

Initial conditions

Position { }
Velocity { }
Time delta { }

Play simulation Pause simulation Update'n'Reset

Position & Velocity

External force