Difference between revisions of "SurfaceGraph1"
(Created page with '<h2>Graphing a Parametric Surface in 3D</h2> 300px|thumb|right|Click to enlarge <p style="background-color:#f9f9f9;border:black solid 1px;padding:3px;…') |
Paultpearson (talk | contribs) m |
||
Line 172: | Line 172: | ||
[[Category:Top]] |
[[Category:Top]] |
||
− | [[Category: |
+ | [[Category:Sample Problems]] |
+ | [[Category:Subject Area Templates]] |
Revision as of 15:49, 3 January 2012
Graphing a Parametric Surface in 3D
This PG code shows how to make an interactive graph of a parametric surface that is displayed using the LiveGraphics3D Java applet.
- Download file: File:SurfaceGraph1.txt (change the file extension from txt to pg when you save it)
- File location in NPL:
FortLewis/Authoring/Templates/Parametric/SurfaceGraph1/SurfaceGraph1.pg
PG problem file | Explanation |
---|---|
Problem tagging: |
|
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "LiveGraphicsParametricSurface3D.pl", ); TEXT(beginproblem()); |
Initialization:
We need to include the macros file |
Context("Numeric"); Context()->variables->are(x=>"Real",y=>"Real",z=>"Real",u=>"Real",v=>"Real"); $plot = ParametricSurface3D( Fx => Formula("3*cos(u)*sin(v)"), Fy => Formula("3*sin(u)*sin(v)"), Fz => Formula("3*cos(v)"), uvar => 'u', # theta vvar => 'v', # phi umin => 0, umax => 2*pi, vmin => 0, vmax => pi, usamples => 15, vsamples => 15, axesframed => 1, xaxislabel => "X", yaxislabel => "Y", zaxislabel => "Z", mesh => 0, outputtype => 4, ); |
Setup: |
Context()->texStrings; BEGIN_TEXT \{ Live3Ddata( $plot, image => "sphere.png", size => [400,400], tex_size => 600, tex_center => 1, scale => 1.1, ); \} END_TEXT Context()->normalStrings; |
Main Text:
We generate a string of plot data using
Setting |
$showPartialCorrectAnswers = 1; |
Answer Evaluation: |
Context()->texStrings; BEGIN_SOLUTION ${PAR}SOLUTION:${PAR} Solution explanation goes here. END_SOLUTION Context()->normalStrings; COMMENT('MathObject version.'); ENDDOCUMENT(); |
Solution: |