WeBWorK Problems

using plot_functions in PGgraphmacros

using plot_functions in PGgraphmacros

by Kenneth Appel -
Number of replies: 1
I have been using PGgraphmacros for quite a while to do
things with lines and labels. I decided that I needed a circle,
and following Gavin LaRose's problem 3 I decided that maybe I could just plot the upper and lower semi-circles
using plot_function to get my circle. I could not find any
documentation other than the problem, so I used the monkey see - monkey do version and something went wrong. I would appreciate help in finding the error here which might cause me to actually understand what I am
doing.
Ken Appel

Error messages

syntax error at (eval 2508) line 29, near "])"

Error details

 Problem1
ERROR caught by Translator while processing problem file:probs/prob1.pg
****************
syntax error at (eval 2508) line 29, near "])"

****************

------Input Read
1 DOCUMENT();
2 loadMacros(
3 "PGstandard.pl",
4 "MathObjects.pl",
5 "PGgraphmacros.pl",
6 );
7
8 #This is the initialization section of the problem. Note that we need to include
9 #PGgraphmacros.pl to use graphs in the problem.
10
11 # make sure we're in the context we want
12 Context("Numeric");
13 $func = Compute("sqrt{1-(x-3)**2}");
14
15 $ymin= 2;
16 $ymax =4;
17
18 # the domain is
19 $xmin = 2;
20 $xmax = 4;
21 # and the number of gridlines we graph
22 $xgrid = 5;
23
24 $ygrid = 5;
25
26 # now initialize the graph
27 $graph = init_graph(0,0, 5,5),
28 axes=>[0,0], grid=>[$xgrid,$ygrid],
29 size=>[200,200]);
30
31 plot_functions( $graph, "$func for x in " .
32 "<$xmin,$xmax> using color:blue " .
33 "and weight:2");
34
35
36 TEXT(beginproblem());
37 Context()->texStrings;
38 BEGIN_TEXT
39 Consider the graph
40 $BR
41 $BCENTER
42 \{ image( insertGraph($graph), tex_size=>100,
43 height=>150, width=>150,
44 extra_html_tags=>'alt="graph of a ' .
45 'downward opening parabola with ' .
46 'x-intercepts ' . $root1 . ' and ' .
47 $root2 . ', and y-intercept ' .
48 $yint . '."' ) \}
49 $ECENTER
50
51
52 END_TEXT
53 Context()->normalStrings;
54 ENDDOCUMENT();



In reply to Kenneth Appel

Re: using plot_functions in PGgraphmacros

by Kenneth Appel -
Please ignore this question. I found the miserable extra right parenthesis on line 27
KA