import numpy as np
import matplotlib.pyplot as plt

def symplektisk_euler(f,g,x0,y0,h):
	x = [x0]
	y = [y0]
	for i in range(10000):
		x.append(x[i] + h*f(x[i],y[i]))
		y.append(y[i] + h*g(x[i+1],y[i]))
	return x, y

def f(x,y):
	return y

def g(x,y):
	return (1-x**2)*y - x

for i in range(10):
	x, y = symplektisk_euler(f, g, i*0.1, 0, 0.01)
	plt.plot(x,y)

plt.grid(True)
plt.show()