Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Numerical methods for differential equations

  1. Jul 9, 2014 #1
    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!
     
  2. jcsd
  3. Jul 9, 2014 #2

    pasmith

    User Avatar
    Homework Helper

  4. Jul 9, 2014 #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?
     
  5. Jul 9, 2014 #4

    HallsofIvy

    User Avatar
    Staff Emeritus
    Science Advisor

    The spectral method works as long as you can write the coefficients themselves as Fourier series or Fourier Transforms.
     
  6. Jul 9, 2014 #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?
     
  7. Jul 9, 2014 #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.
     
  8. Jul 10, 2014 #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?
     
  9. Jul 10, 2014 #8
    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
     
  10. Jul 10, 2014 #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!
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Numerical methods for differential equations
Loading...