[npl] / trunk / NationalProblemLibrary / Rochester / setAlgebra16FunctionGraphs / c0s1p1 / c0s1p1.pg Repository: Repository Listing bbplugincoursesdistsnplrochestersystemwww

# View of /trunk/NationalProblemLibrary/Rochester/setAlgebra16FunctionGraphs/c0s1p1/c0s1p1.pg

Sun Mar 26 22:31:31 2006 UTC (7 years, 1 month ago) by jj
File size: 2457 byte(s)
```Initial import
```

```    1 #DESCRIPTION
2 #KEYWORDS('function', 'graph', 'linear', 'increasing/decreasing')
3 #  Goal: Identify that a line represents an increasing, decreasing or constant function
4 #  or is not the graph of a function (when the line is vertical).
5 #  Contains an introduction explaining the importance of linear (affine) functions.
6 #ENDDESCRIPTION
7
8 DOCUMENT();        # This should be the first executable line in the problem.
9
11            "PGbasicmacros.pl",
12            "PGchoicemacros.pl",
14 "PGauxiliaryFunctions.pl");
15
16 \$pictSet=&random(1,3,1);  #there are three sets of graphs
17
18 \$pictNum=&random(1,4,1);  #each set has 4 graphs the numbers are below
19
20 @pictID = (
21 "1-55141.gif",
22 "1-79226.gif",
23 "1-75352.gif",
24 "1-65474.gif",
25 "2-96187.gif",
26 "2-11287.gif",
27 "2-68382.gif",
28 "2-63428.gif",
29 "3-44144.gif",
30 "3-69221.gif",
31 "3-18387.gif",
32 "3-55459.gif"
33 );
34
35 sub pictIndex{    # this gives offsets into @pictID -- I was too laxy to do multidimensional arrays
36   my (\$i,\$j)=@_;
37   return((\$i-1)*4+\$j-1 )
38   }
39
40 @question = ();
42
43 TEXT(beginproblem(),
44  qq!The simplest functions are the linear (or affine) functions ---
45   the functions whose graphs are
46  a straight line. They are important because many functions (the so-called
47  differentiable functions) \${LQ}locally\$RQ look like straight lines.
48   (\${LQ}locally\$RQ means that
49  if we zoom in and look at the function at very powerful magnification
50  it will look like a straight line.)  \$PAR
51  !,
52  "Enter the letter of the graph of the function which corresponds to
53    each statement. \$BR"
54  );
55
57 "The graph of the line is increasing",
58 @pictID[&pictIndex(\$pictSet,1)],
59 "The graph of the line is decreasing",
60 @pictID[&pictIndex(\$pictSet,2)],
61 "The graph of the line is constant",
62 @pictID[&pictIndex(\$pictSet,3)],
63 "The graph of the line is not the graph of a function",
64 @pictID[&pictIndex(\$pictSet,4)],
65 );
66
67 @slice = 0..3;              # select an ordered subset of the questions and answers
68 @shuffle = &shuffle(scalar(@slice));    # create a permutation of the right length
69 @images =  @answer[@slice[@shuffle]];   # create a permuted list of the answers
70 @captions =@ALPHABET[0..3];             # the caption letters are always in order
71
72 TEXT(
73 &match_questions_list(@question[@slice]),
74 &imageRow(~~@images,~~@captions)
75 );
76 @ans = @ALPHABET[&invert(@shuffle ) ];
77 ANS(str_cmp(  [ @ans ] ) );
78
79 ENDDOCUMENT();        # This should be the last executable line in the problem.
```