1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
| #! /usr/bin/env python3
# vim:fenc=utf-8
#
# Copyright © 2023 feng <feng@archlinux>
#
# Distributed under terms of the MIT license.
import numpy as np
import sympy as sym
import matplotlib.pyplot as plt
from scipy.integrate import odeint
from sympy.abc import t
def fun_new(y, t, a, b):
f, df, g, dg = y
# my formular
dydt = [ df , (-a+b)*f- t*g , dg, (-a-b)*g-t*f ]
# article formular
# dydt = [ df , (-a+t)*f+b*g , dg, (-a-t)*g+b*f ]
return dydt
# 初始条件
y0=[0,-0.36012, 1, 0]
# t=np.linspace(0,5,101)
t_left=np.arange(0,-6,-0.001)
sol_left = odeint(fun_new , y0, t_left, args=(5/(2**(1/3)),2**(2/3)))
t_right=np.arange(0,6,0.001)
sol_right= odeint(fun_new , y0, t_right, args=(5/(2**(1/3)),2**(2/3)))
plt.plot(t_left,sol_left[:,0], color="r", label="$\phi_1$")
plt.plot(t_left,sol_left[:,2], color="b", label="$\phi_2$")
plt.plot(t_right,sol_right[:,0], color="r")
plt.plot(t_right,sol_right[:,2], color="b")
plt.axhline(0,color="gray") # 画过原点的水平线
plt.axvline(0,color="gray") # 画过原点的竖直线
plt.text(0.5, 1.5, r"$(-\frac{d^2}{dy^2}-\frac{\epsilon}{2^{1/3}}+2^{2/3})\phi_1(y)-y\phi_2(y)=0$", fontsize=20)
plt.text(0.5, 1.1, r"$(-\frac{d^2}{dy^2}-\frac{\epsilon}{2^{1/3}}-2^{2/3})\phi_2(y)-y\phi_1(y)=0$", fontsize=20)
plt.title("Zhen-Hua Feng FIG.11 $\epsilon=5$ $\phi_1=0$, $\phi_1'=-0.36012$, $\phi_2=1$, $\phi_2'=0$ ", fontproperties="SimHei", fontsize=20)
plt.xlabel("y")
plt.ylabel("$\phi_1$ and $\phi_2$")
plt.legend()
plt.show()
|