I noticed that in Plot
the function is evaluated at each sample point
Plot[func@x,{x,rStart1,rEnd1}]
which is fine for a regular function. If I substitute the function with an NDSolve, the problem is that at every sample point the NDSolve is evaluated so it is time consuming.
Plot[NDSolve[(*diff equation*)][[1]]@x,{x,rStart1,rEnd1}]
I find a workaround to NDSolve only once, and pass it to the Plot[]
.
NDSolve[(*diff equation*)][[1]] //Plot[#@x, {x, rStart1, rEnd1}] &
I just wonder if there is a better way to do it, for example to Hold/Release
or some magical trick to force it only being evaluated once.