##DESCRIPTION
## Algebra problem: Functions Transformations
##ENDDESCRIPTION
##KEYWORDS('algebra', 'inequality', 'fraction')
## DBsubject('Algebra')
## DBchapter('Functions')
## DBsection('Transformations')
## Date('10/14/2013')
## Author('Bayliss')
## Institution('SHS')
########################################################################
DOCUMENT();
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"unionTables.pl",
"AppletObjects.pl",
"parserNumberWithUnits.pl",
"PGcourse.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");
Context()->reduction->set('(-x)-y'=>0);
$h_1 = Real( random(-9,-4,1) );
$k_1 = Real( random(-2,6,1) );
Context()->variables->add(f=>"Real");
$h2 = Compute("-1*$h_1-3");
$k2 = Compute("-2+$k_1");
$answer = Compute(" -1*f(x-$h_1)+$k_1")-> reduce();
$ans2 = Compute(" (x+$h2)^2+$k2") -> reduce();
Context()->normalStrings;
###################################
# Applet setup
###################################
$appletName = "transformations_1";
$applet = JavaApplet(
code => "geogebra.GeoGebraApplet",
archive => "geogebra.jar",
codebase => findAppletCodebase("geogebra.jar"),
appletName => $appletName,
appletId => $appletName,
submitActionAlias => 'getXML', # default actionAlias
initializeActionAlias => 'setXML', # default actionAlias
setStateAlias => 'setXML',
getStateAlias => 'getXML',
answerBoxAlias => 'answerBox',
width => 844, # may want to modify width
height => 456, # may want to modify height
mayscript => "true",
debugMode => 0,
submitActionScript =>qq{ getQE("answerBox").value=getPointLocation() },
onInit => 'ggbOnInit',
type => 'geogebra',
parameter_string =>GEOGEBRA_PARAMS(),
);
##################################
# Setup Geogebra applet -- this does not need to be changed
###################################
HEADER_TEXT(qq!
!
);
##############################################################
#
# Text
#
#
TEXT(
MODES(HTML=>
"${BBOLD}This question uses an interactive applet.${EBOLD}
Please be patient while it loads. If it does not load in
less than one minute or if you receive any errors,
try refreshing your browser or clicking the ${BITALIC}'return
this question to its initial state button'${EITALIC} below the applet.
$BR
$HR
$BR",
TeX=>"")
);
Context()->texStrings;
BEGIN_TEXT
Let \( f(x) \) be given as the graph below.
$BR $BR
Using the interactive applet below, enter your graph by clicking and draging
the points \( B'\) and \( E' \) to shift and scale the function onto the function on the left.
$BR$BR
$BCENTER
\{ MODES(TeX=>'object code', HTML=>$applet->insertAll(
debug =>0, reinitialize_button => 1, includeAnswerBox=>1,
))\}
$ECENTER
$BR
$BR
Let \( g(x)\) be the function on the left. Enter \(g(x)\) in terms of transformations performed on \(f(x)\), the function on the right. ie. \( g(x) = -2*f(x-5)+6 \)$BR
$SPACE \( g(x) =\) \{ans_rule(25)\}
$BR
$BR
Explain the transformations on \(f(x)\) that would transform the graph of \(f(x)\) onto the new graph.
$BR
\{ essay_box(8,60) \}
$BR
$BR
Click the ${BITALIC}Submit Answers${EITALIC}
button to submit your graph for grading."
$BR
END_TEXT
Context()->normalStrings;
HEADER_TEXT(<
function setAppletCoefficients() {
var applet=getApplet("$appletName"); //alert("Updating coefficients");
if (typeof(applet)!="undefined") {
if (typeof(applet.setValue)!="undefined") {
////////////////////////////////////////////////////////////////
// List the values of the parameters to be set in the applet here
////////////////////////////////////////////////////////////////
applet.setValue("h_1", $h_1);
applet.setValue("k_1", $k_1);
/////////////////////////////////////////////////////////////////
} else {
setTimeout("setAppletCoefficients()", 1000);
}
} else {
setTimeout("setAppletCoefficients()",1000);
}
}
ww_applet_list["$appletName"].setConfig = function() {setAppletCoefficients()};
ww_applet_list["$appletName"].initializeAction = function () {
ww_applet_list["$appletName"].setState();
}
function getPointLocation() {
var applet = getApplet("$appletName");
var pointA = applet.getObjectName(4);
var pointB = applet.getObjectName(5);
var Ax = applet.getXcoord(pointA);
var Ay = applet.getYcoord(pointA);
var Bx = applet.getXcoord(pointB);
var By = applet.getYcoord(pointB);
var func = "(" + Ay + "-" + By + ")/(" +Ax +"-"+ Bx + ")**2 ( x - " + Bx + ")^2 +" + By;
return func;
}
EOF
##############################################################
#
# Answers
#
#
NAMED_ANS('answerBox'=>$ans2->cmp() );
ANS($answer->cmp);
ANS( essay_cmp() );
# put the parameters defining the geogebra applet down here so they
# don't get in the way
sub GEOGEBRA_PARAMS {
$result = qq{
};
}
ENDDOCUMENT();