[npl] / trunk / NationalProblemLibrary / ASU-topics / setTrigGraphs / p23.pg Repository: Repository Listing bbplugincoursesdistsnplrochestersystemwww

# View of /trunk/NationalProblemLibrary/ASU-topics/setTrigGraphs/p23.pg

Sat Jan 14 02:13:08 2006 UTC (7 years, 4 months ago) by jj
File size: 1998 byte(s)
New problems for the library.

1 ## DESCRIPTION
2 ## Geometry: Plane Geometry
3 ## ENDDESCRIPTION
4
5 ## KEYWORDS('geometry', 'plane')
6 ## Tagged by YJ
7
8 ## DBsubject('Geometry')
9 ## DBchapter('Plane Geometry')
10 ## DBsection('Trigonometric Functions')
11 ## Date('5/26/2005')
12 ## Author('Jeff Holt')
13 ## Institution('UVA')
14 ## TitleText1('Calculus')
15 ## EditionText1('5e')
16 ## AuthorText1('Stewart')
17 ## Section1('5.8.2')
18 ## Problem1(' ')
19
20 DOCUMENT();        # This should be the first executable line in the problem.
21
23 "PG.pl",
24 "PGbasicmacros.pl",
25 "PGchoicemacros.pl",
27 "PGauxiliaryFunctions.pl",
28 "PGgraphmacros.pl",
29 "PGasu.pl"
30 );
31
32 TEXT(&beginproblem);
33
34 $a=random(-4, -1); 35 36$c=random(1, 8);
37 $b=1/$c;
38 $pi=4*arctan(1); 39$xdom=3*$c; 40$ydom=abs($a)+1; 41$xgrid=2*$xdom; 42$ygrid=2*$ydom; 43$graph = init_graph(-$xdom,-$ydom,$xdom,$ydom,'axes'=>[0,0],'grid'=>[$xgrid,$ygrid]);
44 $f = FEQ("$a*cos($pi*$b*x) for x in <-$xdom,$xdom> using color:blue and weight:2");
45 ($fref) = plot_functions($graph, $f); 46$period = 2*$c; 47 48 # Label some points 49$label1 = new Label(0,$a, "$a",'black','right');
50 $d = -$a;
51 $label2 = new Label($c, $d, "($c,$d)",'black','bottom','center'); 52$label3 = new Label(0,$d,"$d",'black','top');
53 $graph->lb($label1, $label2,$label3);
54
55
56 BEGIN_TEXT
57 \{ image(insertGraph($graph)) \}$PAR
58 To get a better look at the graph, you can click on it.
59 $PAR 60 61 62 The curve above is the graph of a sinusoidal function. It goes through 63 the point $$(c,d)$$. 64 Find a sinusoidal function that matches the given graph. If needed, you can enter 65 $$\pi$$=3.1416... as 'pi' in your answer, otherwise use at least 3 decimal digits. 66$PAR
67   $$f(x) =$$ \{ans_rule(60)\}
68 END_TEXT
69
70 #
71 # Tell WeBWork how to test if answers are right.  These should come in the
72 # same order as the answer blanks above.  You tell WeBWork both the type of
75 $ans = "$a*cos($pi*$b*x)";
77 &ANS(function_cmp($ans,"x",-$xdom,\$xdom));