I Do Not Know Why One of These Two Plots Requires the /. Replacement Operator

27 Views Asked by At

Why does the first Plot require the '/.' replacement operator, but the second Plot does not? Both use InterpolatingFunctions.

In the first block of code, 'sol' is an InterpolatingFunction. In the second block of code, iFun is an InterpolatingFunction.

I'm still new to Mathematica.

ode1 = {y''[x] + Sin[y[x]] == 0, y[0] == 2, y'[0] == 1};
sol = NDSolve[ode1, y, {x, -10, 10}]
Plot[y[x] /. sol, {x, -10, 10}]
points = {{0, 0}, {1, 1} {2, 3}, {3, 4}, {4, 3}, {5, 0}};
ifun = Interpolation[points]
Plot[ifun[x], {x, 0, 5}]

I've tried various syntactic choices without success. I believe I am missing some key conceptual piece of information about how these features work.

Thank you.

0

There are 0 best solutions below