Message Boards Message Boards

Different results when solving a DE using symbolic and numerical methods

Posted 6 months ago

I'm getting different results when solving a differential equation using symbolic and numerical methods. Attached is a notebook for the community to evaluate.


POSTED BY: Sinval Santos
2 Replies
Posted 6 months ago

I didn't know about FunctionDiscontinuities. I liked this procedure. I am very grateful for the information Gianluca.

POSTED BY: Sinval Santos

The symbolic solution suffers from branch cut discontinuities. Here is a way to correct it:

phiSymbolic[t_] = 
 DSolveValue[{eqd, \[Phi][0] == 0, \[Phi]'[0] == \[Omega]}, \[Phi][t],
    t] /. {R -> 5, M -> 20, m -> 1, v -> 5, \[Omega] -> 1}
FunctionDiscontinuities[phiSymbolic[t], t]
jump = Limit[phiSymbolic[t], t -> Pi/2, Direction -> "FromAbove"] - 
  Limit[phiSymbolic[t], t -> Pi/2, Direction -> "FromBelow"]
phiSymbolicCorrected[t_] = 
  phiSymbolic[t] - jump*Ceiling[(t - Pi/2)/(Pi)];
Plot[phiSymbolicCorrected[t], {t, -Pi, 50 \[Pi]}, Exclusions -> None]

Compare the corrected symbolic solution on a much larger interval with the corresponding numerical solution.

POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract