Numerical methods for differential equations

In summary, the spectral method is a good option if you can write the coefficients of the function yourself as a Fourier series, while the finite difference method is a good option if you can enforce equality between the interior points and the end point.
  • #1
SarthakC
10
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
  • #3
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?
 
  • #4
The spectral method works as long as you can write the coefficients themselves as Fourier series or Fourier Transforms.
 
  • #5
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?
 
  • #6
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:
[itex]x_0, x_1, \dots, x_i, \dots, x_N [/itex]

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

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

For Dirichlet B.C we might set [itex]x_0 =0 [/itex] and [itex]x_N =5 [/itex]

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

For the end point we can use [itex]x_N =x_0 [/itex]. We often don't solve this last equations. Instead we enforce this equality in our the algebraic system of equations by replacing all [itex]x_N[/itex] with [itex]x_0 [/itex] just like we replaced [itex] x_{-1} [/itex] with [itex] x_{N-1} [/itex]. This reduces the error due to finite precision math and slightly reduces the computation time.
 
  • #7
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?
 
  • #8
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
 
  • #9
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!
 

1. What are numerical methods for differential equations?

Numerical methods for differential equations are techniques used to approximate the solutions of differential equations that cannot be solved analytically. These methods involve breaking down a differential equation into smaller, simpler equations that can be solved using numerical calculations.

2. Why are numerical methods used for solving differential equations?

Numerical methods are used for solving differential equations when an analytical solution is not possible or too difficult to obtain. They are also useful for obtaining approximate solutions quickly and efficiently, making it possible to study a wide range of differential equations and their behaviors.

3. What are some common numerical methods used for solving differential equations?

Some common numerical methods for solving differential equations include Euler's method, Runge-Kutta methods, and finite difference methods. Each method has its own advantages and limitations, and the choice of method depends on the specific problem being solved.

4. What are the advantages of using numerical methods for solving differential equations?

The main advantage of using numerical methods for solving differential equations is that they can handle complex and nonlinear equations that do not have analytical solutions. They are also versatile and efficient, making them useful for a wide range of applications in science and engineering.

5. What are the limitations of numerical methods for solving differential equations?

Numerical methods for solving differential equations are subject to round-off errors and truncation errors, which can affect the accuracy of the solutions obtained. They also require careful selection and tuning of parameters to ensure stability and accuracy, and may not always provide the exact solution to the original differential equation.

Similar threads

Replies
4
Views
753
  • Differential Equations
Replies
1
Views
1K
  • Differential Equations
Replies
3
Views
1K
Replies
38
Views
454
  • Differential Equations
Replies
5
Views
1K
Replies
16
Views
2K
  • Differential Equations
Replies
12
Views
4K
  • Differential Equations
Replies
22
Views
2K
  • Differential Equations
Replies
5
Views
998
  • Differential Equations
Replies
1
Views
1K
Back
Top