Consider the equation $dx/dt = f(x, m)$, where $x$ is a function of $t$, x and $m$ is a parameter.

In Mathematica notation, f[x, m] is a function of x[t] and some parameter m.

Solutions of $dx/dt = f(x, m)$ vary with $t$ with the initial value $x(0)=x0$, and with the parameter $m$. When a certain $f(x, m)$ is given, how can I make a notebook that produces graphs of the solution sets of $dx/dt = f(x, m)$ along with controls to manipulate the values of $x0$ and $m$?

Examples: $f1(x) = x(m - x),\, f2(x) = 1 + m - x^2$

I can't really conceptualize solving this type of differential equation with Mathematica, where $x$ is a function of an independent variable. I have learned to solve ODE's with DSolve, but how does this function work if the variable is also a function of another variable?


1 Answer 1


Can't you just use DSolveValue in the usual way (an example using your f1 function):

With[{expr = DSolveValue[{x'[t]==x[t](m-x[t]), x[0]==x0}, x[t], t]},
    Manipulate[Plot[expr, {t,0,1}], {{x0,1},0,10}, {{m,2},0,10}]

Solve::ifun: Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information.

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.