Lab1temp 152 2 Jupyter Notebook 1 29 23 1 58 PM MATH 152 Lab 1 Sam Kinnard Calvin Jolin Haya Abusada Section 545 In from sympy import from sympy plotting import plot plot parametric In from math import sin cos a 1 54 b 3 78 print Part A sin a 2 cos a 2 b 2 1 Part A 0 06540906831323096 Question 1 1a 1b Question 2 2a http localhost 8888 notebooks Downloads Lab1temp 152 2 ipynb Page 1 of 5 In 7 from math import sin cos a 1 54 b 3 78 print Part B sin a cos a 2 b 2 1 print Therefore the equations aren t equal simplified a 1 b 2 1 identity sin 2 a cos 2 a 1 print b cant be simplified the same way as the numerator expanded sin 2 a cos 2 a 2sinacosa which simplifies to 1 sin2a 1 sin2a b 2 1 Part B 0 06943523962153744 Therefore the equations aren t equal simplified a 1 b 2 1 identity sin 2 a cos 2 a 1 b cant be simplified the same way as the numerator expanded sin 2 a cos 2 a 2sinacosa which simplifies to 1 sin2a 1 sin2a b 2 1 Lab1temp 152 2 Jupyter Notebook 1 29 23 1 58 PM In from math import pi cos x 3 pi 4 left sin x 2 right 1 cos 2 x 2 print f sin 2 x left 3f print f 1 cos 2x 2 right 3f print f They are equal so the identity is verified sin 2 x 0 500 1 cos 2x 2 0 500 They are equal so the identity is verified 2b In import matplotlib pyplot as plt import numpy as np x np arange 0 int 2 3 14159 1 left np sin x 2 right 1 np cos 2 x 2 fx left right plt xlim 0 int 2 3 14159 1 plt ylim 0 1 0 5 plt plot x fx color b print Because this is a trigonometric identity all values of f x are zero nThis is why no vertical change in the data Because this is a trigonometric identity all values of f x are z ero This is why no vertical change in the data Question 3 3a http localhost 8888 notebooks Downloads Lab1temp 152 2 ipynb Page 2 of 5 Lab1temp 152 2 Jupyter Notebook 1 29 23 1 58 PM In import matplotlib pyplot as plt import numpy as np x np linspace 5 5 100 fx x 3 2 x 2 5 x gx x plt xlim 5 5 1 plt ylim 10 5 1 plt plot x fx color b label f x plt plot x gx color r label g x plt legend loc lower right plt show f x g x 3b In import sympy as sp x sp Symbol x fx lambda x x 3 2 x 2 5 x gx lambda x x difference lambda x fx x gx x result sp integrate difference x x 3 236 1 236 print f The exact area between curves is result nand the approximate area is The exact area between curves is 14 9071198293333 and the approximate area is 15 Question 4 4a http localhost 8888 notebooks Downloads Lab1temp 152 2 ipynb Page 3 of 5 Lab1temp 152 2 Jupyter Notebook 1 29 23 1 58 PM In print Using u substituion u x 3 7 therefore du 3x 2 dx so f 5 3 u 0 5 du u symbols u f u u 1 2 x C symbols x C Igl integrate f u u 5 3 C print Igl f x 3 7 Answer Igl subs u f print After substituting u back in you get the result Answer Using u substituion u x 3 7 therefore du 3x 2 dx so f 5 3 u 0 5 du C 1 11111111111111 u 1 5 After substituting u back in you get the result C 1 111111111111 11 x 3 7 1 5 In f x 5 x 2 x 3 7 1 2 AnswerX integrate f x x AnswerX AnswerX simplify Ans AnswerX args 0 0 print The result using python to directly integrate is Ans C print This matches the inetgral calculated from part a The result using python to directly integrate is C 1 11111111111 111 x 3 7 1 5 This matches the inetgral calculated from part a In answer Ans subs x 3 Ans subs x 2 print The definite integral using the Fundamental Theorem of Calculus is The definite integral using the Fundamental Theorem of Calculus is 98 2696878888795 4b 4c 4d In definite integrate f x x 2 3 definite definite evalf val re definite print The definite integral using python is val which matches the result calculated in part c The definite integral using python is 98 2696878888795 which match es the result calculated in part c http localhost 8888 notebooks Downloads Lab1temp 152 2 ipynb Page 4 of 5 Lab1temp 152 2 Jupyter Notebook 1 29 23 1 58 PM http localhost 8888 notebooks Downloads Lab1temp 152 2 ipynb Page 5 of 5
View Full Document