Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Creating Contour Plots in Maple: Examples and Optional Arguments, Study notes of Advanced Calculus

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

Pre 2010

Uploaded on 08/19/2009

koofers-user-v6w
koofers-user-v6w 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Contour Plots
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 + 2*y^2;
:= f + x22y2
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.
pf2

Partial preview of the text

Download Creating Contour Plots in Maple: Examples and Optional Arguments and more Study notes Advanced Calculus in PDF only on Docsity!

Contour Plots

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);