Parent Directory
|
Revision Log
A collection of problems illustrating how to use MathObjects when writing WeBWorK questions.
1 ##DESCRIPTION 2 ##KEYWORDS('exponentials', 'increase,decrease', 'concavity') 3 ##Ellis & Gulick section 6.2 #12 4 ##Authored by Zig Fiedorowicz 1/17/2000 5 ##ENDDESCRIPTION 6 7 DOCUMENT(); 8 9 loadMacros( 10 "PGstandard.pl", 11 "MathObjects.pl", 12 "PGcourse.pl", 13 # "source.pl", 14 ); 15 16 TEXT(beginproblem()); 17 $showPartialCorrectAnswers = 1; 18 19 ################### 20 # 21 # Setup 22 23 Context("Interval"); 24 25 Context()->strings->add(NA=>{},"Not Applicable"=>{alias=>'NA'}, 26 "none"=>{alias=>'NA'}); 27 28 # This adds the string "NA" as an acceptable String to be used and entered as 29 # an answer, and makes the strings "Not Applicable" and "none" act as "NA" 30 # (i.e. if "NA" is correct and the student enters "Not Applicable" - s/he 31 # will receive correct). This is useful if the student is supposed to either 32 # enter a value or potentially some string, to avoid giving the student an 33 # error message if the answer checker is expecting a number and it receives 34 # the string "NA". 35 36 $aa = random(1,10,1); 37 38 $Funct = Formula("e^x/($aa + e^x)")->reduce; 39 $Deriv = $Funct->D->reduce; 40 $Deriv2 = $Deriv->D->reduce; 41 42 $Interv1 = Interval("(-INF,INF)"); # Represents: (-∞,∞) 43 $Interv2 = String("NA"); 44 45 $Interv3 = Interval("(-INF,log($aa))"); 46 $Interv4 = Interval("(log($aa),INF)"); 47 48 $InfPt = Real("log($aa)"); 49 50 ################### 51 # 52 # Text 53 54 Context()->texStrings; 55 BEGIN_TEXT 56 Consider the function 57 \[f(x)= $Funct\] 58 $PAR 59 Then \(f'(x)\) = \{ ans_rule()\} 60 $BR 61 62 The following questions ask for endpoints of intervals of 63 increase or decrease for the function \(f(x)\). $BR Write INF 64 for \(\infty\), -INF for \(-\infty\), and NA (ie. not applicable) if 65 there are no intervals of that type. 66 $PAR 67 The interval of increase for \(f(x)\) is: \{ ans_rule()\} 68 $PAR 69 The interval of decrease for \(f(x)\) is: \{ ans_rule()\} 70 $PAR 71 \(f(x)\) has a local minimum at \{ ans_rule()\}. (Put NA if none.) 72 $BR 73 74 \(f(x)\) has a local maximum at \{ ans_rule()\}. (Put NA if none.) 75 $BR 76 77 Then \(f''(x)\) = \{ ans_rule(40)\} 78 $BR 79 80 The following questions ask for intervals of 81 upward and downward concavity for the function \(f(x)\). $BR Type INF 82 for \(\infty\), -INF for \(-\infty\), and put NA if 83 there are no intervals of that type. 84 $PAR 85 86 The interval of upward concavity for \(f(x)\) is: \{ ans_rule()\} 87 $PAR 88 The interval of downward concavity for \(f(x)\) is: \{ ans_rule()\} 89 $PAR 90 \(f(x)\) has a point of inflection at \{ ans_rule()\}. (Put NA if none.) 91 92 END_TEXT 93 Context()->normalStrings; 94 95 ################### 96 # 97 # Textbook Reference: 98 99 ##set $PG_environment{'textbook'} in webworkCourse.ph 100 if (defined($textbook)) { 101 if ($textbook eq "EllisGulick5") { 102 BEGIN_TEXT 103 $PAR 104 This is similar to problem 12 of Section 6.2 of the text. 105 END_TEXT 106 } 107 } 108 109 ################### 110 # 111 # Answers 112 113 ANS($Deriv->cmp); 114 ANS($Interv1->cmp(typeMatch=>Value::Interval, 115 showEndpointHints => 0, showEndTypeHints => 0)); 116 ANS($Interv2->cmp(typeMatch=>Value::Interval, 117 showEndpointHints => 0, showEndTypeHints => 0)); 118 # This is needed because the default for the interval answer checker is to 119 # return a response as to whether both, one or neither of your endpoints 120 # are correct, but does not do this if the answer checker is expecting a 121 # string or a union of intervals. Thus to avoid ambiguity and confusion, 122 # these messages are turned off. 123 124 ANS(String("NA")->cmp); 125 ANS(String("NA")->cmp); 126 ANS($Deriv2->cmp); 127 ANS($Interv3->cmp(typeMatch=>Value::Interval, 128 showEndpointHints => 0, showEndTypeHints => 0)); 129 ANS($Interv4->cmp(typeMatch=>Value::Interval, 130 showEndpointHints => 0, showEndTypeHints => 0)); 131 ANS($InfPt->cmp); 132 133 ENDDOCUMENT();
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |