Ask Your Question
0

How to solve an implicit differential equation numerically?

asked 2012-11-06 04:47:43 -0500

clenz gravatar image

updated 2012-11-06 06:30:02 -0500

calc314 gravatar image

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 flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2012-11-06 06:44:46 -0500

calc314 gravatar image

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

edit flag offensive delete link more

Comments

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

clenz gravatar imageclenz ( 2012-11-06 21:27:25 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2012-11-06 04:47:43 -0500

Seen: 523 times

Last updated: Nov 06 '12