import numpy as np
import pandas as pd
import sympy as sp
sp.init_printing(use_latex=True)
from scipy.integrate import odeint
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif']=['Times New Roman + SimSun + WFM Sans SC']
plt.rcParams['mathtext.fontset']='stix'
Times New Roman + SimSun + WFM Sans SC
simsum宋體, times new roman -*, simhei黑體, kaiti楷體,
dengxian等線, fangsong仿宋, Microsoft Yahei微軟雅黑
plt.rcParams['axes.unicode_minus']=False
plt.rcParams['figure.dpi'] = 200
plt.rcParams['figure.figsize'] = [4, 3]
plt.rcParams['font.size'] = 12
plt.rcParams['xtick.direction']='in'
plt.rcParams['ytick.direction']='in'
def rhs(f, t):
f, f1, f2, T, T1 = f
return [
f1,
f2,
-3ff2 + 2f1**2 - T,
T1,
-2.1f*T1,
]
f0 = np.array([0, 0, 0.68, 1, -0.5])
nn = np.linspace(0, 10, 200)
ns = odeint(rhs, f0, nn)
ff, TT = ns[:,0], ns[:,3]
plt.plot(nn, ff)
plt.plot(nn, TT)
plt.show()