I'm having some trouble solving a differential equation for both the function and its derivative. Consider the following mupad program:
eq := f'(t) + 1/f(t) = 2; dF := solve(eq, f'(t))[1]; field := numeric::ode2vectorfield({f'(t)=dF, f(0)=1}, [f(t), f'(t)]); sol := numeric::odesolve2(field);
This errors on line 3 with
Error: The specified differential equations are equivalent to a system of first-order equations in the fields '{f(t)}'. Unable to convert equations to a dynamical system in the specified fields '[f(t), D(f)(t)]'. Specify an ordering of the elements in '{f(t)}' by passing a corresponding list as second argument to 'numeric::ode2vectorfield'. This list determines the ordering of the numeric values returned by 'numeric::odesolve2'. [numeric::ode2vectorfield]
I need to obtain the solution of the ODE, as well as the derivative of the solution.
How can I do this without this error being thrown?
Best Answer