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!
Table[O2n[r]) /. s, {r, rn, ro}]
..you are replacing your dependent variable with your independent variable which you have liberty to assign. $\endgroup$ReplaceAll
part)... to answer your second part (perhaps after an edit or another question), working code would be very useful. $\endgroup$