[npl] / trunk / NationalProblemLibrary / maCalcDB / setAlgebra19FunTransforms / scaling.pg Repository: Repository Listing bbplugincoursesdistsnplrochestersystemwww

# View of /trunk/NationalProblemLibrary/maCalcDB/setAlgebra19FunTransforms/scaling.pg

Mon Jan 16 17:17:15 2006 UTC (7 years, 4 months ago) by jj
File size: 5447 byte(s)
```Added database subject entry.
```

```    1 ## lcao tagged and PAID on 2-20-2004
2
3 ## DBsubject('Algebra')
4 ## DBchapter('Functions')
5 ## DBsection('Transformations of Functions')
6 ## Date('6/3/2002')
7 ## Author('')
8 ## Institution('')
9 ## TitleText1('College Algebra')
10 ## EditionText1('3')
11 ## AuthorText1('Stewart, Redlin, Watson')
12 ## Section1('4.5')
13 ## Problem1('46')
14 DOCUMENT();        # This should be the first executable line in the problem.
15
17 "PG.pl",
18 "PGbasicmacros.pl",
19 "PGchoicemacros.pl",
21 "PGgraphmacros.pl",
22 "PGauxiliaryFunctions.pl"
23 );
24
25 TEXT(&beginproblem);
27
28 \$a=random(2,6);
29 \$dom = random(2,4);
30 @slice = NchooseK(3,3);
31 \$color = "red";
32
33 \$ga = FEQ("\${a}*(x*(\${dom} - x))*4/(\${dom})**2 for x in [0,\$dom] using color:red and weight:2");
34 \$gb = FEQ("\${a}*(-x * (\${dom} + x))*4/(\${dom})**2 for x in [-\$dom,0] using color:red and weight:2");
35
36 \$graph = init_graph(-8,-8,8,8,'axes'=>[0,0],'grid'=>[16,16]);
37
38 (\$gaRef,\$gbRef) = plot_functions( \$graph,\$ga,\$gb);
39
40 \$graph[0]=init_graph(-8,-8,8,8,'axes'=>[0,0],'grid'=>[16,16]);
41 \$graph[1]=init_graph(-8,-8,8,8,'axes'=>[0,0],'grid'=>[16,16]);
42 \$graph[2]=init_graph(-8,-8,8,8,'axes'=>[0,0],'grid'=>[16,16]);
43 \$graph[3]=init_graph(-8,-8,8,8,'axes'=>[0,0],'grid'=>[16,16]);
44 \$graph[4]=init_graph(-8,-8,8,8,'axes'=>[0,0],'grid'=>[16,16]);
45 \$graph[5]=init_graph(-8,-8,8,8,'axes'=>[0,0],'grid'=>[16,16]);
46 \$graph[6]=init_graph(-8,-8,8,8,'axes'=>[0,0],'grid'=>[16,16]);
47 \$graph[7]=init_graph(-8,-8,8,8,'axes'=>[0,0],'grid'=>[16,16]);
48
49 \$d2l  = \$dom - 2;
50 \$dn2l =-\$dom - 2;
51 \$d2r  = \$dom + 2;
52 \$dn2r =-\$dom + 2;
53
54 #This is g(x+2)+2
55 \$ga1 = FEQ("2+\${a}*((x+2)*(\${dom}-x-2))*4/(\${dom})**2 for x in [-2,\$d2l] using color:red and weight:2");
56 \$gb1 = FEQ("2+\${a}*(-(x+2)*(\${dom}+x+2))*4/(\${dom})**2 for x in [\$dn2l,-2] using color:red and weight:2");
57 (\$gaRef1,\$gbRef1) = plot_functions( \$graph[0],\$ga1,\$gb1);
58
59 #This is g(x+2)-2
60 \$ga2 = FEQ("-2+\${a}*((x+2)*(\${dom}-x-2))*4/(\${dom})**2 for x in [-2,\$d2l] using color:red and weight:2");
61 \$gb2 = FEQ("-2+\${a}*(-(x+2)*(\${dom}+x+2))*4/(\${dom})**2 for x in [\$dn2l,-2] using color:red and weight:2");
62 (\$gaRef2,\$gbRef2) = plot_functions( \$graph[1],\$ga2,\$gb2);
63
64 #This is g(x-2)-2
65 \$ga3 = FEQ("-2+\${a}*((x-2)*(\${dom}-x+2))*4/(\${dom})**2 for x in [2,\$d2r] using color:red and weight:2");
66 \$gb3 = FEQ("-2+\${a}*(-(x-2)*(\${dom}+x-2))*4/(\${dom})**2 for x in [\$dn2r,2] using color:red and weight:2");
67 (\$gaRef3,\$gbRef3) = plot_functions( \$graph[2],\$ga3,\$gb3);
68
69 #This is g(x-2)+2
70 \$ga4 = FEQ("2+\${a}*((x-2)*(\${dom}-x+2))*4/(\${dom})**2 for x in [2,\$d2r] using color:red and weight:2");
71 \$gb4 = FEQ("2+\${a}*(-(x-2)*(\${dom}+x-2))*4/(\${dom})**2 for x in [\$dn2r,2] using color:red and weight:2");
72 (\$gaRef4,\$gbRef4) = plot_functions( \$graph[3],\$ga4,\$gb4);
73
74 \$dd2  = \$dom / 2;
75 \$dnd2 =-\$dom / 2;
76
77 #This is g(2x)
78 \$ga5 = FEQ("\${a}*(2*x*(\${dom}-2*x))*4/(\${dom})**2 for x in [0,\$dd2] using color:red and weight:2");
79 \$gb5 = FEQ("\${a}*(-2*x*(\${dom}+2*x))*4/(\${dom})**2 for x in [\$dnd2,0] using color:red and weight:2");
80 (\$gaRef5,\$gbRef5) = plot_functions( \$graph[4],\$ga5,\$gb5);
81
82 \$dt2  = \$dom * 2;
83 \$dnt2 =-\$dom * 2;
84
85 #This is g(x/2)
86 \$ga6 = FEQ("\${a}*x*(\${dom}-x/2)*4/(2*(\${dom})**2) for x in [0,\$dt2] using color:red and weight:2");
87 \$gb6 = FEQ("\${a}*(-x*(\${dom}+x/2))*4/(2*(\${dom})**2) for x in [\$dnt2,0] using color:red and weight:2");
88 (\$gaRef6,\$gbRef6) = plot_functions( \$graph[5],\$ga6,\$gb6);
89
90 #This is 2 + g(-x)
91 \$ga7 = FEQ("2+\${a}*x*(\${dom}-x)*4/(\$dom)**2 for x in [0,\$dom] using color:red and weight:2");
92 \$gb7 = FEQ("2+\${a}*(-x*(\${dom}+x))*4/(\$dom)**2 for x in [-\$dom,0] using color:red and weight:2");
93 (\$gaRef7,\$gbRef7) = plot_functions( \$graph[6],\$ga7,\$gb7);
94
95 #This is 2 - g(x)
96 \$ga8 = FEQ("2-\${a}*x*(\${dom}-x)*4/(\${dom})**2 for x in [0,\$dom] using color:red and weight:2");
97 \$gb8 = FEQ("2-\${a}*(-x*(\${dom}+x))*4/(\${dom})**2 for x in [-\$dom,0] using color:red and weight:2");
98 (\$gaRef8,\$gbRef8) = plot_functions( \$graph[7],\$ga8,\$gb8);
99
100 BEGIN_TEXT
101 Let g be the function below.\$BR
102 \{ image(insertGraph(\$graph), width=>200, height=>200) \}
103 \$BR
104 The domain of \( g(x) \) is of the form \( [a, b] \), where \( a \) is
105 \{ans_rule(4)\} and \( b \) is \{ans_rule(4)\}.
106 \$BR
107 The range of \( g(x) \) is of the form \( [c, d] \), where \( c \)
108  is \{ans_rule(4)\} and \( d \) is \{ans_rule(4)\}.
109 \$BR
110 \$BR
111 END_TEXT
112
113 ANS(num_cmp(-\$dom), num_cmp(\$dom), num_cmp(0), num_cmp(\$a));
114
115 BEGIN_TEXT
116 Enter the letter of the graph which corresponds to each new function defined below:
117 \$BR
118 \$BR
119 1.    \( g(x-2)+2 \)   is \{ans_rule(4)\}.\$BR
120 2.    \( g(2x) \)   is \{ans_rule(4)\}.\$BR
121 3.    \( 2+g(-x) \)   is \{ans_rule(4)\}.\$BR
122 4.    \( g(x+2)-2 \)   is \{ans_rule(4)\}.\$BR
123 \$BR
124 END_TEXT
125
126 @shuffle = NchooseK(8,8);
127 @unshuffle = invert(@shuffle);
129
130 TEXT(
131 begintable(4),
132 row( image( insertGraph(\$graph[\$shuffle[0]]), tex_size => 200),
133      image( insertGraph(\$graph[\$shuffle[1]]), tex_size => 200) ,
134      image( insertGraph(\$graph[\$shuffle[2]]), tex_size => 200),
135      image( insertGraph(\$graph[\$shuffle[3]]), tex_size => 200)
136               ),
137 row( 'A','B','C','D'),
138 row( image( insertGraph(\$graph[\$shuffle[4]]), tex_size => 200),
139      image( insertGraph(\$graph[\$shuffle[5]]), tex_size => 200) ,
140      image( insertGraph(\$graph[\$shuffle[6]]), tex_size => 200),
141      image( insertGraph(\$graph[\$shuffle[7]]), tex_size => 200)
142               ),
143 row('E','F','G','H'),
144 endtable()
145 );
146
147
148 &ANS( str_cmp([ @ALPHABET[@unshuffle[3,4,6,1]] ] ) );
149
150 ENDDOCUMENT();        # This should be the last executable line in the problem.
```