# Problem with Heun's Method

Tags:
1. Feb 8, 2016

### akaPaul

1. The problem statement, all variables and given/known data
Use the Heun method to compute the period of small oscillations about the equilibrium position of a nitrogen atom.
xi = 1.1
Um = 7.37
x0 = 1.2
alpha = 2.287
m = 2.325e-26

2. Relevant equations

U(x) = Um((1-e^(-alpha(x-x0)))^2 - 1)

3. The attempt at a solution

I was told to take the derivative of dU/dx and got (-1/m)*(2*Um*alpha*(1-e**(-alpha*(x-x0)))*(e**(-alpha*(x-x0)))) and used that to calculate my heun step with a time step of 0.5e-15. With this I get a graph that looks like this: which is a velocity vs. time graph. I'm wondering if this graph looks correct and if so why? I thought it would turn out to be something more like:

2. Feb 8, 2016

### SteamKing

Staff Emeritus
If $U(x) = U_m((1-e^{(-alpha(x-x0)))^2 - 1)}$, it's not clear how you calculated

$$U'(x) = (-1/m)*(2*Um*alpha*(1-e^{(-alpha*(x-x0)))}*(e^{(-alpha*(x-x0)))}))$$

I'm assuming that $U_m$ is a constant and not $U ⋅ m$.

You might want to use some substitutions in the original expression for U(x) to simplify its form before taking the derivative. I would check the derivative using a tool like Wolfram Alpha before writing code with it.

3. Feb 8, 2016

### akaPaul

Yea sorry about my bad formatting you're right it is a constant and I used python to compute the derivative.

4. Feb 8, 2016

### SteamKing

Staff Emeritus
I'm not sure how you do that, but I would check the derivative which Python gave against a pencil and paper derivative or Wolfram Alpha.