0

I have an analytical approximation method for solving an ODE and want to compare this to an NDSolve solution, but the syntax is confusing me. To get the solution from NDSolve, I define the ODE as eqn and use the following command to solve for O2n;

s = NDSolve[{eqn == 0, O2n[rn] == 0, O2n[ro] == po/omega}, 
  O2n, {r, rn, ro}]

Af = Plot[{(O2n[r]) /. s}, {r, rn, ro}, PlotStyle -> {Blue}, 
  PlotLegends -> LineLegend[{"Numerical"}]]

This works fine, but the /. syntax confuses me a little - what exactly does it signify, and how can I manipulate this? Specifically, I want to subtract my analytical function p[r] from this solution over the same range (rn - ro) to see how much they differ. Ideally I'd like to be able to export this data and analyze it further - can anyone explain the syntax to me, and how I might go about comparing the twain? Thank you!

Brett Champion
  • 20,779
  • 2
  • 64
  • 121
DRG
  • 877
  • 7
  • 16

0 Answers0