

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Examples of creating contour plots using maple, explaining the basic syntax and discussing various optional arguments such as number of contours, contour values, color, and scaling. It also includes code snippets for creating contour plots with different options.
Typology: Study notes
1 / 2
This page cannot be seen from the preview
Don't miss anything!
Math 113
This Maple session gives some examples of creating contour plots.
First, load the "plots" library: > with(plots):
Define an expression to hold f(x,y). We'll do a contour plot for f(x,y) = x^2+2*y^2.
> f := x^2 + 2y^2;*
f := x^2 + 2 y^2
The contourplot command creates a contour plot. The first argument is the function; the second and third arguments are the x and y ranges, respectively.
> contourplot(f,x=-1..1,y=-1..1);
After the first three arguments, you can include many optional arguments. The following are just a small sample.
You can specify the exact number of contours to draw with "contours=N" (replace N with the number). The default is 8.
OR, you can specify the actual contour values to be used to create the contour lines with "contours=[z1,z2,...,zn]". For example, the option contours=[0,0.5,1,1.5,2,2.5] would create a contour plot with the six given contour values.
You can change the color of the contour lines; for example, "color=green".
You can force the plot to use the same scaling on the x and y axes (so a circle really looks like a circle) with "scaling=constrained".
If the curves in the contour plot look jagged, you can increase the resolution with the option "grid=[Nx,Ny]", where you replace Nx and Ny with integers that give the x and y resolutions. The default is [25,25].
Here are some examples that use these options: > contourplot(f,x=-1..1,y=-1..1,contours=21,color=blue,scaling=const rained);
> g := x^2-y^2+y^3;
g := x^2 − y^2 + y^3 > contourplot(g,x=-1..1,y=-1..1,contours=[-0.4,-0.2,0,0.2,0.4],grid= [41,41],scaling=constrained);