t = var('t')
x = function('x',t)
DE = diff(x, t, 2)*diff(x,t) -1
m, n = desolve(DE, [x,t])
#print m
#print n

#only taking m as one of the solutions, we will calculate the constants k1 and k2, using initial conditions. 'a' is the conditions where x=0 at t=0
a = m.subs(t=0)
#print a
b = diff(m, t).subs(t=0)
#print b
k1 = var('k1')
b = function('b',k1)
k1 = solve(b==2,k1)
#print k1
a.subs(k1=2)
k2 = var('k2')
a = function('a',k2)
k2 = solve(a==2,k2)
print k2
x = m.subs(k1=2,k2=2,t=6)
v = diff(m,t).subs(k1 =2, k2=2, t=6)
print x
print v
#distance = 58/3m and velocity = 4m/s and the negative sign is just because of the direction.
#k1 = k2 = 2 are the constants

SageDays/Kreyszig-2.1-13 (last edited 2010-08-10 11:30:50 by zubinmehta)