Post Reply 
Contour Plots
10-06-2014, 06:44 PM (This post was last modified: 10-06-2014 06:48 PM by Han.)
Post: #1
Contour Plots
Below is a little program I wrote for creating 2D contours using the Advanced Graphing app. The user's current formulas are kept safe, and are restored after the contours are drawn. I had hoped to incorporate this into the Graph3D app, but the current implementation of startview() and how apps handle built-in applications are currently preventing this from happening.

Usage: contours("X^2+Y^2", {1,4,9,16,25,36});

The function should be in quotes, and use only capital X's and Y's. The list is a list of the z-values for which you wish to have contour lines. Please limit the list to only 10 numbers (the program does not check for this).

When exploring the contour graph, do NOT use the [View] key as it will redraw the open sentences, which at this point have already been reset back to their original definitions. You may still pan, zoom, enter in coordinates, etc. If for some strange reason (hasn't happened to me yet; knock on wood) the program does not restore your original definitions, you can restore them by simply typing: V1:=funcs(1); V2:=funcs(2); ... V0:=funcs(10); while in the Advanced Graphing app.

The built-in plotcontour() command seems to have lower resolution, and lacks colors to distinguish one contour level from another.

PHP Code:
export funcs:={"","","","","","","","","",""};

export contours(func,zvals)

  local i
local s;
local n;

  if (
type(func)<>2) OR (type(zvals)<>6then
("Warning! contours(func,zvals)
  func: string
 zvals: list of (at most 10) numbers"

startapp("Advanced Graphing");

i from 0 to n-do
iferr funcs(i+1):=expr("STRING(V"+s+")"); then end;
expr("V" ":=" STRING(func "=" zvals(i)) + ";");


i from 0 to n-do
expr("V" ":=" STRING(funcs(i+1)) + ";");


Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 

User(s) browsing this thread: 1 Guest(s)