[npl] / branches / NAU / setLinearModeling / linearmodeling2_alt.pg Repository: Repository Listing bbplugincoursesdistsnplrochestersystemwww

# View of /branches/NAU/setLinearModeling/linearmodeling2_alt.pg

Sat Jun 25 00:53:16 2011 UTC (23 months ago) by nandor.sieben
File size: 2324 byte(s)
`upload`

```    1 ##DESCRIPTION
2 ## DBsubject('Algebra')
3 ## DBchapter('Functions')
4 ## DBsection('Modeling with Functions')
5 ## KEYWORDS('word problem','revenue')
6 ## Author('N.Spencer Sitton')
7 ## Institution('NAU')
8 ##ENDDESCRIPTION
9
10 # File Created: 06/20/05
11 # Location: Northern Arizona University
12 # Course:Quantitative Reasoning
13
14 DOCUMENT();
16 );
17
18 TEXT(&beginproblem);
19
20 do{\$total1 = random( 800, 1600, 100);
21   \$total2 = random( 800, 1600, 100);
22 } until( \$total1 > \$total2);
23
24 do{\$price1 = random( 2.05, 2.95, .05);
25   \$price2 = random( 2.05, 2.95, .05);
26   \$newprice = random( 2.05, 2.95, .05);
27 } until( \$price1 > \$newprice && \$newprice > \$price2 );
28
29 do{\$total3 = random( 800, 1600, 100);
30 } until( \$total1 != \$total3 || \$total2 != \$total3 );
31
32 \$slope = ( \$price2 - \$price1 ) / ( \$total1 - \$total2 );
33 \$yint = \$price2 - ( \$slope * \$total1 ) ;
34
35 \$ans1 = ( \$newprice - \$yint) / (\$slope);
36 \$ans2 = \$slope * \$total3 + \$yint;
37
38 \$rev1 = ( \$price2 ) * ( \$total1);
39 \$rev2 = ( \$price1 ) * ( \$total2);
40 \$rev3 = ( \$newprice ) * ( \$ans1 );
41 \$rev4 = ( \$ans2 ) * ( \$total3 );
42
43 \$max = max( \$rev1, \$rev2, \$rev3, \$rev4 );
44
45 if( \$max == \$rev1 ){ \$ans3 = \$price2 }
46 elsif( \$max == \$rev2 ){ \$ans3 = \$price1 }
47 elsif( \$max == \$rev3 ){ \$ans3 = \$newprice }
48 elsif( \$max == \$rev4 ){ \$ans3 = \$ans2 }
49
50 \$cval = (-\$yint)/(2*\$slope);
51
52 \$ans4 = ( \$slope * \$cval ) + \$yint;
53
54 TEXT(
55 qq!
56 A gas station sells \$total1 gallons of gasoline per hour if it charges
57 \$DOLLAR !,sprintf( "%1.2f", \$price2 ), qq! per gallon but only \$total2
58 gallons per hour if it charges \$DOLLAR !,sprintf( "%1.2f", \$price1 ), qq!
59 per gallon. Assuming a linear model
60 \$PAR
61
62 (a) How many gallons would be sold per hour of the price is \$DOLLAR
63 !,sprintf( "%1.2f", \$newprice ), qq! per gallon?\$BR Answer:!, ans_rule(10),
64 qq! \$PAR
65
66 (b) What must the gasoline price be in order to sell \$total3 gallons per hour?
67 \$BR Answer: \$DOLLAR !, ans_rule(10), qq!
68 \$PAR
69
70 (c) Compute the revenue taken at the four prices mentioned in this problem --
71 \$DOLLAR !,sprintf( "%6.2f", \$price2 ),qq!, \$DOLLAR !,sprintf( "%6.2f", \$newprice ),
72 qq!, \$DOLLAR !,sprintf( "%6.2f", \$price1 ), qq! and your answer to part (b).
73 Which price gives the most revenue? \$BR Answer: \$DOLLAR !, ans_rule(10) ,qq!
74 \$PAR
75
76 !,
77 );
78
79 ANS( num_cmp( \$ans1 ) );
80 ANS( num_cmp( \$ans2 ) );
81 ANS( num_cmp( \$ans3 ) );
82
83
84 ENDDOCUMENT();
```