Difference between revisions of "Things to consider in developing WeBWorK problems with embedded Flash applets"

From WeBWorK_wiki
Jump to navigation Jump to search
Line 73: Line 73:
 
|- style=" background-color:#ddffdd;"
 
|- style=" background-color:#ddffdd;"
 
| <pre>
 
| <pre>
DOCUMENT(); # This should be the first executable line in the problem.
 
  +
DOCUMENT();
   
 
loadMacros(
 
loadMacros(
Line 87: Line 87:
 
<p>
 
<p>
 
The <code>loadMacros</code> command loads information that works behind the scenes. For our purposes we can usually just load the macros shown here and not worry about things further.
 
The <code>loadMacros</code> command loads information that works behind the scenes. For our purposes we can usually just load the macros shown here and not worry about things further.
  +
</p>
  +
|- style=" background-color:#ffffdd;"
  +
| <pre>
  +
# Set up problem
  +
TEXT(beginproblem());
  +
$showPartialCorrectAnswers = 1;
  +
Context("Numeric");
  +
  +
$ans =Compute("1");
  +
  +
$showSolution = 0;
  +
if(time>$dueDate){
  +
$showSolution = 1;
  +
}
  +
  +
$isit2der = 1; #match first and second derivatives
  +
</pre>
  +
| <p>
  +
This is the <strong>problem set-up section</strong> of the problem.
  +
</p>
  +
<p>
  +
The derGraphMatchWW.swf applet requires the student to match three sets of graphs. If <code>$isit2der</code> is set to zero, the student must match three pairs of graphs of functions and their derivatives. If <code>$isit2der</code> is set to one, the student must match three triples of graphs of functions and their first and second derivatives. The screenshot above shows the applet with <code>$isit2der=1</code>. <code>$showSolutions</code> is turned on when the due date is passed. The solutions are shown within the applet. The problem author can add some explanatory text in the pg file. The applet shows the graphs in the correct positions with shading turned on so that the student can see the function is concave up where its derivative is increasing and the second derivative is positive.
 
</p>
 
</p>
 
|}
 
|}

Revision as of 10:30, 2 August 2011

Applets in the body of a WeBWorK problem

Where is the solution computed?

In WeBWorK

In the applet

Applets in Hints and Solutions

For many types of problems, you may not need an applet in the main part of the problem, but you may want to use one to provide the student with a hint or to help the student understand the solution.
Sinxoverx.jpg

border="1" cellpadding="2" width="800"
Row heading A longer piece of text. Lorem ipsum...
Row heading Excepteur sint occaecat...
Orange Each liaison will be asked to submit evidence annually that progress has been made on this objective. This may include an increase in the number of dual-enrollment options made available or Each liaison will be asked to submit evidence annually that progress has been made on this objective. This may include an increase in the number of dual-enrollment options made available orEach liaison will be asked to submit evidence annually that progress has been made on this objective. This may include an increase in the number of dual-enrollment options made available orEach liaison will be asked to submit evidence annually that progress has been made on this objective. This may include an increase in the number of dual-enrollment options made available orEach liaison will be asked to submit evidence annually that progress has been made on this objective. This may include an increase in the number of dual-enrollment options made available or Apple Each liaison will be asked to submit evidence annually that progress has been made on this objective. This may include an increase in the number of dual-enrollment options made available orEach liaison will be asked to submit evidence annually that progress has been made on this objective. This may include an increase in the number of dual-enrollment options made available orEach liaison will be asked to submit evidence annually that progress has been made on this objective. This may include an increase in the number of dual-enrollment options made available orEach liaison will be asked to submit evidence annually that progress has been made on this objective. This may include an increase in the number of dual-enrollment options made available orEach liaison will be asked to submit evidence annually that progress has been made on this objective. This may include an increase in the number of dual-enrollment options made available orEach liaison will be asked to submit evidence annually that progress has been made on this objective. This may include an increase in the number of dual-enrollment options made available or
Bread Pie
Butter Ice cream
PG problem file Explanation

##DESCRIPTION
##  understanding derivatives graphically
##ENDDESCRIPTION

##KEYWORDS('derivatives', 'graph')

## DBsubject('Calculus')
## DBchapter('Limits and Derivatives')
## DBsection('Derivatives')
## Date('7/25/2011')
## Author('Barbara Margolius')
## Institution('Cleveland State University')
## TitleText1('')
## EditionText1('2011')
## AuthorText1('')
## Section1('')
## Problem1('')

###################################################
# This work is supported in part by the National  
# Science Foundation under the grant DUE-0941388.
###################################################
 

This is the tagging and description section of the problem. Note that any line that begins with a "#" character is a comment for other authors who read the problem, and is not interpreted by WeBWorK.

The description is provided to give a quick summary of the problem so that someone reading it later knows what it does without having to read through all of the problem code.

All of the tagging information exists to allow the problem to be easily indexed. Because this is a sample problem there isn't a textbook per se, and we've used some default tagging values. There is an on-line list of current chapter and section names and a similar list of keywords. The list of keywords should be comma separated and quoted (e.g., KEYWORDS('calculus','derivatives')).

DOCUMENT();       

loadMacros(
"PGanswermacros.pl",
  "PGstandard.pl",
  "AppletObjects.pl",
  "MathObjects.pl",
);

This is the initialization section of the problem. The first executed line of the problem must be the DOCUMENT(); command. Note that every command must end with a semicolon.

The loadMacros command loads information that works behind the scenes. For our purposes we can usually just load the macros shown here and not worry about things further.

# Set up problem
TEXT(beginproblem());
$showPartialCorrectAnswers = 1;
Context("Numeric"); 

$ans =Compute("1");

$showSolution = 0;
if(time>$dueDate){
   $showSolution = 1;
}

$isit2der = 1; #match first and second derivatives

This is the problem set-up section of the problem.

The derGraphMatchWW.swf applet requires the student to match three sets of graphs. If $isit2der is set to zero, the student must match three pairs of graphs of functions and their derivatives. If $isit2der is set to one, the student must match three triples of graphs of functions and their first and second derivatives. The screenshot above shows the applet with $isit2der=1. $showSolutions is turned on when the due date is passed. The solutions are shown within the applet. The problem author can add some explanatory text in the pg file. The applet shows the graphs in the correct positions with shading turned on so that the student can see the function is concave up where its derivative is increasing and the second derivative is positive.

Useful links: GraphLimit Flash Applet Sample Problem
GraphLimit Flash Applet Sample Problem 2
Derivative Graph Matching Flash Applet Sample Problem
trigwidget Applet Sample Problem
uSub Applet Sample Problem