Question:
Given an ode $x'=e^{-x}\sin(x)$, initial condition is $x(0)=-2\pi$. Why the x(t) is not a straight line in the graph x vs t?
Thoughts:
I found out the fixed points, $x=-2\pi$ is one of the unstable fixed points. Which means the velocity is 0 at that point.
Which means if its initially there, it should never move. Then it should be a straight line in the graph. Am I correct?
Situation:
But when I draw it in python its not the case::
import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt
# function that returns dx/dt
def dxdt(x, t):
return np.exp(-x)*np.sin(x)
# time points
t = np.linspace(0,20, 100)
plt.rcParams['figure.figsize'] = [15, 6]
fig, ax = plt.subplots(1)
# initial condition
x0 = -2*np.pi
# solve ODE
x = odeint(dxdt,x0,t)
# plot results
ax.plot(t, x)
ax.set(xlabel='time', ylabel='x(t)')
import matplotlib.ticker as tck
ax.yaxis.set_major_formatter(tck.FuncFormatter(
lambda val,pos: '{:.0g}$\pi$'.format(val/np.pi) if val !=0 else '0'
))
ax.yaxis.set_major_locator(tck.MultipleLocator(base=np.pi))
For more initial conditions, x(t) is actually not in -2pi, -4pi, ... when time is positive :
Why is that?


The issue is with numerical errors:
This is not zero. You can do something like: