I’ve been trying to find the roots of an interpolating function, but when using FindRoot I get $RecursionLimit and the value is returned in Hold[] which wont let me assign it to variables.
vd = Sqrt[(xd'[t])^2 + (yd'[t])^2]
forced = (0.5 1.3 0.05^2 vd^2)
eqsd = {xd''[t] == -(forced xd'[t])/(0.5 vd),
yd''[t] == -9.8 - (forced yd'[t])/(0.5 vd)}
inid[v_, \[Theta]_] := {xd[0] == 0, yd[0] == 0,
xd'[0] == v Cos[\[Theta]], yd'[0] == v Sin[\[Theta]]}
rules[in_, ti_, tf_] := NDSolve[Join[eqsd, in], {xd, yd}, {t, ti, tf}]
rule0 = rules[inid[98.99, Pi/4], 0, 20]
xd0[t_] := xd[t] /. rule0[[1]]
yd0[t_] := yd[t] /. rule0[[1]]
FindRoot[yd0[t], {t, 5}]
Welcome to Wolfram Community! Please make sure you know the rules: https://wolfr.am/READ-1ST
The rules explain how to format your code properly. Images don’t help other members to copy your code. Please EDIT your post and make sure code blocks start on a new paragraph and look framed and colored like this.
int = Integrate[1/(x^3 - 1), x];
Map[Framed, int, Infinity]
You can also embed notebook or attach notebook.
Hi Juan,
When I run the code I get
InterpolatingFunction::dmval: Input value {26.1579} lies outside the
range of data in the interpolating function. Extrapolation will be
used.
(* {t -> 9.9333} *)
Plot[yd0[t], {t, 0, 10}]
Are you looking for the root or the maximum?
FindMaximum[yd0[t], {t, 5}, WorkingPrecision -> 10]
(* {123.4962338, {t -> 4.394687581}} *)