我正在使用 JiTCODE 来计算 Lorenz 振荡器的 Lyapunov 指数。
这是文档之后的简单脚本:
import numpy as np
import pylab as plt
from jitcode import jitcode_lyap, y
p, r, b = 10.0, 28.0, 8.0/3.0
x0 = np.array([10.0, 10.0, 5.0])
f = [
p * y(1) - p * y(0),
-y(0) * y(2) + r * y(0) - y(1),
y(0) * y(1) - b * y(2)
]
n = len(f)
times = range(10, 1000, 10)
nstep = len(times)
lyaps = np.zeros((nstep, n))
ODE = jitcode_lyap(f, n_lyap=n)
ODE.set_integrator("vode")
ODE.set_initial_value(x0, 0.0)
for time in times:
print(ODE.integrate(time)[1])
我收到以下错误。
Generating, compiling, and loading C code.
generated C code for f
generated symbolic Jacobian
generated C code for Jacobian
/usr/local/lib/python3.6/dist-packages/scipy/integrate/_ode.py:1009: UserWarning: vode: Excess work done on this call. (Perhaps wrong MF.)
self.messages.get(istate, unexpected_istate_msg)))
Traceback (most recent call last):
File "main.py", line 29, in <module>
print(ODE.integrate(time)[1])
File "/home/abolfazl/.local/lib/python3.6/site-packages/jitcode/_jitcode.py", line 755, in integrate
super(jitcode_lyap, self).integrate(*args, **kwargs)
File "/home/abolfazl/.local/lib/python3.6/site-packages/jitcode/_jitcode.py", line 656, in integrate
return self.integrator.integrate(*args,**kwargs)
File "/home/abolfazl/.local/lib/python3.6/site-packages/jitcode/integrator_tools.py", line 131, in integrate
raise UnsuccessfulIntegration
jitcode.integrator_tools.UnsuccessfulIntegration
我认为方程式不是问题,因为我已经解决了jitcode
但jitcode_lyap
无法解决。