Numerical methods for differential equations

SarthakC
Messages
10
Reaction score
0
Hi,
Are there any numerical techniques I can use to solve differential equations with periodic boundary conditions? I know of several techniques for other kinds of boundary conditions (such as Runge-Kutta method, Euler method etc.), but I am interested in knowing how to numerially solve differential equations with periodic boundary conditions..

Any help would be appreciated!
 
Physics news on Phys.org
Umm... Maybe I should make my specific scenario a little clearer. My differential equation is of the form $$f(x) \partial_x^2 y + g(x) \partial_x y + h(x) y =0$$

In this scenario, replacing ##y## with a Fourier series in ##x## is not really useful, because the functions ##f, g## and ##h## do not let me compare coefficients anymore, because in order to do that I would have to multiply by some element of the orthogonal Fourier basis, but these functions will not let me extract the information as I want. For example if i just had ##\partial_x y + \delta(x) y=0##, then replacing with ##y## with ##\sum_n c_n e^{inx}## would give me $$\sum_n c_n (i n + \delta(x)) e^{inx}=0$$
The only procedure I'm aware of would proceed from here by mulitplying by ##e^{-imx}## and integrating, but that would give me ##c_m (i m) + \sum_n c_n = 0##. This may not be the best example, but in general I would not get equations from where I could calculate the coefficients directly, right?Wouldn't a spectral method work nicely only when I had a simpler equation with constant coefficients or something?
 
The spectral method works as long as you can write the coefficients themselves as Fourier series or Fourier Transforms.
 
Could someone give me an example? For example let's just take a simple first order equation of $$y^\prime + \Theta(x) y = 0$$ where ##\Theta(x)## is the Heaviside step function, with a domain from ##(-\pi,\pi)##, with peridic boundary equations. Could anyone just show me a few steps from where I can proceed?
 
Actually, for most numerical methods, applying periodic boundary conditions is pretty straight forward.

Are you familiar with finite difference?

In finite difference we break the domain into a finite number of points:
x_0, x_1, \dots, x_i, \dots, x_N

Then we approximate the differential to create an algebraic equation for the interior points x_1 \dots x_{N-1}. For second order equations this equations is often of the form a x_{i-1} + bx_i + cx_{i+1} = f(x_i)

Then we have to apply the correct boundary conditions to the points at the edge of the domain x_0, x_N

For Dirichlet B.C we might set x_0 =0 and x_N =5

For periodic boundary conditions we can use the interior equation for x_0. Noting that x_{-1} = x_{N-1} gives the equations a x_{N-1} + bx_0 + cx_{1} = f(x_0).

For the end point we can use x_N =x_0. We often don't solve this last equations. Instead we enforce this equality in our the algebraic system of equations by replacing all x_N with x_0 just like we replaced x_{-1} with x_{N-1}. This reduces the error due to finite precision math and slightly reduces the computation time.
 
Hmm. So the idea is I use the finite difference method and the boundary conditions to give me an algebraic problem which I then solve numerically to get all the ##x_i##s?
 
SarthakC said:
Hmm. So the idea is I use the finite difference method and the boundary conditions to give me an algebraic problem which I then solve numerically to get all the ##x_i##s?

That's the general idea.

There are a few simple examples in the second half of this lecture:
http://www.mathematik.uni-dortmund.de/~kuzmin/cfdintro/lecture4.pdf
 
Thanks!
I'll give both the spectral method and the finite difference method a shot and try to solve my original problem. I'll get back to you guys if I have any more clarifications!

Thanks!
 
Back
Top