Implicit Plots and Implicit Differentiation In this example, we demonstrate how to use Python to plot implicit curves and find slopes using implicit differentiation. We will plot the graph of the equation x^3 + y^3 = 3xy and find the equation of the tangent line at the point (2/3, 4/3). After loading the symbolic package, we define x and y as variables using the symbols command. Next, we will move everything to one side of the equation and define the resulting expression as a variable eqn. Now we execute the command matplotlib notebook so Jupyter puts the graph in the notebook. Since we have an implicit equation, the symbolic plot command will not work. Instead, there is a command plot_implicit. An online search or a look at the 151 help documentation shows us that the options are the expression to be plotted (assumed =0), a tuple for the x-domain, and a tuple for the y-range. So let’s plot this graph in the window x in [-3, 3], y in [-3,3] (NOTE that if you are not given a window, you can experiment to find an appropriate one). For the tangent line equation, we use our process of listing the steps to solve by hand, then using the appropriate Python commands to execute them: 1) Find the derivative using implicit differentiation 2) Substitute the x and y values into the derivative to find the slope. Implicit differentiation is done using the idiff command. Again, a search online or of the help documentation shows the options are the expression to be differentiated (eqn), the dependent variable (y), and the independent variable (x). Once we have the derivative (with both x and y in it), we substitute using the subs command. Multiple substitutions can be made using the dictionary type in Python (in curly braces with colons between the values and the variables). Once we have the slope, we define an expression tanline which is just y0 + m*(x-x0). We can verify this equation by plotting it using our normal plot command as follows: first, name the original plot a variable such as peqn. Next, we use .extend at the end of the variable, and include our new plot command as an option. Finally, we use .show() to show the new plot. Notice that we have to use this method because we used two different plot commands for our equation and tangent line.