Parent Directory
|
Revision Log
Minimal code for a client which will connect to the xmlrpc access within webwork 2 Use at your own risk :-)
1 ##DESCRIPTION 2 ## A very simple first problem 3 ##ENDDESCRIPTION 4 ##KEYWORDS('algebra') 5 DOCUMENT(); # This should be the first executable line in the problem. 6 loadMacros( 7 "PG.pl", 8 "PGbasicmacros.pl", 9 "PGchoicemacros.pl", 10 "PGanswermacros.pl", 11 "PGauxiliaryFunctions.pl" 12 ); 13 14 TEXT(&beginproblem); 15 $showPartialCorrectAnswers = 1; 16 $a = random(-10,-1,1); 17 $b = random(1,11,1); 18 $c = random(1,11,1); 19 $d = random(1,11,1); 20 21 BEGIN_TEXT 22 $PAR 23 displayMode is $displayMode $BR 24 $PAR 25 This problem demonstrates how you enter numerical answers into WeBWorK. $PAR 26 Evaluate the expression \(3($a )($b -$c -2($d ))\): 27 28 \{ ans_rule(10) \} 29 30 $BR 31 END_TEXT 32 $ans = 3*($a)*($b-$c-2*($d)); 33 34 &ANS(strict_num_cmp($ans)); 35 36 BEGIN_TEXT 37 38 In the case above you need to enter a number, since we're testing whether you can multiply 39 out these numbers. (You can use a calculator if you want.) 40 $PAR 41 For most problems, you will be able to get WeBWorK to 42 do some of the work for you. For example 43 $BR 44 Calculate ($a) * ($b): \{ ans_rule()\} 45 $BR 46 END_TEXT 47 $ans = $a*$b; 48 49 &ANS(std_num_cmp($ans)); 50 51 BEGIN_TEXT 52 The asterisk is what most computers use to denote multiplication and you can use this with WeBWorK. 53 But WeBWorK will also allow use to use a space to denote multiplication. 54 You can either \($a * $b\) or \{$a*$b\} or even \($a \ $b\). All will work. Try them. 55 $PAR 56 Now try calculating the sine of 45 degrees ( that's sine of pi over 4 in radians 57 and numerically sin(pi/4) equals \{1/sqrt(2)\} or, more precisely, \(1/\sqrt{2} \) ). 58 You can enter this as sin(pi/4) , as 59 sin(3.1415926/4), as 1/sqrt(2), as 2**(-.5), etc. This is because WeBWorK knows about 60 functions like sin and sqrt (square root). (Note: exponents 61 can be indicated by either a "caret" or **). Try it.$BR \( \sin(\pi/4) = \) \{ ans_rule(20) \}$PAR 62 Here's the 63 \{ 64 htmlLink(qq!http://webwork.math.rochester.edu/webwork_system_html/docs/docs/pglanguage/availablefunctions.html!,"list 65 of the functions") \} 66 which WeBWorK understands. WeBWorK ALWAYS uses radian mode for trig functions. 67 $PAR 68 END_TEXT 69 70 &ANS( std_num_cmp(sin(3.1415926/4)) ); 71 BEGIN_TEXT 72 You can also use juxtaposition to denote multiplication. E.g. enter \( 2\sin(3\pi/2) \). 73 You can enter this as 2*sin(3*pi/2) or more simply as 2sin(3pi/2). Try it: $BR 74 \{ ans_rule(20) \}$PAR 75 76 END_TEXT 77 78 $pi = 4*atan(1); 79 &ANS( std_num_cmp(2*sin(3*$pi/2)) ); 80 81 BEGIN_TEXT 82 Sometimes you need to use ( )'s to make your meaning clear. E.g. 1/2+3 is 3.5, but 1/(2+3) is .2 Why? 83 Try entering both and use the ${LQ}Preview${RQ} button below to see the difference. In addition to 84 ( )'s, you can also use [ ]'s and $LB ${RB}'s. $BR 85 \{ ans_rule(20) \}$PAR 86 END_TEXT 87 88 &ANS( std_num_cmp(.2)); 89 90 BEGIN_TEXT 91 You can always try to enter answers and let WeBWorK do the calculating. 92 WeBWorK will tell you if the problem requires a strict numerical answer. 93 The way we use WeBWorK in this class there is no penalty for getting an answer wrong. What counts 94 is that you get the answer right eventually (before the due date). For complicated answers, 95 you should use the ${LQ}Preview${RQ} button to check for syntax errors and also to check that the answer 96 you enter is really what you think it is. 97 END_TEXT 98 99 ENDDOCUMENT(); # This should be the last executable line in the problem.
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |