Skip to main content
Became Hot Network Question
fixed wrong output
Source Link
Gravifer
  • 904
  • 7
  • 19
sol2 = ParametricNDSolve[{X'[t] == t + (Sqrt[3] / Pi) Log[a/(1 - a)] Abs[t X[t]] - X[t], X[0] == 1}, {X}, {t, 0, 2}, a]
(* ::Output:: *) (*
{x -> ParametricFunction[ <> ]}
*)

root2 = FindRoot[Evaluate[X[a][2] /. sol2] == 3, {a, .5}]
(* ::Output:: *) (*
[!] InterpolatingFunction: Input {2} lies outside the range of data... (InterpolatingFunction::dmval)
{sa -> 10.40296812787}
*)
sol2 = ParametricNDSolve[{X'[t] == t + (Sqrt[3] / Pi) Log[a/(1 - a)] Abs[t X[t]] - X[t], X[0] == 1}, {X}, {t, 0, 2}, a]
(* ::Output:: *) (*
{x -> ParametricFunction[ <> ]}
*)

root2 = FindRoot[Evaluate[X[a][2] /. sol2] == 3, {a, .5}]
(* ::Output:: *) (*
[!] InterpolatingFunction: Input {2} lies outside the range of data... (InterpolatingFunction::dmval)
{s -> 1.40296}
*)
sol2 = ParametricNDSolve[{X'[t] == t + (Sqrt[3] / Pi) Log[a/(1 - a)] Abs[t X[t]] - X[t], X[0] == 1}, {X}, {t, 0, 2}, a]
(* ::Output:: *) (*
{x -> ParametricFunction[ <> ]}
*)

root2 = FindRoot[Evaluate[X[a][2] /. sol2] == 3, {a, .5}]
(* ::Output:: *) (*
[!] InterpolatingFunction: Input {2} lies outside the range of data... (InterpolatingFunction::dmval)
{a -> 0.812787}
*)
edited tags
Link
Szabolcs
  • 236.5k
  • 31
  • 641
  • 1.3k
additional information
Source Link
Gravifer
  • 904
  • 7
  • 19

I suspect there is some internal bug with ParametricFunction that results inHow to understand this behavior. How can I pin it down, and is there a current workaround? Is using ParametricNDSolve at this stage advisable at all if it's a bug?


Related:

  1. ParametricFunction from ParametricNDSolveValue changes when evaluated?
  2. Vector ParametricNDSolve and FindRoot interaction
  3. Issue in ParallelTable after evaluating another function using NDSolve and FindRoot

I suspect there is some internal bug with ParametricFunction that results in this behavior. How can I pin it down, and is there a current workaround? Is using ParametricNDSolve at this stage advisable at all?

Source Link
Gravifer
  • 904
  • 7
  • 19
Loading