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
Join the discussion
Registration is free. Start your own thread to ask a follow-up.
2 replies · 1K views
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