# The /. syntax in numerical methods [duplicate]

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!

• Closely related: (3175), (6669), (9035) Sep 3 '13 at 16:19
• Sep 3 '13 at 16:45
• Plot prints table of values..NDSolve returns O2n[ro]->Something...check Table[O2n[r]) /. s, {r, rn, ro}]..you are replacing your dependent variable with your independent variable which you have liberty to assign. Sep 3 '13 at 16:51
• Ah cheers - ReplaceAll documentation not very illuminating coming from a MATLAB background, but that link is helpful. Thanks!
– DRG
Sep 3 '13 at 16:52
• I guess you are asking two questions, one of which is a candidate for closure (namely the ReplaceAll part)... to answer your second part (perhaps after an edit or another question), working code would be very useful. Sep 3 '13 at 17:35