예제 #1
0
파일: zicvic.py 프로젝트: zicvic/FMNN05
    return f
    
    
    
    
#pend_mod=Explicit_Problem(f, y0=np.array([1, 1, 0, 0] ))
#pend_mod.problem_name='Nonlinear Pendulum'

#Define an explicit solver
#exp_sim = CVode(pend_mod) #Create a BDF solver

#t, y = exp_sim.simulate(1)

rhs = getRHS(100)
pend_mod=Explicit_Problem(rhs, y0=np.array([2, 2, 0, 0]))
pend_mod.problem_name='Nonlinear Pendulum'

#Define an explicit solver
solver = CVode(pend_mod)

time = 10
t1,y1 = solver(time)

P.plot(y1[:,0],y1[:,1])
P.grid()
P.show()
P.title('CVode for k = 1, time = 30s')
P.xlabel('X-pos')
P.ylabel('Y-pos')