Question
from sympy import symbols, solve, pprint, roots import matplotlib.pyplot as p class Mohr(): def __init__(self,s_x,s_y,s_z,t_xy,t_yz,t_zx): self.sigma = symbols('u03c3') a=self.sigma b=self.sigma*a c=self.sigma*b self.eqn=c-(s_x+s_y+s_z)*b+(s_x*s_y+s_x*s_z+s_y*s_z-t_xy*t_xy-t_yz-t_zx*t_zx)*a-(s_x*s_y*s_z+2*t_xy*t_yz*t_zx-s_x*t_yz*t_yz-s_y*t_zx*t_zx-s_z*t_xy*t_xy) pprint(self.eqn) def find_normal(self):
from sympy import symbols, solve, pprint, roots import matplotlib.pyplot as p
class Mohr(): def __init__(self,s_x,s_y,s_z,t_xy,t_yz,t_zx): self.sigma = symbols('\u03c3') a=self.sigma b=self.sigma*a c=self.sigma*b self.eqn=c-(s_x+s_y+s_z)*b+(s_x*s_y+s_x*s_z+s_y*s_z-t_xy*t_xy-t_yz-t_zx*t_zx)*a-(s_x*s_y*s_z+2*t_xy*t_yz*t_zx-s_x*t_yz*t_yz-s_y*t_zx*t_zx-s_z*t_xy*t_xy) pprint(self.eqn) def find_normal(self): self.x=roots(self.eqn,self.sigma) self.s_n=[] for s in self.x: for i in range(0,self.x[s]): self.s_n.append(s) self.s_n.sort() def circle_parms(self): self.hkR=[((self.s_n[2]+self.s_n[1])/2,0,(self.s_n[2]-self.s_n[1])/2),((self.s_n[1]+self.s_n[0]/2,0(self.s_n[1]-self.s_n[0])/2),((self.s_n[0]+self.s_n[2])/2,0,self.s_n[0]-self.s_n[2])/2)] # pprint(self.hkR) def draw_circle(self): axes=p.subplot() maxrange=0 minrange=0 for (x,y,z) in self.hkR: cc = p.Circle((x,y),z,fill=False) axes.add_artist(cc) a-x+z b=x-z c=y+z d=y-z maxrange=max(maxrange,a,b,c,d) minrange=min(minrange,a,b,c,d) p.xlim([float(minrange),float(maxrange)]) p.ylim([float(minrange),float(maxrange)]) p.grid() axes.set_aspect(1.0) p.show()
def main(): s=Mohr(1.0,0.0,0.0,0.0,0.0,0.0) s.find_normal() s.circle_parms() s.draw_circle() if __name__ == "__main__": main()
The error code " 'Mohr' object has no attribute 'find_normal'" appears. Please help
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started