0

I have to find the first few zeros of function for which I have not the analitycal expression. The function is named f in the following code and it is the result of a combination of solution of differential equation. (I have attach its plot ). I tried with FindRoots and I tried to follow this post but I've not solved my problem...

ti = 0;
u = 8;
yi = 0;
zi = -.75;
zf = -.5;

sol = FullSimplify[DSolve[{y'[t] == 1/(2 zf) y[t] - u z[t], 
 z'[t] == -1 + 1/zf z[t] + u y[t], y[ti] == yi, 
 z[ti] == zi}, {y[t], z[t]}, t]];

{{ysol[t_], zsol[t_]}} = Simplify[{y[t], z[t]} /. sol, 
 Assumptions -> Element[u, Reals] && Element[zi, Reals] && t > 0];

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

soladj = DSolve[{vy'[t] == 1/(2 zf) vy[t] - u vz[t], 
 vz'[t] == -1 + 1/zf vz[t] + u vy[t], vy[T] == Gy[T], 
 vz[T] == Gz[T]}, {vy[t], vz[t]}, t];

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

f[T0_?NumericQ] := ArcTan @@ First@RotationMatrix[{{VY[0], VZ[0]},
 {Gy[0],Gz[0]}} /. T -> T0]

plotf = Plot[f[T0], {T0, 0, 4}, PlotRange -> Full, MaxRecursion ->15,
 LabelStyle -> {FontSize -> 15}]

plotf

Mike84
  • 77
  • 6
  • There is not definition for Theta function ([Theta][T0]) in your code. Not Plot results. – Basheer Algohi May 30 '14 at 14:53
  • 1
    By numerically looking for zero crossings of the ArcTan, you will get spurious results that don't correspond to zeros of the function, whenever the ArcTan goes to infinity and flips sign. I think you should look for zeros of the sine, which means replacing your definition f[T0_?NumericQ] := ArcTan @@ by Chop@Last@First@. – Jens May 30 '14 at 17:20

1 Answers1

2

By using JM's answer on the post you linked:

l = FindAllCrossings[Re@f[x], {x, 0, 4}, WorkingPrecision -> 20];
Plot[f[T0], {T0, 0, 4}, PlotRange -> Full, 
     Epilog -> {Red, PointSize[Large], Point[{#, 0} & /@ l]}]

Mathematica graphics

Dr. belisarius
  • 115,881
  • 13
  • 203
  • 453