Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 5 additions & 18 deletions Contrib/CCCS/AlgebraicLiteracy/IA_7.1/OpenStax_IA_7.1_23.pg
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@ loadMacros(
"PGgraphmacros.pl",
"PGcourse.pl",
"contextRationalFunction.pl",

);

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


Context("RationalFunction");
$var = list_random('x', 'y', 'z', 'a', 'b', 'c', 't', 'm', 'n', 'p');
Context()->variables->are($var =>'Real');
Expand All @@ -44,20 +43,8 @@ $gcf1 = -$a;
#Question
$g = Formula("($b*$a - $a*$var)/($var^2 - $b**2)")->reduce;

#Answer
#The negative must go in numerator!
$f = Formula("(-$a)/($var + $b)");

#custom checker to make sure it is reduced. It checks to see that answers are equivalent and then checks to see that the numerators are the same. Custom checker doesn't enforce polynomial format though...
$cmp = $f->cmp(checker => sub {
my ($correct,$student,$ans) = @_;
return 0 unless $correct == $student;
return 0 unless $student->{tree}->class eq "BOP" && $student->{tree}{bop} eq "/";
my $cnum = Formula($correct->{tree}{lop});
my $snum = Formula($student->{tree}{lop});
Value->Error("Your answer isn't reduced") unless (($cnum == $snum)||($cnum == -$snum));
return 1;
});
#Answer, testing at the removed discontinuity to ensure students simplify that factor
$f = Formula("(-$a)/($var + $b)")->with(test_at => [[$b]]);


##############################################
Expand All @@ -68,7 +55,7 @@ BEGIN_PGML

Simplify the rational expression.

[``[$g] = ``] [________]{$cmp}
[``[$g] = ``] [________]{$f}

END_PGML

Expand All @@ -91,7 +78,7 @@ In factored form, the problem is now:

[`\displaystyle \frac{[$gcf1]([$var] - [$b])}{([$var] - [$b])([$var] + [$b])}`]

[`([$var] - [$b])`] is a common factor. If we reduce this we are left with [`\displaystyle [$f]`].
[`([$var] - [$b])`] is a common factor. If we reduce this we are left with [`\displaystyle [$f1]`].
END_PGML_SOLUTION

ENDDOCUMENT();
15 changes: 2 additions & 13 deletions Contrib/CCCS/AlgebraicLiteracy/IA_7.1/OpenStax_IA_7.1_27.pg
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,8 @@ $eqn2 = Formula("$var^2 - $b**2")->reduce;
$g = Formula("($c*$var^2 + ($a + $c*$b)*$var + $a*$b)/($b**2 - $var^2)")->reduce;

#Answer
#The negative is in the numerator
$f = Formula("(-$c*$var - $a)/($var - $b)")->reduce;
$f = Formula("(-$c*$var - $a)/($var - $b)")->with(test_at => [[-$b]])->reduce;

#custom checker to make sure it is reduced. It checks to see that answers are equivalent and then checks to see that the numerators are the same. Custom checker doesn't enforce polynomial format though...
$cmp = $f->cmp(checker => sub {
my ($correct,$student,$ans) = @_;
return 0 unless $correct == $student;
return 0 unless $student->{tree}->class eq "BOP" && $student->{tree}{bop} eq "/";
my $cnum = Formula($correct->{tree}{lop});
my $snum = Formula($student->{tree}{lop});
Value->Error("Your answer isn't reduced") unless (($cnum == $snum)||($cnum == -$snum));
return 1;
});


##############################################
Expand All @@ -75,7 +64,7 @@ BEGIN_PGML

Simplify the rational expression.

[``[$g] = ``] [________]{$cmp}
[``[$g] = ``] [________]{$f}

END_PGML

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ $ans2=$DSA->eval(x=>$a,y=>$b);
##The volume of a rectangular box is `V(x,y)=[$f]`
BEGIN_PGML

Consider a closed rectangular box with a square base with side length `x` and height `y`. Find the surface area, `S(x,y)`. If the surface area is [$SA] square feet when [`x=[$a]`] and [`y=[$b]`], find `dy/dx`.
Consider a closed rectangular box with a square base with side length `x` and height `y`. Find the surface area formula, `S(x,y)`. If the surface area remains constant, then find `dy/dx` when [`x=[$a]`] and [`y=[$b]`].


`S(x,y)=` [_______________]{$ans1} [@ AnswerFormatHelp("formulas") @]*

When the surface area is [$SA] square feet, [`x=[$a]`], and [`y=[$b]`], `dy/dx=`[________________]{$ans2}[@ AnswerFormatHelp("numbers") @]*
If the surface area remains constant, then when [`x=[$a]`] and [`y=[$b]`], `dy/dx=`[________________]{$ans2}[@ AnswerFormatHelp("numbers") @]*

END_PGML

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,16 @@ Context("Numeric");
Context()->variables->add(u => 'Real');

$a=non_zero_random(-10,10,1);
$b=non_zero_random(-10,10,1);
$b=non_zero_random(1,10,1);


$f=Formula("sqrt(e^($a x)+$b x)")->reduce;


$ans=Formula("($a*e^($a*x)+$b)/(2*sqrt(e^($a*x)+$b x))");
#$ans = $f->D('x');
$ans=Formula("($a*e^($a*x)+$b)/(2*sqrt(e^($a*x)+$b x))")->with(limits=>[0,12]);

###########################
# Main text
## I hope you get [`[$ans1]`], [`[$ans2]`], and [`[$ans3]`].
BEGIN_PGML

Find `f^\prime(x)` for [`f(x)=[$f]`].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,19 @@ $showPartialCorrectAnswers = 1;
# Setup

Context("Numeric");
Context()->variables->set(x=>{limits=>[0.1,0.5]});
#Context()->variables->set(x=>{limits=>[1.1,10]});

$a=non_zero_random(-10,10,1);
$b=non_zero_random(-10,10,1);
$c=non_zero_random(-10,10,1);
$d=random(2,10,1);


if($a<0){Context()->variables->set(x=>{limits=>[0.1,0.9]});}
elsif($a>0){Context()->variables->set(x=>{limits=>[1.1,10]});}

$f=Formula("(x^$a-1)^(ln (x))");



$ans=Formula("(x^$a-1)^ln(x)(ln(x^$a-1)/x+ln(x)($a*x^($a-1)/(x^$a-1)))")->reduce;

###########################
# Main text
## I hope you get [`[$ans1]`], [`[$ans2]`], and [`[$ans3]`].
BEGIN_PGML

Use logrithmic differentiation to find `\frac{dy}{dx}` for [``y=[$f]``].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,17 @@ $exp2 = Compute("$min/$max");
$exp3 = Compute("$h");

Context()->noreduce('(-x)-y','(-x)+y', 'x^(-a)');
$fun = Formula("x**{$exp1}(x**$b+$c)**{$exp2}($f*x+$g)**$h")->reduce;
$ans=Formula("(1/($a*x)+($exp2*$b*x**($b-1))/(x**$b+$c)+($h*$f)/($f*x+$g))*$fun")->reduce->with(limits=>[9,10]);

$fun = Formula("x**{$exp1}*(x**$b+$c)**{$exp2}*($f*x+$g)**$h")->reduce;
$ans=Formula("(1/($a*x)+($exp2*$b*x**($b-1))/(x**$b+$c)+($h*$f)/($f*x+$g))*x**{$exp1}*(x**$b+$c)**{$exp2}*($f*x+$g)**$h")->reduce->with(limits=>[9,10]);
###########################
# Main text

BEGIN_PGML

Use logarithmic differentiation to find `\frac{dy}{dx}` for [`\displaystyle y= [$fun]`].


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


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ $ans =0;
# Main text

BEGIN_PGML
Evaluate the limit, [``\lim_{x\to 0}x^{\left(\dfrac{[$a]}{\cos(x)}\right)}``], either with l'Hopital's rule or previously learned methods.
Evaluate the limit, [``\lim_{x\to 0^+}x^{\left(\dfrac{[$a]}{\cos(x)}\right)}``], either with l'Hopital's rule or previously learned methods.



[``\lim_{x\to 0}x^{\left(\dfrac{[$a]}{\cos(x)}\right)}=``][_______________]{$ans } (Enter a number, `\infty,-\infty,` or "DNE".) [@ AnswerFormatHelp("numbers") @]*
[``\lim_{x\to 0^+}x^{\left(\dfrac{[$a]}{\cos(x)}\right)}=``][_______________]{$ans } (Enter a number, `\infty,-\infty,` or "DNE".) [@ AnswerFormatHelp("numbers") @]*



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,39 +30,30 @@ loadMacros(


TEXT(beginproblem());

###########################
# Setup

Context("Numeric");

Context()->variables->add(y => 'Real');

$f = Formula("x*y*sin(2*pi/y)");

###########################
# Setup

$a=non_zero_random(-12,12,2);
$k=non_zero_random(2,10);


$ans1=0;
#$ans2=Compute("$a*$k*sin(2*pi/$k)");

Context()->functions->disable("Trig");
$ans2 = $f->eval(x=>$a,y=>$k);

$ans2=Compute("$a*$k*sin(2*pi/$k)");

###########################
# Main text


BEGIN_PGML
Evaluate the following integrals using the Fundamental Theorem of Calculus, Part 2.

(a) [``\int_{0}^{[$k]\pi}[$a]\cos(\theta) d\theta=``][_________________]{$ans1 }[@ AnswerFormatHelp("numbers") @]*



(b) [``\int_{0}^{2\pi}[$a]\cos\left(\dfrac{\theta}{[$k]}\right) d\theta=``][_________________]{$ans2 }[@ AnswerFormatHelp("numbers") @]*

END_PGML
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@ $f = Formula("$a*x"); #denominator


#derivative
$ans = Formula("($a - $a*ln(x))/($a**2 * x**2)");
$ans = Formula("($a - $a*ln(x))/($a**2 * x**2)")->with(limits => [1,5]);

###########################
# Main text

BEGIN_PGML

Find the derivative, [`\frac{dy}{dx}`], for [`y=\frac{\ln(x)}{[$f]}`]
Find the derivative, [``\frac{dy}{dx}``], for [``y=\frac{\ln(x)}{[$f]}``]



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


END_PGML
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Context("Numeric");

$a=non_zero_random(-10,-1, 1);
$b=non_zero_random(1,10, 1);
$c=non_zero_random(-10,1, 1);
$c=non_zero_random(-10,-1, 1);

$f=Formula("$a*x(x-$b)*(x-$c)")->reduce;
$y=$f->eval(x=>0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ TEXT(beginproblem());
# Setup

Context("Numeric");
Context()->operators->undefine("/");
Context()->operators->undefine("/", "^");

$ans = Formula("log(x)");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Scaffold::Begin();

BEGIN_PGML

The population of a certain city was [`[$P0]`], then 5 years later the pouplation was [`[$b]`].
The population of a certain city was [`[$P0]`], then 5 years later the population was [`[$b]`].

END_PGML

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ $f=Formula("$a*x^2+$b*x+$c")->reduce;

$ans = ($b)**2-4*$a*$c;

$ans=0;


if ( $ans>0) {$popup = PopUp(
["?","Two Real Solutions","One Real Solution","Two Complex Solutions"],
Expand All @@ -56,9 +58,9 @@ elsif ($ans<0) {$popup = PopUp(
"Two Complex Solutions",)
}

elsif ($ans=0) {$popup = PopUp(
elsif ($ans==0) {$popup = PopUp(
["?","Two Real Solutions","One Real Solution","Two Complex Solutions"],
"One Real Solutions",)
"One Real Solution",)
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Context("Numeric");

$a=non_zero_random(-10,-1, 1);
$b=non_zero_random(1,10, 1);
$c=non_zero_random(-10,1, 1);
$c=non_zero_random(-10,-1, 1);

$f=Formula("$a*x(x-$b)*(x-$c)")->reduce;
$y=$f->eval(x=>0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ install_problem_grader(~~&std_problem_grader);


# Two random integer to grab letters
$n1 = random(0,10,1);
do{$n2 = random(0,10,1)} until ($n2 != $n1);
$n1 = random(0,9,1);
do{$n2 = random(0,9,1)} until ($n2 != $n1);


$root = $letter[$n1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ TEXT(beginproblem());
# Setup

Context("Numeric");
Context()->operators->undefine("/");
Context()->operators->undefine("/", "^");

$ans = Formula("log(x)");

Expand Down