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

• Comp Sci

## 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

Related Engineering and Comp Sci Homework Help News on Phys.org
BvU
Homework Helper
2019 Award
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 ?

pasmith
Homework Helper
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 \begin{align*} \frac{y_{n+1} - y_n}{\Delta x} = v_n \\ \frac{v_{n+1} - v_n}{\Delta x} = y_n \end{align*} and so are actually solving the linear recurrence $$\mathbf{y}_{n+1} = A \mathbf{y}_n$$
where $\mathbf{y}_n = (y_n, v_n)^T$ and
$$A = \begin{pmatrix} 1 & \Delta x \\ \Delta x & 1 \end{pmatrix}.$$ Now this recurrence can be solved analytically: the solution is $$\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$$ where $a_i$ are constants determined by the initial conditions.
Now as $1 + \Delta x > 1$ for any strictly positive $\Delta x$ we see that $\|\mathbf{y}_n\| \to \infty$ as $n \to \infty$ for any initial conditions with $a_1 \neq 0$. 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 $n \to \infty$.

pbuk