# example1.1 Page number 10¶

In :
#downstream direction as x
#direction across river as y

from math import sqrt,atan,pi

#variable declaration

Vx= 8                       #velocity of stream, km/hour
Vy=float(20)                       #velocity of boat,km/hour

V=sqrt(pow(Vx,2)+pow(Vy,2)) #resultant velocity, km/hour
theta=Vy/Vx

alpha= atan(theta)*180/pi   #angle, degrees

print " The resultant velocity :",round(V,2),"km/hour"
print round(alpha,2),"°"

 The resultant velocity : 21.54 km/hour
68.2 °


# example 1.2 Page number 10¶

In :
#components of force in horizontal and vertical components.
from math import cos,sin,pi
#variable declaration

F= 20                        #force in wire, KN

#calculations
Fx= F*cos(60*pi/180)
Fy= F*sin(60*pi/180)

print round(Fx,2),"KN" ,"(to the left)"
print round(Fy,2), "KN" ,"(downward)"

10.0 KN (to the left)
17.32 KN (downward)


# example 1.3 Page number 11¶

In :
 #The plane makes an angle of 20° to the horizontal. Hence the normal to the plane makes an angles of 70° to the horizontal i.e., 20° to the vertical
from math import cos,sin,pi
#variable declaration
W= 10                        # black weighing, KN

#calculations

Nor= W*cos(20*pi/180)             #Component normal to the plane
para= W*sin(20*pi/180)            #Component parallel to the plane

print "Component normal to the plane :",round(Nor,2),"KN"
print "Component parallel to the plane :",round(para,2) , "KN"

Component normal to the plane : 9.4 KN
Component parallel to the plane : 3.42 KN


# example 1.4 Page number 11¶

In :
#Let the magnitude of the smaller force be F. Hence the magnitude of the larger force is 2F

from math import pi,sqrt, acos
#variable declaration
R1=260            #resultant of two forces,N
R2=float(180)          #resultant of two forces if larger force is reversed,N

#calculations

F=sqrt((pow(R1,2)+pow(R2,2))/10)
F1=F
F2=2*F
theta=acos((pow(R1,2)-pow(F1,2)-pow(F2,2))/(2*F1*F2))*180/pi

print "F1=",F1,"N"
print  "F2=",F2,"N"
print "theta=",round(theta,1),"°"

F1= 100.0 N
F2= 200.0 N
theta= 63.9 °


# example 1.5 Page number 12¶

In :
#Let ?ABC be the triangle of forces drawn to some scale
#Two forces F1 and F2 are acting at point A
#angle in degrees '°'

from math import  sin,pi

#variabble declaration
cnv=pi/180

BAC = 20*cnv                           #Resultant R makes angle with F1

ABC = 130*cnv

ACB = 30*cnv

R =  500                            #resultant force,N

#calculations
#sinerule

F1=R*sin(ACB)/sin(ABC)
F2=R*sin(BAC)/sin(ABC)

print "F1=",round(F1,2),"N"
print "F2=",round(F2,2),"N"

F1= 326.35 N
F2= 223.24 N


# example 1.6 Page number 12¶

In :
#Let ABC  be the triangle of forces,'theta' be the angle between F1 and F2, and 'alpha' be the angle between resultant and F1

from math import sin,acos,asin,pi

#variable declaration
cnv= 180/pi
F1=float(400)                         #all forces are in newtons,'N'
F2=float(260)
R=float(520)

#calculations

theta=acos((pow(R,2)-pow(F1,2)-pow(F2,2))/(2*F1*F2))*cnv

alpha=asin(F2*sin(theta*pi/180)/R)*cnv

print"theta=",round(theta,2),"°"
print "alpha=",round(alpha,2),"°"

theta= 78.13 °
alpha= 29.29 °


# example 1.7 Page number 13¶

In :
#The force of 3000 N acts along line AB. Let AB make angle alpha with horizontal.

from math import cos,sin,pi,asin,acos

#variable declaration
F=3000                        #force in newtons,'N'
BC=80                         #length of crank BC, 'mm'
AB=200                        #length of connecting rod AB ,'mm'
theta=60*pi/180               #angle b/w BC & AC

#calculations

alpha=asin(BC*sin(theta)/200)*180/pi

HC=F*cos(alpha*pi/180)                    #Horizontal component
VC= F*sin(alpha*pi/180)                   #Vertical component

#Components along and normal to crank
#The force makes angle alpha + 60  with crank.
alpha2=alpha+60
CAC=F*cos(alpha2*pi/180)             # Component along crank
CNC= F*sin(alpha2*pi/180)             #Component normal to crank

print "horizontal component=",round(HC,1),"N"
print "Vertical component = ",round(VC,1),"N"
print "Component along crank =",round(CAC,1),"N"
print "Component normal to crank=",round(CNC,1),"N"

horizontal component= 2814.2 N
Vertical component =  1039.2 N
Component along crank = 507.1 N
Component normal to crank= 2956.8 N