<p>您没有按预期构造<code>ics</code>参数:</p>
<pre><code>In [6]: dsolve(eq, ics={x.subs(t, 1.0): 0, x.subs(t, 2.0): 5})
Out[6]:
-0.125⋅t
x(t) = (-0.0346285740992263⋅sin(1.57619002661481⋅t) - 6.42012708343871⋅cos(1.57619002661481⋅t))⋅ℯ
</code></pre>
<p>如果不使用浮动,答案会更好(主观上)。此外,我发现将变量<code>x</code>作为函数<code>x</code>而不是应用函数<code>x(t)</code>更为自然,例如:</p>
<pre><code>In [15]: x = Function('x')
In [16]: x
Out[16]: x
In [17]: x(t)
Out[17]: x(t)
In [18]: eq = x(t).diff(t, 2) + x(t).diff(t)/4 + 5*x(t)/2
In [19]: eq
Out[19]:
d
──(x(t)) 2
5⋅x(t) dt d
────── + ──────── + ───(x(t))
2 4 2
dt
In [20]: dsolve(eq, x(t), ics={x(1): 0, x(2): 5})
Out[20]:
⎛ 1/4 ⎛√159⋅t⎞ ⎞ -t
⎜5⋅ℯ ⋅sin⎜──────⎟ ⎟ ───
⎜ ⎝ 8 ⎠ 1/4 ⎛√159⋅t⎞⎟ 8
x(t) = ⎜────────────────── - 5⋅ℯ ⋅cos⎜──────⎟⎟⋅ℯ
⎜ ⎛√159⎞ ⎝ 8 ⎠⎟
⎜ tan⎜────⎟ ⎟
⎝ ⎝ 8 ⎠ ⎠
</code></pre>