Lab4temp 151 22C Jupyter Notebook 9 21 22 7 18 PM In from sympy import from sympy plotting import plot plot parametric MATH 151 Lab 4 Question 1 In 2 from sympy import x symbols x f 2 x 1 x 2 2 derivative diff f x m derivative subs x 2 y f subs x 2 tanline y m x 2 print The equation of the tangent line is y tanline The equation of the tangent line is y 23 18 2 x 9 In 14 m2 1 m y2 f subs x 2 normline y2 m2 x 2 print The equation of the normal line is y normline The equation of the normal line is y 9 x 2 49 6 1a 1b 1c http localhost 8891 notebooks Downloads Lab4temp 151 22C ipynb Page 1 of 6 Lab4temp 151 22C Jupyter Notebook 9 21 22 7 18 PM In 20 plot f x 0 3 normline x 0 3 tanline x 0 3 ylim print The graph of f x is in blue the tangent line in green and the normal line in orange The graph of f x is in blue the tangent line in green and the no rmal line in orange Question 2 2a http localhost 8891 notebooks Downloads Lab4temp 151 22C ipynb Page 2 of 6 Lab4temp 151 22C Jupyter Notebook 9 21 22 7 18 PM In 24 from sympy import x symbols x y sin x 1 1000 sin 1000 x plot y x 2 pi 2 pi print Slope estimate at x 0 is 1 Slope estimate at x 0 is 1 2b In 26 plot y x 0 25 0 25 print Slope estimate at x 0 is 1 Slope estimate at x 0 is 1 http localhost 8891 notebooks Downloads Lab4temp 151 22C ipynb Page 3 of 6 Lab4temp 151 22C Jupyter Notebook 9 21 22 7 18 PM 2c 2d In 27 derivative diff y x slope derivative subs x 0 print The slope at x 0 is slope The slope at x 0 is 0 In 28 plot y x 0 001 0 001 print Slope estimate at x 0 is 0 Slope estimate at x 0 is 0 Question 3 3a In 31 from sympy import t symbols t V 100000 1 1 60 t 2 val1 V subs t 0 val2 V subs t 10 AROC val2 val1 10 print The average rate of change of V from 0 to 10 mins is AROC The average rate of change of V from 0 to 10 mins is 3055 5555555 5555 http localhost 8891 notebooks Downloads Lab4temp 151 22C ipynb Page 4 of 6 In 36 print There is a difference in the value for average rate of change and instantaneous rate of change because the value for average rate of change is the slope over an interval and becuase this graph is curved it would produce a different value than if the slope was calculated at one point in this interval when t 10 The value for IROC is calculated using derivatives and is more specific for that certain point Lab4temp 151 22C Jupyter Notebook 9 21 22 7 18 PM In 32 derivative diff V t print Instantaneous rate of change of V with respect to t is derivative Instantaneous rate of change of V with respect to t is 55 55555555 55556 t 3333 33333333333 In 33 IROC derivative subs t 10 print Instantaneous rate of change of V at t 10 is IROC Instantaneous rate of change of V at t 10 is 2777 77777777778 3b 3c 3d There is a difference in the value for avergae rate of change and instantaneous rate of change because the value for average rate of change is the slope over an interval and becuase this graph is c urved it would produce a different value than if the slope was cal culated at one point in this interval when t 10 The value for IROC is calculated using derivatives and is more specific for that certain point Question 4 4a In 42 from sympy import x symbols x f exp x 1 x 2 print The first derivative of y is y diff f x the second is y The first derivative of y is y 2 x exp x x 2 1 exp x the second is y x 2 4 x 3 exp x the third is y x 2 6 x 7 exp x the fourth is y x 2 8 x 13 exp x t he fifth is y x 2 10 x 21 exp x the sixth is y x 2 12 x 31 exp x the seventh is y x 2 14 x 43 exp x and the eigth is y x 2 16 x 57 exp x http localhost 8891 notebooks Downloads Lab4temp 151 22C ipynb Page 5 of 6 Lab4temp 151 22C Jupyter Notebook 9 21 22 7 18 PM 4b 4c In 2 print The formula for the nth derivative of f is exp x x 2 n 2 x n n 1 1 The formula for the nth derivative of f is exp x x 2 n 2 x n n 1 1 In 4 from sympy import x symbols x print Derivative fifty is exp x x 2 50 2 x 50 50 1 Derivative fifty is x 2 100 x 2451 exp x http localhost 8891 notebooks Downloads Lab4temp 151 22C ipynb Page 6 of 6
View Full Document