SharedPractice D CH 4.ipynbOpen in CoCalc
Jupyter notebook Practice D CH 4.ipynb
import numpy
#importing math

#fn = ("Normal Force")
#Fk = ("Kinetic Force")j
#g = ("Gravity")
#ukA = ("Coefficient of Kinetic Friction")
#usA = ("Coefficient of Static Friction")
#FfA = ("Frictional Force")
#FSMAX = ("Force of static friction maximum value.")
#usequation = ()
#ukequation = (fk/fn)
def dsin(degrees):
    return (numpy.sin(numpy.radians(degrees)))
def dcos(degrees):
    return (numpy.cos(numpy.radians(degrees)))
def dtan(degrees):
    return (numpy.tan(numpy.radians(degrees)))
#now I can perform trig functions very easily
bob = input("Do you want to find acceleration or uk? Acceleration is 1, Uk is 2, uk with newtons is 3, and acceleration up is 4.")
#what are we solving for?
if bob == 1:
    force1 = input("What is the newtons given?")
    ang = input("What is the angle given?")
    mass = input("What is the mass given?")
    uk = input("What is the uk given?")
    g = input("What is gravity?")
#what do we need to know?
    fappliedy = (force1 * (dsin(ang)))
    fappliedx = (force1 * (dcos(ang)))
    fn = (mass * g) - fappliedy
    fk = uk * fn
    acc = (fappliedx - fk * mass)
#plugging into equations
    print "The answer is %s." % (acc)
#print answer. Notice %s helps clear things up.
elif bob == 2:
    force1 = input("What is the newtons given?")
    ang = input("What is the angle given?")
    mass = input("What is the mass given?")
    acc = input("What is the acceleration given?")
    g = input("What is gravity?")
    Fgdr = (numpy.sin(ang* 3.1415/180)) * (mass * g)
    blah = (mass * acc)
    Fk = Fgdr - blah
    Fn = numpy.cos(ang)*(g * mass)
    Uk = Fk/Fn
    print "The answer is %s." % (Uk)    
elif bob == 3:
    fg = input("What is the object newtons. Include decimal.")
    ang = input("What is the angle? Include decimal.")
    fapp = input("What is the force in newtons? Include decimal.")
    acc = 0
    SFX = 0
    SFY = 0
    Fxap = fapp * dcos(ang)
    Fn = fg - fapp*dsin(ang)
    UK = Fxap / Fn
    print "The answer is %s." % (UK)
elif bob == 4:
    Uk = input("What is the Uk")
    Fa = input("What is the Force")
    m = input("What is the mass")
    Aa = input("What is the active angle")
    As = input("What is the angle of being pulled")
    g = 9.81
    Fgy = m*g*numpy.cos(Aa)
    Fgx = m*g*numpy.sin(Aa)
    Fappx = Fa*numpy.cos(As)
    Fappy = Fa*numpy.sin(As)
    Fnety = 0
    Fn = Fgy - Fappy
    Fk = Uk * Fn
    Fnetx = Fappx - Fk - Fgx
    Ax = Fnetx / m
    print "The answer is %s." % (Ax)
else:
    print "That is not an option."
Do you want to find acceleration or uk? Acceleration is 1, Uk is 2, uk with newtons is 3, and acceleration up is 4.2