Numerical methods. Note 10
Home ] Ideas for projects Numerical Methods. Note  « 10 »

There will be no lecture next Monday,22/5

Calculation of a function of complex variable by solving differential equations

Let us calculate exp(z) from the differential equation du/dt=u with the boundary condition u(0)=1. Introducting the real parameter s∈[0,1] and making a substitution t=sz, we get u'=zu, u(0)=1, where prime denotes d/ds. Avoiding complex arithmetics we introduce v=Re(u), w=Im(u), and get a system of real equations (where z=x+iy)
v'=xv-yw, w'=xw+yv, v(0)=1, w(0)=0,
the solution of which gives the sought exp(z): Re[exp(z)]=v(1), Im[exp(z)]=w(1). This system can be solved with our routines rkdriver/pcdriver. For larger z one can first use exp(z1+z2)=exp(z1)exp(z2), exp(n)=en, exp(iπ/2)=i.

Calculation of a function of complex variable by integration

Let us calculate arctan(z) using the integral representation
arctan(z)=0z  dt/1+t2.
The integration path can be taken as a straight line from 0 to z=x+iy as t=sz, where s∈[0,1] is a real parameter,
arctan(z)=z01  ds/1+(sz)2.
one can avoid using complex arithmetics by calculating separately the real and imaginary parts of the integral with our routine adapt. If |z|>1 one should perhaps instead use
arctan(z)=π/2-z  dt/1+t2.

Solution of the Shrödinger equation by variational method with nonorthogonal basis

Use a set of gaussian functions as basis:
fi(x)=exp(-αix2),
where αi is a set of nonlinear parameters. Calculate the matrices (analytically/numerically)
Hi,j=⟨i|H|j⟩, Ni,j=⟨i|j⟩
Find the eigenvalues/eigenvectors of the generalised eigen-system
Hψ = λNψ
using inverse iteration method. Optimize nonlinear parameters.

Solution of the Shrödinger equation by finite difference method

Represent the wavefunction as a table {xi,fi}. Represent the kinetic energy operator as finite-difference operator, like
f''i = [(fi+1-fi)/(xi+1-xi)-(fi-fi-1)/(xi-xi-1)] /(xi-xi-1),
but better. Use the boundary conditions f1=fn=0. Find the eigenvalues/eigenvectors using inverse iteration method.