基于python的数学建模---洛伦兹线与数值解

2023-02-12,,,

import numpy as np
from scipy.integrate import odeint
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt def dmove(Point, t, sets):
p, r, b = sets
x, y, z = Point
return np.array([p * (y - x), x * (r - z), x * y - b * z]) t = np.arange(0, 30, 0.001)
# func y0 时间 超参 赋值给 P,R,B的值
P1 = odeint(dmove, (0., 1., 0.), t, args=([10., 28., 3.],))
#odeint 是将时间下所对应的x,y,z值求出
P2 = odeint(dmove, (0., 1.01, 0.), t, args=([10., 28., 3.],))
fig = plt.figure()
ax = Axes3D(fig)
# X Y Z
ax.plot(P1[:, 0], P1[:, 1], P1[:, 2])
ax.plot(P2[:, 0], P2[:, 1], P2[:, 2])
plt.xlabel("x")
plt.ylabel("y")
plt.show()

基于python数学建模---洛伦兹线与数值解的相关教程结束。

《基于python的数学建模---洛伦兹线与数值解.doc》

下载本文的Word格式文档,以方便收藏与打印。