3

I need to distiguish the true rotation of a vector (time dependent, solution of a system of two coupled differential equation) respect a fixed vector. As showed in the follow,neither VectorAngle nor ArcCos work, because they yeld only positive results (i.e. as a counterclockwise rotation). I'm sure (from physical reasoning that the correct result is the opposite).

sol1 = FullSimplify[
   DSolve[{y'[t] == -3 y[t] - z[t], z'[t] == -0.6 z[t] + y[t], 
   y[0] == 0, z[0] == 1}, {y[t], z[t]}, t]];

{{Gy[t_], Gz[t_]}} = {-z[t], y[t]} /. sol1;

sol2 = FullSimplify[
   DSolve[{vy'[t] == -3 vy[t] - vz[t], 
 vz'[t] == -0.6 vz[t] +  vy[t], vy[T] == Gy[T], 
 vz[T] == Gz[T]}, {vy[t], vz[t]}, t]];

{{VY[t_], VZ[t_]}} = Simplify[{vy[t], vz[t]} /. sol2];

ang[T_]= VectorAngle[{Gy[0], Gz[0]}, {VY[0], VZ[0]}];

Plot[ang[T], {T, 0, 8}, PlotRange -> Full]

You can see, if you compile the code, that the plot result is: plot-output, but it'is incorrect

I can obtain the correct result if I put an overall minus sign in VectorAngle, but obviously this is an incorrect procedure. I show her the output just for say you what is the "correct" output (as I said previously, I motivate it by physical reasoning)correct plot-output

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
Mike84
  • 77
  • 6

1 Answers1

2

I'd suggest using a difference of ArcTan as Kuba implies. ArcSin @Last@Cross[{Normalize[{Gy[0], Gz[0], 0}]}, {Normalize[{VY[0], VZ[0], 0}]}] has a similar problem with range that VectorAngle has.

ang[T_] = ArcTan[VY[0], VZ[0]] - ArcTan[Gy[0], Gz[0]];

Plot[ang[T], {T, 0, 8}, PlotRange -> Full]

Mathematica graphics

It also works this way:

Clear[ang];
ang[T0_?NumericQ] :=
  ArcTan @@ First @ RotationMatrix[{{VY[0], VZ[0]}, {Gy[0], Gz[0]}} /. T -> T0];
Michael E2
  • 235,386
  • 17
  • 334
  • 747
  • Thank you very much! I was writting that I had the same problem with Cross, as you say, when you posted correct solution! – Mike84 Mar 18 '14 at 18:01