Difference between revisions of "3DGraphsInRectangular"

From WeBWorK_wiki
Jump to navigation Jump to search
m (3 revisions: import all default namespace pages from old wiki)
(One intermediate revision by one other user not shown)
Line 78: Line 78:
 
</p>
 
</p>
 
<p>
 
<p>
Setting <code>outputtype</code> to something other than 4 will require you to read the source code of <code>LiveGraphicsVectorField3D.pl</code> and familiarize yourself with the details of the <code>LiveGraphics3D</code> java applet. For more information on how to work with the string of plot data, see Martin Kraus's [http://www.vis.uni-stuttgart.de/~kraus/LiveGraphics3D/ LiveGraphics3D homepage], and the excellent article by Jonathan Rogness and Martin Kraus [http://mathdl.maa.org/mathDL/55/?pa=content&sa=viewDocument&nodeId=1143&pf=1 Constructing Mathlets Quickly Using LiveGraphics3D].
+
Setting <code>outputtype</code> to something other than 4 will require you to read the source code of <code>LiveGraphicsRectangularPlot3D.pl</code> and familiarize yourself with the details of the <code>LiveGraphics3D</code> java applet. For more information on how to work with the string of plot data, see Martin Kraus's [http://www.vis.uni-stuttgart.de/~kraus/LiveGraphics3D/ LiveGraphics3D homepage], and the excellent article by Jonathan Rogness and Martin Kraus [http://mathdl.maa.org/mathDL/55/?pa=content&sa=viewDocument&nodeId=1143&pf=1 Constructing Mathlets Quickly Using LiveGraphics3D].
 
</p>
 
</p>
 
</td>
 
</td>

Revision as of 16:18, 14 May 2010

Interactive Graphs of Functions in Rectangular Coordinates in Three Dimensions


This PG code shows how to generate interactive graphs of functions from a MathObjects formula. It uses the Java applet LiveGraphics3D to display the interactive graph.

Problem Techniques Index

PG problem file Explanation
DOCUMENT();

loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"parserVectorUtils.pl",
"LiveGraphicsRectangularPlot3D.pl",
);

TEXT(beginproblem());

Initialization: We need to include the macros file LiveGraphicsRectangularPlot3D.pl.

Context("Numeric");

Context()->variables->are(x=>"Real",y=>"Real",r=>"Real",s=>"Real",t=>"Real");

$a = - random(-1,1,2);

$plot = RectangularPlot3DRectangularDomain(
function => Formula("t^2+$a*s^2"),
xvar => "s",
yvar => "t",
xmin => -2,
xmax =>  2,
ymin => -2,
ymax =>  2,
xsamples => 10,
ysamples => 10,
axesframed => 1,
xaxislabel => "S",
yaxislabel => "T",
zaxislabel => "Z",
outputtype => 4,
);

Setup: We generate a string of plot data using RectangularPlot3DRectangularDomain().

Setting outputtype to something other than 4 will require you to read the source code of LiveGraphicsRectangularPlot3D.pl and familiarize yourself with the details of the LiveGraphics3D java applet. For more information on how to work with the string of plot data, see Martin Kraus's LiveGraphics3D homepage, and the excellent article by Jonathan Rogness and Martin Kraus Constructing Mathlets Quickly Using LiveGraphics3D.

Context()->texStrings;
BEGIN_TEXT
\{ 
Live3Ddata(
$plot,
image => "hyperbolic-paraboloid.png", 
size => [400,400],
tex_size => 600,
tex_center => 1,
scale => 1.1,
);
\}
END_TEXT
Context()->normalStrings;

Main Text: To display the string of plot data $plot, we use the Live3Ddata() routine provided by the macro LiveGraphics3D.pl, which is loaded automatically.

After you construct the graph you like, don't forget to take a screen shot of it and make an image file such as hyperbolic-paraboloid.png that will be used in the pdf hardcopy.

$showPartialCorrectAnswers = 1;

ENDDOCUMENT();

Answer Evaluation: Nothing happening here.

Problem Techniques Index