# How to solve an implicit differential equation numerically?

I tried Mathematica for this, but didn't see how to do it. Is it possible to solve an equation of the following kind?

diff(R(t),t) == C1*(C2 - C3*1/R(t))*(1/R(t) + 1/sqrt(C4*t))


where t is a variable, R(t) is a function of t and C1 to C4 are constants

Any help would be appreciated.

edit retag close merge delete

Sort by » oldest newest most voted

One way to approach this differential equation numerically is:

var('r,t')
c1=0.2
c2=10
c3=5
c4=4
g(r,t)=c1*(c2-c3/r)*(1/r+1/sqrt(c4*t))
f=[SR(1),g(r,t)]
soln1=desolve_odeint(f,[1,1],srange(0,10,0.05),[t,r])
p=line(soln1)
p+=plot_vector_field([1/sqrt(1+g(t,r)^2),g(t,r)/sqrt(1+g(t,r)^2)],(t,0,10),(r,0,10))
show(p)


From a local installation of Sage, you can also use maxima to launch a window that contains the direction field and allows you to click in the window to indicate your initial condition.

maxima('plotdf([1,.2*(10-5/r)*(1/r+1/sqrt(4*t))],[t,r],[t,0,10],[r,0,10])')


Finally, for an option outside of Sage that is very nice, I also recommend using pplane and dfieldat: http://math.rice.edu/~dfield/dfpp.html

more

Great, that works! Thank you for the competent answer!