from math import sqrt
import numpy as np
#variable declaration
a=[1,-1,0];
n=[1,-1,-1];
s=[0,-1,-1];
Tr=6;
#calculation
cos_fi=np.dot(a,n)/(sqrt(a[0]**2+a[1]**2+a[2]**2)*sqrt(n[0]**2+n[1]**2+n[2]**2));
cos_lm=np.dot(a,s)/(sqrt(a[0]**2+a[1]**2+a[2]**2)*sqrt(s[0]**2+s[1]**2+s[2]**2));
sigma=Tr/(cos_fi*cos_lm);
#result
print('Tensile Stress applied = %g MPa')%(sigma);