m325diffeq

799 days ago by jozefl

The function desolve solves 1st-order odes. First we declare our variables. Then we specify that x is a function of t:

x=function('x',t),

then we define our differential equation. Note that dx/dt is coded as diff(x,t).

The form for 'desolve' is:

desolve(diff. eq., [dep. var, indep. var.])

var('a,b,c,t,x') x=function('x',t) diffeq=a*diff(x,t)+b*x-c eq=desolve(diffeq,[x,t]) eq