import math
#Given
#Variable declaration
sigma1=100 #Major principal stress in N/sq.mm
sigma2=-60 #Minor principal stress in N/sq.mm
theta=90-50 #Angle of inclination in degrees
#Calculation
sigman=round(((sigma1+sigma2)/2)+(((sigma1-sigma2)/2)*math.cos(math.radians(2*theta))),2)
sigmat=round((sigma1-sigma2)/2*(math.sin(math.radians(2*theta))),3)
sigmaR=round(math.sqrt(sigman**2+sigmat**2),3)
sigmat_max=int((sigma1-sigma2)/2)
#Result
print "Normal stress =",sigman,"N/mm^2"
print "Shear stress =",sigmat,"N/mm^2"
print "Resultant stress =",sigmaR,"N/mm^2"
print "Maximum shear stress =",sigmat_max,"N/mm^2"
import math
#Given
#Variable declaration
sigma1=100 #Major principal stress in N/sq.mm
sigma2=-40 #Minor principal stress in N/sq.mm
theta=90-60 #Angle of inclination in degrees
#Calculation
sigman=((sigma1+sigma2)/2)+(((sigma1-sigma2)/2)*math.cos(math.radians(2*theta)))
sigmat=round((sigma1-sigma2)/2*(math.sin(math.radians(2*theta))),2)
sigmaR=round(math.sqrt(sigman**2+sigmat**2),1)
sigmat_max=int((sigma1-sigma2)/2)
phi=int(math.degrees(math.atan(sigmat/sigman)))
#Result
print "Resultant stress in magnitude =",sigmaR,"N/mm^2"
print "Direction of resultant stress =",phi,"degrees"
print "Maximum shear stress =",sigmat_max,"N/mm^2"
import math
#Given
#Variable declaration
sigma1=120 #Major tensile stress in N/sq.mm
sigma2=-90 #Minor compressive stress in N/sq.mm
sigma_gp=150 #Greatest principal stress in N/sq.mm
#Calculation
#case(a):Magnitude of the shearing stresses on the two planes
tau=round(math.sqrt(((sigma_gp-((sigma1+sigma2)/2))**2)-(((sigma1-sigma2)/2)**2)),3)
#case(b):Maximum shear stress at the point
sigmat_max=int((math.sqrt((sigma1-sigma2)**2+(4*tau**2)))/2)
#Result
print "Shear stress on the two planes =",tau,"N/mm^2"
print "Maximum shear stress at the point =",sigmat_max,"N/mm^2"
import math
#Given
#Variable declaration
sigma1=600 #Major tensile stress in N/sq.mm
sigma2=300 #Minor tensile stress in N/sq.mm
tau=450 #Shear stress in N/sq.mm
theta1=45 #Angle of inclination in degrees
theta2=135 #Angle of inclination in degrees
#Calculation
sigman1=int(((sigma1+sigma2)/2)+(((sigma1-sigma2)/2)*math.cos(math.radians(2*theta1)))+(tau*math.sin(math.radians(2*theta1))))
sigman2=int(((sigma1+sigma2)/2)+(((sigma1-sigma2)/2)*math.cos(math.radians(2*theta2)))+(tau*math.sin(math.radians(2*theta2))))
sigmat1=int(round((sigma1-sigma2)/2*(math.sin(math.radians(2*theta1)))-(tau*math.cos(math.radians(2*theta1))),0))
sigmat2=int(round((sigma1-sigma2)/2*(math.sin(math.radians(2*theta2)))-(tau*math.cos(math.radians(2*theta2))),0))
#Result
print "Normal stress(when theta is 45 degrees)=",sigman1,"N/mm^2"
print "Normal stress(when theta is 135 degrees)=",sigman2,"N/mm^2"
print "Tangential stress(when theta is 45 degrees)=",sigmat1,"N/mm^2"
print "Tangential stress(when theta is 135 degrees)=",sigmat2,"N/mm^2"