Tuesday, February 5, 2013

The many ways to plot implicit functions

There are many different ways to plot accurate and complicated implicit functions, for free and without eating up your processor.

Let's look at this implicit curve, for example:

ax^2 + bxy^3 = c  

where a, b, and c are real numbers.

In Geogebra, you can click the sliders button to create a, b, and c then type the function exactly as it appears  above in the input bar. Drag a, b, and c (or animate them if you wish by right clicking) to see the function change.

Click images to enlarge.
Create the sliders first then type the equation.

Drag the sliders to see the changes in the graph.






























We can also use http://www.desmos.com to do the same thing. Desmos has the nice feature of highlighting "points of interest" (in this case, the x-intercepts are highlighted). You can also share your graph easily by clicking the blue icon at the top right and choosing your share-tool of choice.


Click images to enlarge.
Click "all" to add sliders for each variable.
Drag the sliders to see the graph change.
Share your work in a variety of ways.
























And for just about any calculus course, we are done.  Geogebra and Desmos are great for polynomials but if you want to graph something like cos(xy) = c  where c is a constant you will need a different set of tools.

Gnuplot is a free, command line based, graphing program. It will not plot implicit functions by default.  It's possible to hack it by plotting a 3d function with level curves projected in the xy plane. Here is the code needed to plot cos(xy) = 1. The line "set cntrparam levels discrete 0" means "plot one contour line at z = 0".

set view 0,0
set isosamples 50,50
set contour base
set cntrparam levels discrete 0
unset surface 
set grid
unset key 
unset ztics
set xlabel "x"
set ylabel "y"
set xrange [-pi:pi]
set yrange [-pi:pi]
f(x,y) = cos(x*y)
splot f(x,y)


Click image to enlarge.
The output of the above code.




















There is an easier way of doing this and here is where GrafEq, a tiny, free windows program, really shines. Just type in your function and go.


Click image to enlarge.


















Here is a sampling of some of the beautiful implicit graphs you can quickly, easily, and accurately plot with this tiny little-known program.

One can also type

plot cos(x*y)=0 for x=-pi...pi, y = -pi...pi

into http://www.wolframalpha.com and obtain the following output:


Click image to enlarge.




No comments:

Post a Comment

Thank you for sharing your thoughts.