## All python codes to be made in Jupyter scientific notebook system and generate separate cell for providing solution for each sub-question.

### computer science

##### Description

Instructions: • All python codes to be made in Jupyter scientific notebook system and generate separate cell for providing solution for each sub-question. • All commands asked to be executed in different sub-questions, should generate results in Jupyter (i.e. by using print statements generously or by generating the plots as asked for). • Assignment solution should be submitted in two files with filename “ME502_Assignment\$_Enrolment Number.ipynb” and “ME502_Assignment\$_EnrolmentNumber.html”, where \$=4 for Assignment number 4 and EnrolmentNumber should be replaced with student enrolment number. For example, student “Ankit Kumar Pandey” with Enrolment number 2019MEM1004 should submit assignment 3 solution in two files with name “ME502_Assignment4_2019MEM1004.ipynb” and ME502_Assignment4_2019MEM1004.html. *html and *.ipynb should be uploaded in the respective instance of Assignment 4 on Turnitin, as will be shared with you all. • If the file names are not as per the format given above, it will be considered not submitted and thus will lead to deduction of marks. • Use NumPy, Pandas and Matplotlib libraries for solving the assignment • For Plotting 3D imagery, use standard mpl_toolkit Q1: The general form of a three-dimensional stress field is given by a 2nd order stress tensor as ? = [ ??? ??? ??? ??? ??? ??? ??? ??? ??? ] (1) where the diagonal terms represent tensile or compressive stresses and the off-diagonal terms represent shear stresses. A stress field is given by ? = [ 10 14 25 14 7 15 25 15 16 ] × 106 . (2) Principal stresses (?1, ?2, ?3 ) are known to be the three eigen values of stress tensor ?. For any given stress tensor ?, it is essential to construct the following matrix MEL502 (Applied Numerical Methods) 1 st Semester, Session 2019-2020 Instructor: Dr. Dhiraj K. Mahajan (dhiraj.mahajan@iitrpr.ac.in) Teaching Assistant: Ms. Tushita Rohilla (tushita.rohilla@iitrpr.ac.in) Department of Mechanical Engineering, IIT Ropar [ 10 − ? 14 25 14 7 − ? 15 25 15 16 − ? ] × 106 . Such that ?1, ?2, ?3 can be solved from the equation ? 3 − ?? 2 + ??? − ??? = 0 (3) where ? = ??? + ??? + ??? ?? = ?????? + ?????? + ?????? − ??? 2 − ??? 2 − ??? 2 ??? = ????????? − ?????? 2 − ?????? 2 − ?????? 2 + 2?????????. ?,??,??? are known as first invariant, second invariant and third invariant of stress tensor. For a given stress tensor ? in Equation (2), find the three roots of Equation (3) as first principal stress (?1), second principal stress (?2) and third principal stress (?3) using any of the root finding technique you have learnt by making a its python code. An inequality of the form ?1 > ?2 > ?3 is considered to decide the first principal stress (?1), second principal stress (?2) and third principal stress (?3). This python code should ask the user to input value of 6 components ???, ???,???, ???, ??? and ??? of stress tensor, while the remaining three components can be obtained due to symmetric nature of stress tensor. [3] Q2: Write a python code or use in-build python functions to use a continuous Fourier series to approximate the wave form shown in Fig. 1.