Creating a contour plot
Download file: ContourPlot.pg
DOCUMENT(); loadMacros( 'PGstandard.pl', 'PGML.pl', 'parserPopUp.pl', 'PGtikz.pl', 'PGcourse.pl' ); $showPartialCorrectAnswers = 0;
Preamble
We will use PGtikz.pl
for constructing the graph. The macro parserPopUp.pl
is used to include the popup.
$graph = (); $graph->tikzLibraries('arrows.meta'); $graph->BEGIN_TIKZ \ {>={ [=2]}} \ % . \ [ = , = , =10 , ,use ] (-7,-7) (7,7); \foreach \ {0,...,7} { \ \ {100-\*10} \ [= !\ ! , =0.5] (0,0) [={sqrt(64-8*\ )}]; } \ [->] (-7,0) -- (7,0) [ , =3 ] {\(x\)}; \foreach \x {-6,...,-1,1,2,...,6} \ (\x,5 ) -- (\x,-5 ) [ ] {\(\x\)}; \ [->] (0,-7) -- (0,7) [ , =3 ] {\( \)}; \foreach \ {-6,...,-1,1,2,...,6} \ (5 ,\ ) -- (-5 ,\ ) [ ] {\(\ \)}; $popup = ('false', placeholder => 'Select One');
Setup
The contour plot is created with TikZ by overlaying circles with differing shades of blue. See the POD and the TikZ manual for more information.
If the colored contour plot is not desired, replace the \filldraw
line with the following:
0,0) circle [radius={sqrt(64-8*\n)}]; \draw (
BEGIN_PGML [_]{$popup}[`f(x,y) = x^2 - y^2`] >> [@ image($graph, width => 300, height => 300, tex_size => 450) @]* << END_PGML
Statement
This is the problem statement in PGML.BEGIN_PGML_SOLUTION END_PGML_SOLUTION ENDDOCUMENT();
Solution
A solution should be provided here.