[Go to the Notes on Diffy Qs home page]

Notes on Diffy Qs - Sage demos for section 1.8

Press the Evaluate button below to launch the Sage demonstration. You may have to wait a little before the graph appears. Be patient. To change the function, you should edit the code and press the Evaluate button again.

Plotting level sets of a function / implicit solutions to exact equations

Here we show how to plot several sets of the form \(F(x,y)=C\) for various constants \(C.\) That is, if you get a potential function after solving an exact equation, its level sets are the different implicit solutions. In this first example we plot the level sets of \(F(x,y)=x^2+xy-y .\) Feel free to change the function. You can also change other parameters you can change like the ranges of \(x\) and \(y,\) the number of contours to plot with the "contours" parameter, it is 20 by default.

You can also set explicit contours to plot with the "contours" parameter. Here we set to plot contours for the four values \(C=-5,0,5,10.\)

For the "cmap" parameter, you can try different colormaps. To see all possibilities, you can add "print(sorted(colormaps))" on a separate line. Good choices to me seem 'brg', 'terrain', 'hsv', 'gnuplot2', 'jet', 'winter', or 'Spectral'.

Valid HTML 5 Valid CSS!