Editing USub Applet Sample Problem

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 50: Line 50:
 
## Section1('')
 
## Section1('')
 
## Problem1('')
 
## Problem1('')
########################################
+
########################################################################
# This work is supported in part by the
+
# This work is supported in part by the National Science Foundation
# National Science Foundation
 
 
# under the grant DUE-0941388.
 
# under the grant DUE-0941388.
########################################
+
########################################################################
 
</pre>
 
</pre>
 
| <p>
 
| <p>
Line 68: Line 68:
 
|- style="background-color:#ddffdd;"
 
|- style="background-color:#ddffdd;"
 
| <pre>
 
| <pre>
DOCUMENT();
 
  +
DOCUMENT(); # This should be the first executable line in the problem.
   
 
loadMacros(
 
loadMacros(
Line 95: Line 95:
 
$vsmall = -$vbig;
 
$vsmall = -$vbig;
   
$anslist = List(
+
$anslist = List(Compute("cos(u)"),Compute("0"),
Compute("cos(u)"),
+
Compute("$b+$b^2"),Compute("sin($b+$b^2)"));
Compute("0"),
 
Compute("$b+$b^2"),
 
Compute("sin($b+$b^2)"));
 
   
 
</pre>
 
</pre>
Line 110: Line 110:
 
# Create link to applet
 
# Create link to applet
 
###################################
 
###################################
$appletName = "uSub";
+
$appletName = "uSub";
$applet = FlashApplet(
+
$applet = FlashApplet(
codebase
+
codebase => findAppletCodebase("$appletName.swf"),
=> findAppletCodebase("$appletName.swf"),
+
appletName => $appletName,
appletName => $appletName,
+
appletId => $appletName,
appletId => $appletName,
+
setStateAlias => 'setXML',
setStateAlias => 'setXML',
+
getStateAlias => 'getXML',
getStateAlias => 'getXML',
+
setConfigAlias => 'setConfig',
setConfigAlias => 'setConfig',
+
#getConfigAlias => 'getConfig',
maxInitializationAttempts => 5,
+
#initializeActionAlias => 'setXML',
answerBoxAlias => 'answerBox',
+
maxInitializationAttempts => 5, # number of attempts to initialize applet
height => '550',
+
#submitActionAlias => 'getXML',
width => '700',
+
answerBoxAlias => 'answerBox',
bgcolor => '#e8e8e8',
+
height => '550',
debugMode => 0,
+
width => '700',
submitActionScript =>
+
bgcolor => '#ffffff',
qq{getQE("answerBox").value
+
debugMode => 0,
=getApplet("$appletName").getAnswer() },
+
submitActionScript =>
  +
qq{getQE("answerBox").value=getApplet("$appletName").getAnswer() },
 
);
 
);
 
###################################
 
###################################
Line 134: Line 134:
 
 
 
#initially the answers will be blank
 
#initially the answers will be blank
$applet->configuration(qq{<xml>
+
$applet->configuration(qq{<xml>
<plot func='(1+2*x)*cos(x+x^2)'
+
<plot func='(1+2*x)*cos(x+x^2)' lower='0' upper='$b'/>
lower='0' upper='$b'/>
+
<grids xgrid='1' ygrid='$b'/>
<grids xgrid='1' ygrid='$b'/>
+
<win xmin='-3' xmax='$ubig' ymin='$vsmall' ymax='$vbig'
<win xmin='-3' xmax='$ubig'
+
umin='-3' umax='$ubig' vmin='$vsmall' vmax='$vbig' />
ymin='$vsmall' ymax='$vbig'
+
<ans func='' lower='' upper ='' theValue='' />
umin='-3' umax='$ubig'
+
<usub ufunc='x+x^2'/></xml>});
vmin='$vsmall' vmax='$vbig' />
+
#initially the answers will be blank
<ans func='' lower='' upper =''
+
$applet->initialState(qq{<xml>
theValue='' />
+
<plot func='(1+2*x)*cos(x+x^2)' lower='0' upper='$b'/>
<usub ufunc='x+x^2'/></xml>});
+
<grids xgrid='1' ygrid='$b'/>
#initially the answers will be blank
+
<win xmin='-3' xmax='$ubig' ymin='$vsmall' ymax='$vbig'
$applet->initialState(qq{<xml>
+
umin='-3' umax='$ubig' vmin='$vsmall' vmax='$vbig' />
<plot func='(1+2*x)*cos(x+x^2)'
+
<ans func='' lower='' upper ='' theValue='' />
lower='0' upper='$b'/>
+
<usub ufunc='x+x^2'/></xml>});
<grids xgrid='1' ygrid='$b'/>
 
<win xmin='-3' xmax='$ubig'
 
ymin='$vsmall' ymax='$vbig'
 
umin='-3' umax='$ubig'
 
vmin='$vsmall' vmax='$vbig' />
 
<ans func='' lower='' upper =''
 
theValue='' />
 
<usub ufunc='x+x^2'/></xml>});
 
   
TEXT( MODES(TeX=>'object code',
+
TEXT( MODES(TeX=>'object code', HTML=>$applet->insertAll(
HTML=>$applet->insertAll(
 
 
debug=>0,
 
debug=>0,
 
includeAnswerBox=>1,
 
includeAnswerBox=>1,
  +
# reinitialize_button=>$permissionLevel>=10,
 
)));
 
)));
 
</pre>
 
</pre>
Line 214: Line 215:
   
 
$BR
 
$BR
$BR Complete the indicated blanks
+
$BR Complete the indicated blanks in the applet. When done click 'submit answers'.
in the applet. When done click
 
'submit answers'.
 
   
$PAR If you click 'submit answers'
+
$PAR If you click 'submit answers' before you are done,
before you are done, WeBWorK will
+
WeBWorK will save your work for when you log back on.
save your work for when you log back on.
 
   
 
END_TEXT
 
END_TEXT
Line 230: Line 231:
 
|- style="background-color:#eeddff;"
 
|- style="background-color:#eeddff;"
 
| <pre>
 
| <pre>
###################################
+
##############################################################
 
#
 
#
 
# Answers
 
# Answers
Line 236: Line 237:
 
## answer evaluators
 
## answer evaluators
   
NAMED_ANS( 'answerBox'=>$anslist->
+
NAMED_ANS( 'answerBox'=>$anslist->cmp(ordered=>1) );
cmp(ordered=>1) );
 
   
 
ENDDOCUMENT();
 
ENDDOCUMENT();

Please note that all contributions to WeBWorK_wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see The WeBWorK Project wiki:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)