Epsilon Delta Applet

From WeBWorK_wiki
Revision as of 13:41, 2 August 2013 by Dangries (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


About the Epsilon-Delta Applet for WeBWorK

This applet and WeBWorK problem are based upon work supported by the National Science Foundation under Grant Number DUE-0941388.

Click here and here to see two different problems making use of this applet (you may login as a guest).

Where to find more problems like this

The Epsilon-Delta Flash applet was designed to allow students to investigate the formal definition of the limit within a WeBWorK problem. The applet is mainly used to investigate the relationship between values for epsilon and delta. A WeBWorK problem must be written to accompany this applet, and ask appropriate questions about the function being displayed.

The same applet can be used to author both a problem where students investigate an existing limit, or perhaps a situation where the limit does not exists. The problem can be customized by changing the graph of the function to the left and right of the limiting point, as well as setting whether the function is defined at the limiting point.



An example problem where the limit exists:

Eps-delta-limit-exists.jpg



An example problem where the limit does not exist:

Eps-delta-limit-dne.jpg



Including the Flash applet in the WeBWorK problem is done in a way similar to other problems documented on this Wiki. For example see SolidsWW_Flash_Applet_Sample_Problem_1

Customizing the WeBWorK problem

For the sake of completeness, we include at the bottom of this page the full working PG code for a problem implementing this applet, but here we will only comment on the problem setup section of the code. This section contains all of the parameters that can be altered to adjust the appearance of the applet, to suit your needs as you author new WeBWorK problems using this applet. In addition to chaning the appearance of the applet, the author must write an appropriate problem in WeBWorK PG code to accompany the applet.

After the tagging, description, and initialization sections of the problem, the parameters for the applet are set up in a section following the comment line:
########### Problem parameters for customization here #######################
Below are the values that are used in an example problem where the limit fails to exist. The applet will draw a function with a jump discontinuity, by defining two separate functions to the left and right of the limiting point. Whether the applet is used to draw a continuous function or one with a jump discontinuity, the parameters are set in the same way.

The plot window

We set boundaries for the window in the following variables

$xMin = '-0.45';
$xMax = '2';
$yMin = '-0.45';
$yMax = '4.1';

The functions to plot

The functions plotted on left and right sides of the x value being approached. (To create a continuous function, we would set these functions to the same expression.)

$leftFunction = '3.5-x*x';
$rightFunction = '1.5+0.5*cos(pi*(x-1))';

We can choose to define the function at the x value being approached, or leave the function undefined, by setting the following variable to true or false:

$approachXInDomain = 'true';

We can set the value of the function at the x value being approached, independent of the left and right functions defined above(this will have no effect if approachXInDomain is set to false):

$functionValueAtApproachX = 2;

The x-value being approached in the supposed limit:

$approachX = 1;

The proposed value of the limit (which, in this example, is in fact being shown not to be correct):

$proposedLimit = 2;

Initializing epsilon and delta

Sliders allow the student to adjust the size of the epsilon and delta bands. We set the initial values for epsilon and delta for when the applet first opens as follows:

$epsilon = 0.75;
$delta = 0.5;

Epsilon and delta decimal accuracy for the text display:

$decimalPlaces = 8;

Labels and tick marks

spacing for both the numerical labels and tick marks along the axes:

$labelSpaceX = '0.5';
$labelSpaceY = '0.5';

Spacing of grid lines

$gridSpaceX = '0.5';
$gridSpaceY = '0.5';

The WeBWorK problem

Following the applet setup as described above, the author should write an appropriate problem to accompany the applet, using usual WeBWorK authoring techniques in PG code. See the full source code below for an example of such a problem. Note that this problem allows answers to lie within a certain range, and the answer checkers make use of a custom answer checker for this purpose.

The full source code

Below is the full PG source code for an example problem, where the student investigates the non-existence of a limit at a jump discontinuity.

##DESCRIPTION
##  Integration with substitution 
##ENDDESCRIPTION

##KEYWORDS('limits', 'formal definitino of the limit', 'Flash applets','NSF-0941388', 'Definition of Limit')

## DBsubject('Calculus')
## DBchapter('Limits')
## DBsection('The formal definition of the limit')
## Date('7/25/2012')
## Author('Dan Gries')
## Institution('Hopkins School')
## TitleText1('')
## EditionText1('2012')
## AuthorText1('')
## Section1('')
## Problem1('')

########################################################################

DOCUMENT();

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

TEXT(beginproblem());
$showPartialCorrectAnswers = 1;
Context("Numeric"); 

########### Problem parameters for customization here #######################


#plot window
$xMin = '-0.45';
$xMax = '2';
$yMin = '-0.45';
$yMax = '4.1';

#functions plotted on left and right sides of jump discontinuity
$leftFunction = '3.5-x*x';
$rightFunction = '1.5+0.5*cos(pi*(x-1))';

#whether the function should be defined at the discontinuity
$approachXInDomain = 'true';

#the value of the function at the discontinuity (will have no effect if approachXInDomain is set to false).
$functionValueAtApproachX = 2;

#the value of x being approached in the supposed limit
$approachX = 1;

#the proposed value of the limit (which is in fact being shown not to be correct)
$proposedLimit = 2;

#initial epsilon and delta values
$epsilon = 0.75;
$delta = 0.5;

#decimal places to show for displayed epsilon and delta values
$decimalPlaces = 8;


#spacing of ticks
$labelSpaceX = '0.5';
$labelSpaceY = '0.5';

#spacing of grid lines
$gridSpaceX = '0.5';
$gridSpaceY = '0.5';

#############################################################################

### Parameters for problem here ###

#$leftFunctionInverse = Formula('sqrt(3.5-x)');

$workingEpsilon1 = Compute('0.7');
$workingDelta1Bound = Compute('0.105572809');

$nonWorkingEpsilonBound = Compute('0.5');

###################################


    ###################################
    # Create  link to applet 
    ###################################
    $appletName = "EpsilonDelta_Generalized";
    $applet =  FlashApplet(
       codebase              => findAppletCodebase("$appletName.swf"),
       appletName            => $appletName,
       appletId              => $appletName,
       setStateAlias         => 'setXML',
       getStateAlias         => 'getXML',
       setConfigAlias        => 'setConfig',
       getConfigAlias        => 'getConfig',
       #initializeActionAlias => 'setXML',
       maxInitializationAttempts => 5,   # number of attempts to initialize applet
       #submitActionAlias     =>  'getXML',
       height                => '500',
       width                 => '665',
       bgcolor               => '#E7E9EF',
       debugMode             =>  0,
       submitActionScript  =>  qq{},
     );

###################################
# Configure applet
###################################

$configXMLString = qq{
<XML>
<window xMin='$xMin' xMax='$xMax' yMin='$yMin' yMax='$yMax' />
<labelSpaceX>$labelSpaceX</labelSpaceX>
<labelSpaceY>$labelSpaceY</labelSpaceY>
<gridSpaceX>$gridSpaceX</gridSpaceX>
<gridSpaceY>$gridSpaceY</gridSpaceY>
<leftFunction>$leftFunction</leftFunction>
<rightFunction>$rightFunction</rightFunction>
<approachXInDomain>$approachXInDomain</approachXInDomain>
<functionValueAtApproachX>2</functionValueAtApproachX>
<approachX>$approachX</approachX>
<proposedLimit>$proposedLimit</proposedLimit>
<epsilon>$epsilon</epsilon>
<delta>$delta</delta>
<decimalPlaces>$decimalPlaces</decimalPlaces>
</XML>
};


    $applet->configuration($configXMLString);
    $applet->initialState(qq{<XML> </XML>});

TEXT( MODES(TeX=>'object code', HTML=>$applet->insertAll(
  debug=>0,
  includeAnswerBox=>0,
#   reinitialize_button=>$permissionLevel>=10,
   )));

BEGIN_TEXT

$BR

Recall the definition of a limit: we say \(\lim_{x \to a} f(x) = L\) if:

$BR
$BR


For all \(\epsilon > 0\) there exists a \(\delta > 0\) such that \(|f(x) - L| < \epsilon\) whenever \(0 < |x - a| < \delta\).


$BR
$BR

Here we will look at the above function \(f\), which has no limit at $approachX. 
Therefore the claim that \(\lim_{x \to $approachX} f(x) = $proposedLimit \) is ${BBOLD}false$EBOLD, meaning the above 

definition fails.

$BR
$BR

First show that for ${BBOLD}some$EBOLD values of \(\epsilon\), there are values of \(\delta\) satisfying the conclusion 

of the limit definition. For example:

$BR
$BR

If \(\epsilon = $workingEpsilon1\) then provide a value for \(\delta\) making the conclusion of the limit definition 

true: \{ ans_rule(25) \}

$BR
$BR

However, not every value of \(\epsilon\) will work. Use the applet to find a value 
for \(\epsilon\) such that ${BBOLD}no$EBOLD \(\delta\) will satisfy the conclusion of the limit definition, and record that 

\(\epsilon\) here: \{ ans_rule(25) \}


END_TEXT
Context()->normalStrings;

##############################################################
#
#  Answers
#
## answer evaluators

$showPartialCorrectAnswers = 1;

ANS($workingDelta1Bound->cmp( checker=>sub {
my ($correct, $student, $ansHash) = @_;
return ($student < $correct) && (0 < $student);
} ) );


ANS($nonWorkingEpsilonBound->cmp( checker=>sub {
my ($correct, $student, $ansHash) = @_;
return ($student < $correct) && (0 < $student);
} ) );

ENDDOCUMENT();