text: # Second order differential equation
  
  • Linder88
  In summary: The orthogonality conditions are \int_{-L/2}^{L/2} \cos(k_n x)\cos(k_m x)\,dx = L/2 \delta_{nm} and similar for the sines.
  
  #### Linder88
  
  Homework Statement
  I need help with finding the approximate solution of a second order differential equation.
  Relevant Equations
  I am given the differential equation as in
  $$\lambda \frac{d^2u}{dx^2} + q = 0$$
  which is defined over $$x \in [-L/2,L/2]$$ and where $$q = a+bx$$. I am supposed to find an approximative solution using a spectral method, i.e. using cosine and sine terms that fulfills the essential boundary conditions given by
  $$u \bigg ( -\frac{L}{2} \bigg ) = 0, u \bigg (\frac{L}{2} \bigg ) = 0$$
  The appoximative solution should be represented by a Fourier series and by noticing that the terms in the integral are orthogonal, the matrix of the system of equations should be diagonal.
  We choose an approximative solution given by
  $$u_N(x) = \frac{a_0}{2} + \sum_{n=1}^N a_n \cos nx + b_n \sin nx$$
  Comparing this approximative solution with the differential equation yields that
  $$\frac{a_0}{2} = a$$
  and the boundary conditions yields the equation system
  $$a + \sum_{n=1}^N a_n \cos \bigg ( \frac{nL}{2} \bigg ) + b_n \sin \bigg ( \frac{nL}{2} \bigg ) = 0 \\ a + \sum_{n=1}^N a_n \cos \bigg ( -\frac{nL}{2} \bigg ) + b_n \sin \bigg ( -\frac{nL}{2} \bigg ) = 0$$
  So at least I got a system of two equations but I do not know where to go from here. How should I use the orthogonality to set up a matrix from these two equations?
  
  Linder88 said:
  Comparing this approximative solution with the differential equation yields that
  ##{a_0\over 2}=a##
  How ?
  
  and the boundary conditions yields the equation system
  I miss the ## +bx## from
  $$\lambda \frac{d^2u}{dx^2} + a + bx = 0$$
  
  (and I find the use of ##a_n## and ##b_n## in your notation confusing, since ##a## and ##b## are allready used).
  
  Linder88 said:
  Homework Statement:: I need help with finding the approximate solution of a second order differential equation.
  Relevant Equations:: I am given the differential equation as in
  $$\lambda \frac{d^2u}{dx^2} + q = 0$$
  which is defined over $$x \in [-L/2,L/2]$$ and where $$q = a+bx$$.
  
  I am supposed to find an approximative solution using a spectral method, i.e. using cosine and sine terms that fulfills the essential boundary conditions given by
  $$u \bigg ( -\frac{L}{2} \bigg ) = 0, u \bigg (\frac{L}{2} \bigg ) = 0$$
  The appoximative solution should be represented by a Fourier series and by noticing that the terms in the integral are orthogonal, the matrix of the system of equations should be diagonal.
  
  We choose an approximative solution given by
  $$u_N(x) = \frac{a_0}{2} + \sum_{n=1}^N a_n \cos nx + b_n \sin nx$$
  Comparing this approximative solution with the differential equation yields that
  $$\frac{a_0}{2} = a$$
  
  No. It's the second derivative of $u$ that is equal to $\frac{-q(x)}{\lambda}$, not $u$ itself. When you differentiate the constant term you get zero, and in any case a non-zero constant does not satisfy the boundary condition.
  
  and the boundary conditions yields the equation system
  $$a + \sum_{n=1}^N a_n \cos \bigg ( \frac{nL}{2} \bigg ) + b_n \sin \bigg ( \frac{nL}{2} \bigg ) = 0 \\ a + \sum_{n=1}^N a_n \cos \bigg ( -\frac{nL}{2} \bigg ) + b_n \sin \bigg ( -\frac{nL}{2} \bigg ) = 0$$
  So at least I got a system of two equations but I do not know where to go from here. How should I use the orthogonality to set up a matrix from these two equations?
  
  You have $u(x) \approx \sum_n u_n\phi_n(x)$ where $$\phi_n(-L/2) = \phi_n(L/2) = 0.$$ Therefore $$\lambda \sum_n u_n \phi_n''(x) \approx -q(x)$$ and we determine the $u_n$ by requiring that the inner product with $\phi_m$ should be exact, ie. $$\lambda \sum_n u_n \int_{-L/2}^{L/2} \phi_n''(x) \phi_m(x)\,dx = -\int_{-L/2}^{L/2} q(x)\phi_m(x)\,dx.$$ The matrix you are looking for is the matrix of coefficients $$M_{mn} = \int_{-L/2}^{L/2} \phi_n''(x) \phi_m(x)\,dx.$$
  
  Now the choice of a Fourier basis means that $$\phi_n(x) = A_n\cos(k_n x) + B_n\sin(k_n x)$$ and $k_n$ is such that the boundary conditions are satisfied by something other than $A_n = B_n = 0$.
  
  Last edited:
  etotheipi
  
  ## What is a second order differential equation?
  
  A second order differential equation is a mathematical equation that involves the second derivative of a function. It is used to model various physical phenomena, such as motion, heat transfer, and electrical circuits.
  
  ## What is the general form of a second order differential equation?
  
  The general form of a second order differential equation is: y'' = f(x, y, y'), where y'' is the second derivative of y with respect to x, and f(x, y, y') is a function of x, y, and the first derivative of y with respect to x, y'.
  
  ## What is the difference between a homogeneous and non-homogeneous second order differential equation?
  
  A homogeneous second order differential equation is one where the right-hand side of the equation is equal to zero, while a non-homogeneous second order differential equation has a non-zero right-hand side. Homogeneous equations have simpler solutions compared to non-homogeneous equations.
  
  ## What is the role of initial conditions in solving a second order differential equation?
  
  Initial conditions are necessary in solving a second order differential equation because they provide the values of the function and its first derivative at a specific point. These conditions are used to find the particular solution to the equation.
  
  ## What methods can be used to solve a second order differential equation?
  
  There are several methods for solving a second order differential equation, including separation of variables, substitution, and the method of undetermined coefficients. Other methods include Laplace transforms, power series, and numerical methods such as Euler's method and the Runge-Kutta method.
metadata: {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 2, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}