I'm using Ersek's RootSearch Package to find roots of function Nwes[t] which contains variables β[t], φ[t], γ][t] that were evaluated by NDSolve. However RootSearch fails to return any roots and gives a message:
RootSearch::numb: RootSearch took a number of inital samples and at each sample point the function sampled did not evaluate to a numeric value.
I dont understand why I got this message and how it occured that sample points dont have their numeric values.
My tries were:
increase
InitialSamplesvariable 10 times to 3000All input was treated with
N[]function to assure it's numeric (EDIT: howeverNwesandeqshad originally machine-precision)checked that there exist roots in given range
Whole code:
eqs = {1.` Sin[φ[t]] +
0.03504358287544395` Sin[γ[t] - 1.` φ[t]] Derivative[
1][γ][t]^2 +
0.31395122075073245` Cos[β[t] -
1.` φ[t]] (β^′′)[t] +
0.35557468770802175` (φ^′′)[t] ==
0.31395122075073245` Sin[β[t] - 1.` φ[t]] Derivative[
1][β][t]^2 +
4.303069289595211`*^-18 Sin[γ[t] - 1.` φ[t]] Derivative[
1][γ][t] Derivative[1][φ][t] +
0.03504358287544395` Cos[γ[t] -
1.` φ[t]] (γ^′′)[t],4.739130434782608` Sin[β[
t]] + (1.` Cos[φ[t]] Sin[β[t]] -
1.` Cos[β[t]] Sin[φ[t]]) Derivative[1][φ][
t]^2 + 1.0082125603864733` (β^′′)[t] +
1.` Cos[β[t]] Cos[φ[t]] (φ^′′)[
t] + 1.` Sin[β[t]] Sin[φ[
t]] (φ^′′)[t] ==
0.`, (1.` Cos[φ[t]] Sin[γ[t]] -
1.` Cos[γ[t]] Sin[φ[t]]) Derivative[1][φ][
t]^2 + 1.` Cos[γ[t]] Cos[φ[
t]] (φ^′′)[t] +
1.` Sin[γ[t]] Sin[φ[t]] (φ^′′)[
t] == 18.391451068616426` Sin[γ[t]] +
1.142857142857143` (γ^′′)[t]};
Subscript[φ, start] = 0.7853981633974483096;
ic1 = {φ[0] == Subscript[φ, start], φ'[0] == 0};
ic2 = {γ[0] == 0, γ'[0] == 0};
ic3 = {β[0] == -(Pi/2), β'[0] == 0};
Nwes[t_] =0.48309178743961356` Csc[φ[
t]] (39.43705641300001` Sin[φ[t]] -
266.5071770107747` Sin[φ[t]] (1.` Cos[φ[t]] +
1.` Sin[φ[t]] +
14.006711409395976` Sin[β[t] - φ[t]] Derivative[
1][β][t]^2 -
14.006711409395976` Cos[β[t] - φ[
t]] (β^′′)[t] -
13.89261744966443` (φ^′′)[
t]) (1.` Cos[φ[t]] + 1.` Sin[φ[t]] -
0.15903539639826123` (φ^′′)[t]) +
0.28451556` Cos[φ[t]] (83.40832395950507` +
1.142857142857143` Sin[γ[t]] Derivative[1][γ][t]^2 -
1.` Sin[φ[t]] Derivative[1][φ][t]^2 -
1.142857142857143` Cos[γ[t]] (γ^′′)[t] +
1.` Cos[φ[t]] (φ^′′)[t]) +
0.28451556` Sin[φ[t]] (83.40832395950507` -
1.142857142857143` Cos[γ[t]] Derivative[1][γ][t]^2 +
1.` Cos[φ[t]] Derivative[1][φ][t]^2 -
1.142857142857143` Sin[γ[t]] (γ^′′)[t] +
1.` Sin[φ[t]] (φ^′′)[t]));
SetDirectory[NotebookDirectory[]];
Get["RootSearch.m"];
sol = NDSolve[{eqs, ic1, ic2, ic3}, {φ, γ, β}, {t, 0,
2.2}];
Ersek`RootSearch`RootSearch[Evaluate[Nwes[t] /. sol] == 0, {t, 0, 2.2},InitialSamples -> 3000]
- to get RootSearch working on mathematica 9 I set
$minPrecisionto Infinity as in: http://forums.wolfram.com/mathgroup/archive/2012/Apr/msg00444.html
RootSearch[]can be found here. – J. M.'s missing motivation Apr 13 '17 at 06:35