摘要:
hfrom scipy.integrate import odeint import numpy as np import pylab as plt yx = lambda y,x: [y[1], np.sqrt(1+y[1]**2)/5/(1-x)] x0 = np.arange(0, 1, 0. 阅读全文
posted @ 2025-01-03 19:20
世梦
阅读(3)
评论(0)
推荐(0)
摘要:
from scipy.integrate import odeint import numpy as np import pylab as plt import sympy as sp dy = lambda y, x: -2y+2x2+2x #自变量在后面 xx = np.linspace(0,3 阅读全文
posted @ 2025-01-03 19:20
世梦
阅读(9)
评论(0)
推荐(0)
摘要:
import sympy as sp sp.var('t') sp.var('x1:4', cls=sp.Function) #定义3个符号函数 x = sp.Matrix([x1(t), x2(t), x3(t)]) #列向量 A = sp.Matrix([[3,-1,1],[2,0,-1],[1 阅读全文
posted @ 2025-01-03 19:19
世梦
阅读(1)
评论(0)
推荐(0)
摘要:
import sympy as sp sp.var('t'); y=sp.Function('y') u=sp.exp(-t)sp.cos(t) eq=y(t).diff(t,4)+10y(t).diff(t,3)+35y(t).diff(t,2)+ 50y(t).diff(t)+24*y(t)-u 阅读全文
posted @ 2025-01-03 19:19
世梦
阅读(3)
评论(0)
推荐(0)
摘要:
import sympy as sp sp.var('x'); y=sp.Function('y') eq=y(x).diff(x,2)-2*y(x).diff(x)+y(x)-sp.exp(x) con={y(0): 1, y(x).diff(x).subs(x,0): -1} s=sp.dsol 阅读全文
posted @ 2025-01-03 19:18
世梦
阅读(1)
评论(0)
推荐(0)
摘要:
import sympy as sp sp.var('x'); y=sp.Function('y') eq=y(x).diff(x)+2y(x)-2x**2-2*x s=sp.dsolve(eq, ics={y(0):1}) s=sp.simplify(s); print(s) 阅读全文
posted @ 2025-01-03 19:18
世梦
阅读(2)
评论(0)
推荐(0)
摘要:
import numpy as np import pylab as plt from scipy.interpolate import interp1d from scipy.interpolate import lagrange a = np.loadtxt('F:\python数学建模与算法\ 阅读全文
posted @ 2025-01-03 19:17
世梦
阅读(3)
评论(0)
推荐(0)
摘要:
import numpy as np from scipy.interpolate import lagrange import matplotlib.pyplot as plt import matplotlib yx = lambda x: 1/(1+x**2) def fun(n): x = 阅读全文
posted @ 2025-01-03 19:17
世梦
阅读(2)
评论(0)
推荐(0)
摘要:
import numpy as np from scipy.interpolate import lagrange x0 = np.arange(1, 7) y0 = np.array([16, 18, 21, 17, 15, 12]) p = lagrange(x0, y0) print("从高到 阅读全文
posted @ 2025-01-03 19:16
世梦
阅读(2)
评论(0)
推荐(0)
摘要:
import numpy as np import matplotlib.pyplot as plt x0 = np.arange(1, 7) y0 = np.array([16, 18, 21, 17, 15, 12]) A = np.vander(x0) # 范德蒙行列式 p = np.lina 阅读全文
posted @ 2025-01-03 19:15
世梦
阅读(6)
评论(0)
推荐(0)