Ask Your Question

Difficulty solving some second order differential equations

asked 2013-05-31 06:51:05 -0600

jesper gravatar image

updated 2013-05-31 08:48:34 -0600

tmonteil gravatar image

I have trouble finding 10% and 90% of the rise time in a second order differential equation.

I have tried to search but i have not solved my issue, so now i ask here.

I have added the code to however the link is crazy long so i put it in a short link:

The code is also on pastebin

Please help :)

Cheers J. Utoft

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2013-05-31 07:49:31 -0600

tmonteil gravatar image

updated 2013-05-31 08:11:33 -0600

Concerning your first issue, instead of the symbolic solve() approach, you can use a numerical approach using the find_root() function:

sage: find_root(diff(specificSolution,t),1e-6,5e-6)

This approach also works for your second issue:

sage: find_root(specificSolution-Vin*0.1,0,1)

Hence, you can check:

sage: Vout,t = var("Vout,t")
sage: L = 1e-3
sage: C = 1e-9
sage: Vin = 5
sage: R = 1e3
sage: Vout = function("Vout",t)
sage: equation = L*C*diff(Vout,t,2) + R*C*diff(Vout,t) + Vout == Vin
sage: specificSolution = desolve(equation,Vout,ivar=t,ics=[0,0,0])
sage: Max = find_root(diff(specificSolution,t),1e-6,5e-6)
sage: M10 = find_root(specificSolution-Vin*0.1,0,1)      
sage: M90 = find_root(specificSolution-Vin*0.9,0,1)
sage: plotMax = 2e-5
sage: plot1 = plot(specificSolution,[t,0,plotMax],rgbcolor=[0,0,0])
sage: plot1 += plot(Vin*0.1,[t,0,plotMax],rgbcolor=[0,0,1]) #10% line
sage: plot1 += plot(Vin*0.9,[t,0,plotMax],rgbcolor=[0,1,0]) #90% line
sage: plot1 += plot(specificSolution(t=Max),[t,0,plotMax],rgbcolor=[1,0,0])
sage: plot1 += line([(Max,0),(Max,6)],rgbcolor=[1,0,0])
sage: plot1 += line([(M10,0),(M10,6)],rgbcolor=[0,0,1])
sage: plot1 += line([(M90,0),(M90,6)],rgbcolor=[0,1,0])
sage: plot1

Which looks correct.

edit flag offensive delete link more


Thank you so much. I can finally get my work done :) Is there a specific reason that it does not work with symbolic operations

jesper gravatar imagejesper ( 2013-05-31 09:27:23 -0600 )edit

Well i guess it is harder to find a formula than approximation of a number.

tmonteil gravatar imagetmonteil ( 2013-05-31 10:01:50 -0600 )edit

Your Answer


Add Answer

Question Tools

1 follower


Asked: 2013-05-31 06:51:05 -0600

Seen: 298 times

Last updated: May 31 '13