Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
brittnilorton committed Aug 17, 2022
1 parent 174305e commit 8c7a553
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
## DBsection(Chain rule (with trigonometric functions))
## Date(05/11/2018)
## Institution(Colorado Community College System)
## Author(Eric Fleming)
## Author(Eric Fleming-updated to use Composition_Ans by Brittni Lorton August 2022)
## MO(1)
## KEYWORDS('chain rule', 'trig', 'trigonometric functions', 'tan', 'tangent', 'tan(x)', 'sec', 'secant', 'sec(x)')

Expand Down Expand Up @@ -40,7 +40,6 @@ $a=random(2,9,1);
$b=random(2,20,1);
$c=random(2,20,1);


$f=Formula("tan(sec($a x))");

$ans1=Formula("tan(u)");
Expand All @@ -50,35 +49,23 @@ $ans3=Formula("$a sec^2(sec($a x)) sec($a x) tan($a x)");
###########################
# Main text

#BEGIN_PGML
BEGIN_PGML

#Decompose [`\displaystyle y=[$f]`] into two functions [`y=f(u)`] and [`u=g(x)`] such that [`y=f(g(x))`]. Then find `\frac{dy}{dx}`.
Decompose [`\displaystyle y=[$f]`] into two functions [`y=f(u)`] and [`u=g(x)`] such that [`y=f(g(x))`]. Then find `\frac{dy}{dx}`.

#[`f(u)=`][_______________] [@ AnswerFormatHelp("formulas") @]*
[`f(u)=`][_______________] [@ AnswerFormatHelp("formulas") @]*

#[`g(x)=`][_______________] [@ AnswerFormatHelp("formulas") @]*
[`g(x)=`][_______________] [@ AnswerFormatHelp("formulas") @]*

#`\frac{dy}{dx}=`[_______________] [@ AnswerFormatHelp("formulas") @]*
END_PGML

#END_PGML
Context()->texStrings;
BEGIN_TEXT
Decompose \( y=$f\) into two functions \(y=f(u)\) and \(u=g(x)\) such that \(y=f(g(x))\). Then find \( \frac{dy}{dx}\).
$BR
$BR
\( f(u) \) = \{ ans_rule(20) \}
\{ AnswerFormatHelp("formulas") \}
$BR
\( g(x) \) = \{ ans_rule(20) \}
$BR
END_TEXT
Context()->normalStrings;
COMPOSITION_ANS( $ans1, $ans2, vars=>['u','x'], showVariableHints=>1);
BEGIN_PGML

`\frac{dy}{dx}=`[_______________]{$ans3} [@ AnswerFormatHelp("formulas") @]*

END_PGML

BEGIN_TEXT
\(\frac{dy}{dx}= \) \{ans_rule(20)\}
END_TEXT
ANS( $ans3->cmp() );

############################
# Solution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,26 @@ $showPartialCorrectAnswers = 1;

###########################
# Setup
$ans1=Compute("-b+ax-cx-dx^2");
$ans2=Compute("(a-c)/(2d)");

do{$a=random(4,20,4);
$b=random(2,8,2);
$d=random(5,25,5);
$b=random(2,8,2);}
until($a>$b);
$ans3=Compute(($a-$b)/(2));

do{$d=random(5,25,5);
$e=random(2,8,2);
$f=random(1,3,1);
$g=random(.2,2,.2);
$ans1=Compute("-b+ax-cx-dx^2");
$ans2=Compute("(a-c)/(2d)");
$ans3=Compute(($a-$b)/(2));
$g=random(.2,2,.2);}
until($d>$f);
$ans4=Compute(($d-$f)/(2*$g));


$rev1=Compute("$a*x")->reduce;
$rev2=Compute("$d*x")->reduce;
$cost1=Compute("$b*x+x^2")->reduce;
$cost2=Compute("$e+$f*x+$g*x^2")->reduce;}until($ans3>0 and $ans4>0);

$cost2=Compute("$e+$f*x+$g*x^2")->reduce;

###########################
# Main text
Expand Down

0 comments on commit 8c7a553

Please sign in to comment.