Numerically, how to get the other solution of this 2nd order ODE?

  • Context: Comp Sci 
  • Thread starter Thread starter Kaguro
  • Start date Start date
  • Tags Tags
    2nd order Ode
Click For Summary
SUMMARY

This discussion addresses the challenge of obtaining the decaying solution exp(-x) for the second-order ordinary differential equation (ODE) y''=y using the Euler method in Scilab. The user experiences an issue where their simulation yields only the increasing solution exp(x). The analysis reveals that the numerical method approximates the ODE as a linear recurrence, leading to solutions that diverge unless specific initial conditions are set. To achieve the desired decaying solution, careful selection of initial conditions and consideration of numerical errors due to floating-point arithmetic are essential.

PREREQUISITES
  • Understanding of second-order ordinary differential equations (ODEs)
  • Familiarity with the Euler method for numerical integration
  • Basic knowledge of linear algebra and recurrence relations
  • Experience with Scilab programming for simulations
NEXT STEPS
  • Explore advanced numerical methods for solving ODEs, such as Runge-Kutta methods
  • Learn about stability analysis in numerical solutions of differential equations
  • Investigate techniques for managing numerical errors in floating-point arithmetic
  • Study the implications of initial conditions on the behavior of solutions to ODEs
USEFUL FOR

Mathematicians, physicists, and engineers involved in numerical simulations of differential equations, particularly those interested in quantum mechanics and computational methods.

Kaguro
Messages
221
Reaction score
57
Homework Statement
Given y''=y
Let
v=y'
v'=y

And solve it with Euler method,
I get only the exp(x) solution. But how can I get the exp(-x) solution?
Relevant Equations
None
Actually I was trying to write a small program in Scilab to simulate a quantum particle. When I give a potential higher than energy, the wave function should go like exp(-x) and decay. But my program just increases without bound.

Is there any nice way to do anything about it?
 
Physics news on Phys.org
Kaguro said:
I get only the exp(x) solution. But how can I get the exp(-x) solution?
How do you know that ?
What are your initial conditions ?
 
Kaguro said:
Homework Statement:: Given y''=y
Let
v=y'
v'=y

And solve it with Euler method,
I get only the exp(x) solution. But how can I get the exp(-x) solution?
Relevant Equations:: None

Actually I was trying to write a small program in Scilab to simulate a quantum particle. When I give a potential higher than energy, the wave function should go like exp(-x) and decay. But my program just increases without bound.

Is there any nice way to do anything about it?

You are unlikely to see it.

With the Euler method you are approximating the ODE as [tex] \begin{align*}<br /> \frac{y_{n+1} - y_n}{\Delta x} = v_n \\<br /> \frac{v_{n+1} - v_n}{\Delta x} = y_n <br /> \end{align*}[/tex] and so are actually solving the linear recurrence [tex] \mathbf{y}_{n+1} = A \mathbf{y}_n[/tex]
where [itex]\mathbf{y}_n = (y_n, v_n)^T[/itex] and
[tex] A = \begin{pmatrix} 1 & \Delta x \\ \Delta x & 1 \end{pmatrix}.[/tex] Now this recurrence can be solved analytically: the solution is [tex] \mathbf{y}_n = a_1 \begin{pmatrix} 1 \\ 1 \end{pmatrix} (1 + \Delta x)^n + a_2 \begin{pmatrix} 1 \\ -1 \end{pmatrix} (1 - \Delta x)^n[/tex] where [itex]a_i[/itex] are constants determined by the initial conditions.
Now as [itex]1 + \Delta x > 1[/itex] for any strictly positive [itex]\Delta x[/itex] we see that [itex]\|\mathbf{y}_n\| \to \infty[/itex] as [itex]n \to \infty[/itex] for any initial conditions with [itex]a_1 \neq 0[/itex]. So you would certainly require that in order to see the decaying solution. But even in that case the numerical error which is the inevitable consequence of floating-point arithmetic also obeys the same recurrence, and will therefore typically increase without bound as [itex]n \to \infty[/itex].
 
  • Like
Likes   Reactions: pbuk

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 19 ·
Replies
19
Views
7K
  • · Replies 5 ·
Replies
5
Views
2K
Replies
3
Views
3K