求解二维运动微分方程
我正在尝试解决一个非常简单的问题,即在力 {k1+k2 * y, k3*t} 下查找物体位置。这是我在 Mathematica 7 中输入的内容:
DSolve[{
x''[t]*m == k1 + k2*y[t],
y''[t]*m == k3*t,
y'[0] == 0,
y[0] == 0,
x'[0] == 0,
x[0] == 0
}, {x[t], y[t]}, t]
我收到此错误:
DSolve::deqn: Equation or list ofequations Expected instead of True in the first argument {-C m (x^[Prime])[t ]^2==k1+k2 y[t],m (y^[素数][素数])[t]==k3 t,真,y[0]==0,真,x[0]== 0}.
Mathematica 似乎对边界条件 x'[0] == 0 不满意。为什么呢?
I'm trying to solve a really simple problem of finding object position under force {k1+k2 * y, k3*t}. Here's what I'm entering into Mathematica 7:
DSolve[{
x''[t]*m == k1 + k2*y[t],
y''[t]*m == k3*t,
y'[0] == 0,
y[0] == 0,
x'[0] == 0,
x[0] == 0
}, {x[t], y[t]}, t]
and I get this error:
DSolve::deqn: Equation or list of equations expected instead of True in the first argument {-C m (x^[Prime])[t]^2==k1+k2 y[t],m (y^[Prime][Prime])[t]==k3 t,True,y[0]==0,True,x[0]==0}.
It seems that Mathematica is unhappy about boundary conditions x'[0] == 0. Why is that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
它在您输入时起作用...尝试在新笔记本中执行此操作
It worked as you typed it ... try to do it in a fresh notebook
当我剪切并粘贴您发布到 M'ma 7.0.1 的代码并进行评估时,我得到了结果
Your M'ma 错误消息告诉我您实际上在 x 上只有一个素数(即
x'[t ]
) 在您实际的 M'ma 输入中。它引用的方程-C m (x^[Prime])[t]^2==k1+k2 y[t]
与上面代码的第一行不匹配。我还怀疑 x'[0] 和 y'[0] 之前已被赋值为零,这导致
x'[0]==0, ..., y' [0]==0
都折叠为True
。最好的测试方法:杀死你的内核并重新评估上面的输入(修复拼写错误后)。When I cut and paste the code you've posted into M'ma 7.0.1 and evaluate, I get the result
Your M'ma error message tells me you actually have only one prime on x (i.e.
x'[t]
) in your actual M'ma input. The equation it cites,-C m (x^[Prime])[t]^2==k1+k2 y[t]
, does not match the first line of your code above.I also suspect that x'[0] and y'[0] have been assigned to zero previously, which is causing
x'[0]==0, ..., y'[0]==0
to both collapse toTrue
. Best way to test: kill your kernel and re-evaluate the input above (after fixing typos).贝利撒留和埃里克·塔尔斯都建议终止内核并重新评估。他们很可能是正确的,因为某些东西有预先的定义。您可以通过检查这是否属实。
作为终止内核的替代方法,我建议通过清除它们的值
,或者,如果您确实想删除变量的任何定义,请使用
Remove
。这样,您就不必重新计算当前会话中的任何其他内容。Both, belisarius and Eric Towers have suggested killing the kernel and re-evaluating. They're most likely correct in that something has a prior definition. You can check if that is true via
As an alternative to killing the kernel, I'd suggest clearing their values via
Or, if you really want to rid yourself of any definition of a variable there's
Remove
. This way, you won't have to recalculate anything else from your current session.