Professional Documents
Culture Documents
Tema SSD
Tema SSD
# initial condition
y1 = 1
# time points
x = np.linspace(1, 10)
# solve ODE
y = odeint(model,y1,x)
# plot results
plt.plot(x,y)
plt.xlabel('time')
plt.ylabel('y(x)')
plt.show()
import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt
# initial condition
y1 = 1
# time points
x = np.linspace(1, 10)
# solve ODE
y = odeint(model,y1,x)
def solexact(x):
return (x/4.0) * np.power(np.log(np.absolute(x)), x)
# plot results
plt.plot(x,y,'b',x,solexact(x),'r*')
plt.xlabel('time')
plt.ylabel('y(x)')
plt.show()