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