t = var('t')    # define a variable t
L,R,I_0 = var('L R I_0')
I = function('I',t)   # define I to be a function of that variable
# L, R, I_0 are constants
DE = L*diff(I,t) + R*I == 0
print 'Differential Equation:'
show(DE)
soln = desolve(DE, [I,t])
print 'Solution:'
show(soln)

c = solve(soln.subs(t=0)==I_0, soln.variables()[2])
show(c)

print 'Explicit solution:'
soln.subs(c=c[0].rhs())

SageDays/Kreyszig-1.3-19 (last edited 2010-08-09 14:05:46 by PankajPandey)