In [1]:

```
import math
# Variables:
AC = 300.
CB1 = 120. #mm
#Solution:
#Refer Fig. 5.28
#Calculating the sine of inclination of the slotted bar with the vertical
sineCAB1 = CB1/AC
#Calculating the inclination of the slotted bar with the vertical
angleCAB1 = math.sin(sineCAB1)*180/math.pi #degrees
#Calculating the angle alpha
alpha = 2*(90-angleCAB1) #degrees
#Calculating the ratio of time of cutting stroke to time of return stroke
r = (360-alpha)/alpha #Ratio of time of cutting stroke to time of return stroke
#Results:
print " The ratio of the time of cutting stroke to the time of return stroke is %.1f"%(r)
# rounding off error
```

In [5]:

```
import math
# Variables:
AC = 240.
CB1 = 120.
AP1 = 450. #mm
#Solution:
#Refer Fig. 5.29
#Calculating the math.sine of inclination of the slotted bar with the vertical
sineCAB1 = CB1/AC
#Calculating the inclination of the slotted bar with the vertical
angleCAB1 = math.sin(sineCAB1)*180/math.pi #degrees
#Calculating the angle alpha
alpha = 2*(90-angleCAB1) #degrees
#Calculating the time ratio of cutting stroke to the return stroke
r = (360-alpha)/alpha #Time ratio of cutting stroke to the return stroke
#Calculating the length of the stroke
R1R2 = 2*AP1*round(math.sin(math.pi/2-alpha/2*math.pi/180),1) #mm
#Results:
print " The time ratio of cutting stroke to the return stroke is %.f."%(r)
print " The length of the stroke R1R2 = P1P2 = %d mm."%(R1R2)
```

In [9]:

```
import math
# Variables:
#Refer Fig. 5.30 and Fig. 5.31
BC = 30.
R1R2 = 120. #mm
r = 1.7 #Time ratio of working stroke to the return stroke
#Solution:
#Calculating the angle alpha
alpha = 360/(1.7+1) #degrees
#Calculating the length of the link AC
B1C = BC
AC = B1C/math.cos(math.radians(alpha/2)) #mm
#Calculating the length of the link AP
AP1 = R1R2/(2*math.cos(math.radians(alpha/2))) #mm
AP = AP1
#Results:
print " The length of AC = %.1f mm."%(AC)
print " The length of AP = %.2f mm."%(AP)
```

In [5]:

```
import math
# Variables:
CD = 50. #mm
CA = 75. #mm
PA = 150. #mm
PR = 135. #mm
#Solution:
#Refer Fig. 5.32 and Fig. 5.33
#Calculating the cosine of angle beta
CA2 = CA
cosbeta = CD/CA2
#Calculating the angle beta
beta = 2*math.degrees(math.acos(cosbeta)) #degrees
#Calculating the ratio of time of cutting stroke to time of return stroke
r = (360-beta)/beta #Ratio of time of cutting stroke to time of return stroke
#Calculating the length of effective stroke
R1R2 = 87.5 #mm
#Results:
print " The ratio of time of cutting stroke to time of return stroke is %.3f."%(r)
print " The length of effective stroke R1R2 = %.1f mm."%(R1R2)
```