Scroll to Top

Virtual Math Learning Center

Virtual Math Learning Center Texas A&M University Virtual Math Learning Center

Implicit Plots and Implicit Differentiation in Python

Author: David Manuel

In this video, it is demonstrated how to use Python to plot an implicit curve and then find a tangent line to the  curve using implicit differentiation. The presenter then shows how to combine the original implicit plot with a normal plot of the tangent line so we can check the tangent line is correct.

Transcript 15

Problem: Plot \(x^3+y^3=3xy\) and the equation of the tangent line at \(\left(\frac{2}{3},\frac{4}{3}\right).\)

Python Code: 
from sympy import *

x,y=symbols('x y')
eqn=x**3+y**3-3*x*y

matplotlib notebook

peqn=plot_implicit(eqn,(x,-3,3),(y,-3,3))

dydx=idiff(eqn,y,x)
print('dy/dx=',dydx)
m=dydx.subs({x:2/3,y:4/3})
print('The slope of the tangent line is',m)
tanline=4/3+m*(x-2/3)
print('The equation of the tangent line is y=',tanline)

peqn.extend(plot(tanline,(x,-3,3)))
peqn.show()

Open Python Notebook File

See more videos from this section