Drat.
I have been playing around with things a little with this in mind.
The best I can get, is to define a normal python function, with the s, v and
k terms passed in as arguments, and have it return a vector of equations.
Results are italic.
var('t')
def returneqn(v_t,v_0,k,s_0):
return t*v_t + ((v_0 - v_t)/k)*(1 - e^(-k*t)) + s_0
var('v,theta')
v_0 = vector((v*cos(theta),0,v*sin(theta)))
k = 0.7
v_t = vector((0,0,-9.8/k))
s_0 = vector((0,0,0))
s = returneqn(v_t,v_0,k,s_0)
print(s[0])
*-1.42857142857143*(e^(-0.700000000000000*t) - 1)*v*cos(theta)*
print(s[1])
*0*
print(s[2])
*-(e^(-0.700000000000000*t) - 1)*(1.42857142857143*v*sin(theta)
+ 20.0000000000000) - 14.0000000000000*t*
Substitution can occur on the result:
s.subs(v == 10).subs(theta == 40*pi/180)
*(-14.2857142857143*(e^(-0.700000000000000*t) - 1)*cos(2/9*pi), *
*0,
*
*-(14.2857142857143*sin(2/9*pi)
+ 20.0000000000000)*(e^(-0.700000000000000*t) - 1) - 14.0000000000000*t)*
Not a perfect result, but a decent approach for what I want to do.
Joal Heagney
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org