Exercises on differential equation

The pendulum equation

We consider the equation

\theta^{\prime\prime} = -\sin{\theta}

Write a function that returns an array containing the position and the angular velocity of the pendulum for N instants t_i between 0 and T.

The initial position is \theta=0. Plot the phase space trajectory for different values of the initial velocity. Angle will be represented between -π and π.

Solving the Schrödinger equation using the finite element method

Let us consider the Schrödinger equation with hbar = m = 1

\frac{d\psi}{dt} =-i\left( -\frac12 \frac{d^2\psi}{dx^2} + V(x)\psi\right)

The potential is V(x) = \frac12 k x^2 with \kappa=.5.

To solve the equation, we will truncate the x-axis to values between x_\mathrm{min} and x_\mathrm{max}. We will also discretize the x-axis with small steps (\Delta x).

The term \frac{d^2\psi}{dx^2} will be approximated using \frac{\psi(x+\Delta x) - 2\psi(x) + \psi(x-\Delta x)}{\Delta x^2}.

For the initial state, we will take a Gaussian distribution e^{-\alpha(x-x_0)^2}. We will use \alpha = \frac 12 and x_0=1.

Calculate and plot |{\psi(x,t)}|^2 as a function of x for t=1 using the zvode solver with an absolute precision of 10{^-3}.

Table Of Contents

Previous topic

Differential equation

Next topic

Fourier analysis

This Page