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

  • Comp Sci
  • Thread starter Kaguro
  • Start date
  • #1
108
18

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?
 

Answers and Replies

  • #2
BvU
Science Advisor
Homework Helper
2019 Award
13,413
3,191
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 ?
 
  • #3
pasmith
Homework Helper
1,770
439
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*}
\frac{y_{n+1} - y_n}{\Delta x} = v_n \\
\frac{v_{n+1} - v_n}{\Delta x} = y_n
\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 pbuk

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

Replies
3
Views
5K
Replies
4
Views
2K
Replies
7
Views
873
  • Last Post
Replies
1
Views
1K
  • Last Post
Replies
5
Views
553
Replies
3
Views
2K
Replies
8
Views
5K
  • Last Post
Replies
3
Views
621
Top