[npl] / trunk / NationalProblemLibrary / CollegeOfIdaho / setAlgebra_02_01_IntroFunctions / 21IntAlg_17_function.pg Repository:
ViewVC logotype

Annotation of /trunk/NationalProblemLibrary/CollegeOfIdaho/setAlgebra_02_01_IntroFunctions/21IntAlg_17_function.pg

Parent Directory Parent Directory | Revision Log Revision Log


Revision 731 - (view) (download)

1 : gage 731 ##DESCRIPTION
2 :     ## Introduction to Functions
3 :     ##
4 :     ##ENDDESCRIPTION
5 :     ## DBsubject('Intermediate Algebra')
6 :     ## DBchapter('Ch 02: Functions and Linear Functions')
7 :     ## DBsection('Introduction to Functions')
8 :     ## KEYWORDS('functions')
9 :     ## TitleText1('Essentials of Intermediate Algebra')
10 :     ## EditionText1('1')
11 :     ## AuthorText1('Blitzer')
12 :     ## Section1('2.1')
13 :     ## Problem1('')
14 :     ## Author('RA Cruz')
15 :     ## Institution('The College of Idaho')
16 :     ## Date: 2007/09
17 :    
18 :     DOCUMENT(); # This should be the first executable line in the problem.
19 :    
20 :     loadMacros(
21 :     "PGstandard.pl",
22 :     "MathObjects.pl",
23 :     "contextLimitedNumeric.pl",
24 :     "contextPiecewiseFunction.pl"
25 :     );
26 :    
27 :     TEXT(beginproblem);
28 :    
29 :     ######################################
30 :     # Setup
31 :    
32 :     Context("PiecewiseFunction");
33 :    
34 :     $m1 = random(2,5,1);
35 :     $b1 = random(1,6,1);
36 :     $m2 = random(2,5,1);
37 :     $b2 = random(1,6,1);
38 :     $x = random(-4,4,1);
39 :    
40 :     $h = Formula("$m1 x + $b1 if x < $x else $m2 x - $b2 if x >= $x");
41 :    
42 :     @xnum = (random($x-5,$x-1,1),random($x+1,$x1+5,1),$x);
43 :     @slice = NchooseK(3,3);
44 :     @input = @xnum[@slice];
45 :    
46 :     ######################################
47 :     # Main text
48 :    
49 :     BEGIN_TEXT
50 :     The following function is defined by two equations. The equation in the
51 :     first row gives the output for values of \(x\) less than
52 :     $x. The equation in the second row gives the ouput for values
53 :     of \(x\) which are greater or equal to $x.
54 :    
55 :     \[ h(x) = \{$h->TeX\} \]
56 :    
57 :     Find the indicated values:
58 :     $PAR
59 :     a) \( h($input[0]) \) = \{ans_rule(15)\}
60 :     $PAR
61 :     b) \( h($input[1]) \) = \{ans_rule(15)\}
62 :     $PAR
63 :     c) \( h($input[2]) \) = \{ans_rule(15)\}
64 :     END_TEXT
65 :    
66 :     ######################################
67 :     # Answers
68 :    
69 :     Context("LimitedNumeric");
70 :     Context()->strings->add("No solution"=>{},
71 :     "Not defined"=>{},
72 :     "Does not exist"=> {},
73 :     "All real numbers"=>{});
74 :    
75 :     $ans_a = $h->eval(x=>$input[0])->inContext(Context());
76 :     ANS($ans_a->cmp);
77 :    
78 :     $ans_b = $h->eval(x=>$input[1])->inContext(Context());
79 :     ANS($ans_b->cmp);
80 :    
81 :     $ans_c = $h->eval(x=>$input[2])->inContext(Context());
82 :     ANS($ans_c->cmp);
83 :    
84 :     $showPartialCorrectAnswers = 1;
85 :    
86 :     ######################################
87 :    
88 :     ENDDOCUMENT(); # This should be the last executable line in the problem.

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9