Finding Horizontal Tangent Lines in Python
Author: David Manuel
In this video, it is shown how to use Python to find any horizontal tangent lines for a function. The presenter finds the derivative of the function in Python and then has Python solve when the derivative is equal to zero. This equation is solved numerically by giving Python a starting guess for the solution, which was found from a graph of the function.
Transcript 13
Transcript 13
Exercises
Python Code:
from sympy import *
x=symbols('x')
y=(6*x**2-4*x**3)/(2*sqrt(x**3*(2-x)))
Python Code:
matplotlib notebook
plot(y,(x,0,2),ylim=[-10,10])
dy=diff(y,x).simplify()
print(dy)
horiz=nsolve(dy,x,0.75)
print('The graph has a horizontal tangent line at x=',horiz)
Open Python Notebook File
