0
對於微分方程mx'' + kx = 0
(其中x''
是x
相對於t
的雙重導數),如何解決這個問題x(t)
?我的意思是如何得到這個公式:如何求解二階微分方程?
x(t) = c1*cos(sqrt(k/m)*t) + c2*sin(sqrt(k/m)*t)
我試了一下:
t, g, k, m, w0, a_0, b_0, c1, c2 = symbols('t g k m w0 a_0 b_0 c1 c2')
x = symbols('x', cls=Function)
w0 = sqrt(k/m)
diffeq = Eq(x(t).diff(t, t) + k*x, 0)
但聲明diffeq = Eq(x(t).diff(t, t) + k*x, 0)
拋出一個錯誤:
TypeError: unbound method as_base_exp() must be called with x instance as first argument (got nothing instead)
你試過[dsolve的'第一個例子()'](http://docs.sympy.org/dev/modules/solvers/ode.html#dsolve)? – kennytm
@kennytm;我編輯了這個問題。 – haccks
@kennytm;好的,我弄錯了。我想出瞭如何去做。 – haccks