phi is in radians
In [67]:
from sage.all import *
In [68]:
v_n, v, m, phi, mu, r, k = var('v_n v m phi mu r k')
In [69]:
g = 9.81
d_phi = .001
In [70]:
def wt(m, g, phi):
w = m*g*cos(phi)
return w
In [71]:
def wn(m, g, phi):
w = m*g*sin(phi)
return w
In [72]:
def B(phi):
"""phi in radians"""
b = arctan( (2+4*cos(phi))/(4*sin(phi)) ) - ( (pi/2) - phi)
return b
In [73]:
def Fsn(k, phi, B):
F = k * ( sqrt(20+16*cos(phi)) - sqrt(20))*cos(B(phi))
return F
In [74]:
def Fst(k, phi, B):
F = k * ( sqrt(20+16*cos(phi)) - sqrt(20))*sin(B(phi))
return F
In [75]:
def frict_fun(m,v,r,wn,Fsn,g):
fn = ((m*v**2)/r)+wn(m, g, phi)+Fsn(k, phi, B)
return fn
In [76]:
def topOfFunction(wt, mu, frict_fun, Fst, m, g, phi, v, r, wn, Fsn, k, B):
top = wt(m,g,phi) - mu*fric_fun(m,v,r,wn,Fsn,g)-Fst(k,phi,B)
return top
In [110]:
v_fun = v == sqrt(v_n**2 - 2* (topOfFunction(wt,mu,frict_fun,Fst,m,g,phi,v,r,wn,Fsn,k,B)/m)*r*d_phi)
assume(v!=0)
solvedFv = v_fun.solve(v)
In [102]:
print solvedFv
solved Fv is the instatanos velocity in terms of phi and the velocity instataneously before it
In [103]:
type(solvedFv)
Out[103]:
In [104]:
solvedF = solvedFv[0]
In [105]:
type(solvedF)
Out[105]:
In [106]:
solvedF.arguments()
Out[106]:
In [107]:
solvedF2 = solvedF.subs(k=20,m=15,mu=.25,r=4,v_n=3)
In [108]:
solvedF2.arguments()
Out[108]:
In [109]:
print solvedF2.subs(phi=pi/2)
In [109]:
In [109]:
In [ ]: