Differential Equations Essay Style Problem Source

From WeBWorK_wiki
Jump to navigation Jump to search

Problem with Flash Applets and Essay Style Questions - Source pg file.

Sample Problem with WWPluggableODESystem.swf - Source pg file

##DESCRIPTION
##  Linked Problem for Diff Eq lab
##ENDDESCRIPTION

##KEYWORDS('harmonic oscillator', 'damping')

## DBsubject('Calculus')
## DBchapter('Differential Equations')
## DBsection('The Logistic Equation')
## Date('10/25/2012')
## Author('L. Felipe Martins')
## Author('Barbara Margolius')
## Institution('Cleveland State University')
## TitleText1('Differential Equations')
## EditionText1('4')
## AuthorText1('Blanchard, Devaney, Hall')
## Chapter('2')
## Problem1('2.3')

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

DOCUMENT();      

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

# Print problem number and point value (weight) for the problem
TEXT(beginproblem());

# Show which answers are correct and which ones are incorrect
$showPartialCorrectAnswers = 1;

##############################################################
#
#  Setup
#
#
Context("Numeric");

@params_array = (
[2,5,2,3],
[3,5,3,3],
[5,5,4,3],
[2,6,3,5],
[3,6,3,5],
[5,6,3,5],
[5,4,4,2],
[5,5,4,2],
[5,6,4,2],
[5,4,4,2]);

SRAND($psvn);
$choice = random(0,9,1);
$m = $params_array[$choice][0];
$k = $params_array[$choice][1];
$b = $params_array[$choice][2];
$alpha = $params_array[$choice][3];

##############################################################
#
#  Applet object definition
#
#
$appletName = "WWPluggableODESystem";
$applet =  FlashApplet(
   codebase                  => findAppletCodebase("$appletName.swf"),
   appletName                => $appletName,
   appletId                  => $appletName,
   setStateAlias             => 'setXML',
   getStateAlias             => 'getXML',
   setConfigAlias            => 'setConfig',
   maxInitializationAttempts => 10,   
   #answerBoxAlias           => 'answerBox',
   height                    => '500',
   width                     => '650',
   bgcolor                   => '#99CCFF',
   debugMode                 =>  0,
   submitActionScript        =>  '',
);

##############################################################
#
#  Applet configuration
#
#
$config_string = <<'ENDCONFIG';
<XML>
    <options>
        <geometry x="5" y="5" width="490" height="490" />
        <bounds xmin="-5" xmax="5" ymin="-5" ymax="5" tmin="-10" tmax="10" />
        <ticks xstep="0.5" ystep="0.5" xsize="5" ysize="5" />
        <grid xstep="0.5" ystep="0.5" />
        <field xstep="0.5" ystep="0.5" xmin="-4.5" xmax="4.5" ymin="-4.5" ymax="4.5" 
               color="0x8FBCDB" backgroundcolor="0x153450" />
        <solutionstyle thickness="4" color="0xFFCC00" alpha="0.8" />
    </options>
    <system>
        <variable name="t" />
        <variable name="y" derivative="v" />
        <variable name="v" derivative="-(k/m)*y-(b/m)*v" />
        <parameter name="m" value="-3" />
        <parameter name="b" value="2"  />
        <parameter name="k" value="5" />
    </system>
</XML>
ENDCONFIG

$applet->configuration($config_string);

##############################################################
#
#  Text
#
#
Context()->texStrings;
BEGIN_TEXT
  
In this assignment you will use the computer-generated solutions
to analyze three related second-order differential equations.
$BR
$BR
The most classic of all second-order equations is the harmonic oscillator:
\[m\frac{d^2y}{dt^2}+b\frac{dy}{dt}+ky=0.\]
This is a second-order, homogeneous, linear differential equation with constant coefficients.
For this assignment, we assume that, \(m>0\), \(b\ge0\) and \(k>0\). 
This equation models a spring-mass system, where \(m\), \(b\)
and \(k\) represent, respectively, the mass, the damping coefficient and the spring stiffness.
The dependent variable \(y \) describes the displacement of the mass, that is, how much the
spring is stretched or compressed.
$BR
$BR
We adopt the point of view that a second-order equation can be reduced to a system of two
first order differential equations. In our case the system is:
\[ \frac{dy}{dt}=v,\quad\ \frac{dv}{dt}=-\frac{k}{m}y-\frac{b}{m}v \]
The first equation you should study is the harmonic oscillator with no damping,
that is, with \(b=0\).  

Examine solutions using the phase plane below. You can click on the phase plane to 
draw solutions. Notice that the parameters \(m\), and \(k\) are not properly set. 
The first thing you have
to do is to choose appropriate values. Examine the solutions for at least three solutions, and
try to find solutions with significantly distinct qualitative behavior (if possible).
$BR$BR
END_TEXT

TEXT( MODES(TeX=>'A graph appears here in the html version.', HTML=>$applet->insertAll(
  debug=>0,
  includeAnswerBox=>0,
# reinitialize_button=>$permissionLevel>=10,
)));

BEGIN_TEXT
$BR
$BR
Are solutions to this system periodic? Explain your answer in terms of the phase plane plot.
$BR
$BR
\{essay_box()\}
$BR
$BR
if there are periodic solutions, choose a particular initial condition and estimate the period of the corresponding solution to two decimal places. Explain how you found this value.
$BR
$BR
\{essay_box()\}
$BR
$BR
Do all solutions have the same period? How can you decide that using solutions plotted in the phase plane?
$BR
$BR
\{essay_box()\}
$BR
$BR
Write a paragraph summarizing the observations you made. Your summary should include a description of the behavior of the solutions for this system for different initial conditions, and compare similarities and differences between distinct solutions.
$BR
$BR
\{essay_box()\}
$BR
$BR
Adapted from $BITALIC Differential Equations, 4th Ed., $EITALIC Blanchard, Devaney, Hall, 2012.

END_TEXT
Context()->normalStrings;

##############################################################
#
#  Answers
#
#

ANS(essay_cmp());
ANS(essay_cmp());
ANS(essay_cmp());
ANS(essay_cmp());
 

ENDDOCUMENT();