wolfram mathematica – Solving 2d movement differential equations – Education Career Blog

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:

  x''t*m == k1 + k2*yt,
  y''t*m == k3*t,
  y'0 == 0,
  y0 == 0,
  x'0 == 0,
  x0 == 0
}, {xt, yt}, 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 yt,m (y^PrimePrime)t==k3 t,True,y0==0,True,x0==0}.

It seems that Mathematica is unhappy about boundary conditions x’0 == 0. Why is that?


It worked as you typed it … try to do it in a fresh notebook

alt text


When I cut and paste the code you’ve posted into M’ma 7.0.1 and evaluate, I get the result

{{xt -> (60*k1*m*t^2 + k2*k3*t^5)/(120*m^2), 
     yt -> (k3*t^3)/(6*m)}}

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 yt, 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 to True. Best way to test: kill your kernel and re-evaluate the input above (after fixing typos).


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

?<variable name>

As an alternative to killing the kernel, I’d suggest clearing their values via

Clearx, y, k1, k2, k3, m

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.

Leave a Comment