From: Mike G. v. a. <we...@ma...> - 2008-06-25 12:36:15
|
Log Message: ----------- Adding mathobjects examples to setMAAtutorial Tags: ---- rel-2-4-patches Added Files: ----------- webwork2/courses.dist/modelCourse/templates/setMAAtutorial: hello_mo.pg standardexample_mo.pg Revision Data ------------- --- /dev/null +++ courses.dist/modelCourse/templates/setMAAtutorial/standardexample_mo.pg @@ -0,0 +1,101 @@ +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "MathObjects.pl", + "PGunion.pl", # calls in some extra macros -- in this case Title() used for formatting only. + "source.pl", + "PGcourse.pl", +); + +$showPartialCorrectAnswers = 1; + +Context("Numeric"); + +TEXT(beginproblem()); + +Title("Standard Example"); +#################################################### +# +# Set up section +# + +Context()->strings-> add(hello=>{}, goodbye=>{}); + +###################### +#Setup a question requiring a word as an answer +###################### + +$str = 'world'; #alternative strings for use in the question +#$str = "Dolly"; + +$hello = String("Hello"); # correct answer + +###################### +# Setup a question requiring a numberical answer +###################### + +$a = Real(3); +$b = Real(5); +#$a=Real(random(1,9,1)); #uncomment these lines and comment the previous ones +#$b=Real(random(2,9,1)) ; #to generate a "random" or algorithmic version of the problem + +$sum = $a + $b; # sum is automatically a Real object + +###################### +# Setup a question requiring a function or formula as an answer -- here is where +# the power of MathObjects starts to shine +###################### + +$f = Formula("x^$b"); +$fp = $f->D; # the derivative of $f. + +#################################################### +# +# Text section +# + +Context()->texStrings; +BEGIN_TEXT +Complete the sentence: $BR +\{ $hello->ans_rule \} $str; +$PAR + +Enter the sum of these two numbers: $BR + \($a + $b = \) \{$sum->ans_rule(10) \} +$PAR + +Enter the derivative of \[ $f \] $BR +\(f '(x) = \) \{ $f->ans_rule(40) \} +$PAR +END_TEXT +Context()->normalStrings; + +#################################################### +# +# Answer section +# + +ANS($hello->cmp); +ANS($sum->cmp); +ANS($fp->cmp); + + + + +#################################################### +# +# Hint section +# Hints should be used cautiously +# + + +#################################################### +# +# Solution section +#Solutions are not required but they are appreciated. +# + + +ENDDOCUMENT(); + \ No newline at end of file --- /dev/null +++ courses.dist/modelCourse/templates/setMAAtutorial/hello_mo.pg @@ -0,0 +1,69 @@ +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "MathObjects.pl", +# "source.pl", +# "PGcourse.pl", +); + +$showPartialCorrectAnswers = 1; + +Context()->strings->add(hello =>{},goodbye=>{}); # allows only these strings to be entered without + # alerting student to a mistake +$ans = String("Hello"); # generates the correct answer + +TEXT(beginproblem()); + +#################################################### +# +# Set up section +# + + +#################################################### +# +# Text section +# + +Context()->texStrings; +BEGIN_TEXT +Complete the sentence: $PAR +\{$ans->ans_rule() \} world! + +END_TEXT +Context()->normalStrings; + +#################################################### +# +# Answer section +# + +ANS($ans->cmp); + +#################################################### +# +# Solution section +# +#################################################### +# +# Hint section +# + +HINT(EV3(<<'END_HINT')); +$HINT +Try Hello or goodbye. +END_HINT + +SOLUTION(EV3(<<'END_SOLUTION')); +$SOL +Good-bye world is too pessimistic! :-) +$PAR + Solutions are not required but they are +appreciated. + +END_SOLUTION + + +ENDDOCUMENT(); + \ No newline at end of file |