Question: Integrate solutions to numerical ODE

I am trying to integrate solutions to a set of differential equations I have obtained numerically but keep getting this error:

Error, (in solW) invalid input: subs received sol(r), which is not valid for its 1st argument

For simplicity, let's say I am interested in integrating the function W(r), which I obtain from 

sol := dsolve({eqns, ics}, numeric, abserr = 10^(-10), relerr = 10^(-10), range = ymin .. ymax)

I then use

solW := r -> subs(sol(r), W(y))

This gives me W(r) for any r in the range ymin to ymax. But I cannot do anything with this function. For example, 

int(solW(r),r=ymin..ymax) or plot(solW(r),r=ymin..ymax) give the error above. I know that I can plot the solutions using odeplot, but is there something analogous for integrating the solutions? 


Please Wait...