Group Abstract Group Abstract

Message Boards Message Boards

Numerically check time derivative?

Posted 10 years ago

Hello!

I'm new to mathematica and I'm having some trouble properly setting up a test case. I have an equation G as well as its time derivative Gdot, I want to take the derivative of G, then plug in numerical values and compare that to numerical values directly plugged into Gdot. rvec is the position vector with a time dependence and vvec is the velocity vector also with a time dependence.

rvec  = {x[t], y[t], z[t]}
r = Norm[rvec];
rhat = rvec/r;
vvec = {x'[t], y'[t], z'[t]}
mu = 398600.4418;

The first equation is:

G = mu/r^3*(3*Outer[Times, rhat, rhat] - IdentityMatrix[3]);

Then I take its derivative and plug in some values:

D[G, t] /. {x[t] -> 42164, y[t] -> 0, z[t] -> 0, x'[t] -> 0, 
     y'[t] -> 3.07466628412768, z'[t] -> 0} // FullSimplify // 
  N // MatrixForm

Since I know the actual derivative I can also directly plug in values there:

Gdot = 3*mu/r^4*(Outer[Times, vvec, rhat] + Outer[Times, rhat, vvec]*(5*Outer[Times, rhat, rhat] - IdentityMatrix[3])) 
/. {x[t] -> 42164, y[t] -> 0, z[t] -> 0, x'[t] -> 0, y'[t] -> 3.07466628412768, z'[t] -> 0} // FullSimplify // N // MatrixForm

The problem is that the results are not the same, and the reason is because vvec has 9 elements:

{{0., 0., 0.}, {3.07467, 0., 0.}, {0., 0., 0.}}

So I'm not setting something up right since it's only supposed to be 3 elements, simply the time derivative of rvec. Any help on how to do this is appreciated. Thanks!

POSTED BY: Jeroen Geeraert
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard