##DESCRIPTION ## Simplify Exponents ## ##ENDDESCRIPTION ## DBsubject(Algebra) ## DBchapter(Properties of exponents, rational exponents and radicals) ## DBsection(Properties of exponents) ## Institution(The College of Idaho) ## Author(RA Cruz) ## MLT(Mult_exponents_one_var) ## MLTleader(1) ## Level(2) ## MO(1) ## TitleText1('Essentials of Intermediate Algebra') ## AuthorText1('Blitzer') ## EditionText1('1') ## Section1('1.6') ## Problem1('') ## KEYWORDS('real numbers','algebraic expressions') ## Date: 2007/09 DOCUMENT(); # This should be the first executable line in the problem. loadMacros( "PGstandard.pl", "MathObjects.pl", "contextLimitedPowers.pl", "answerHints.pl", "CofIdaho_macros.pl", "PGcourse.pl" ); TEXT(beginproblem()); ###################################### # Setup @alphabet = ("a","b","x","y"); $choose = random(0,2,2); @var = ($alphabet[$choose]); Context()->variables->are($var[0]=>'Real'); $n = random(2,4,1); $m = random(-9,-5,1); $num1 = random(2,5,1); $num2 = random(-5,-2,1); ###################################### # Main text BEGIN_TEXT Simplify the expression: $PAR \( ($num1 $var[0]^{$n} )($num2 $var[0]^{$m}) \) = \{ ans_rule(20) \} END_TEXT ###################################### # Answers # Format the answer so that it shows up correctly # in the "Correct Answer" box, i.e. put the variables # with negative exponents in the denominator. # NOTE: If more variables are used, just put # the exponents in the @expos vector in order. Context()->operators->set(@LimitedPowers::OnlyPositiveIntegers); $numerator = $num1*$num2; #Constants $denominator = 1; @expos = ($n+$m); $ans = SimplifyExponents($numerator,$denominator,~~@var,@expos); ANS($ans->cmp->withPostFilter(AnswerHints( sub { my ($correct,$student,$ah) = @_; ##Count the number of variables--(Better if checked for reduced constants too.) my $CorrectVariableNumber = $correct =~ tr/a-zA-Z//; my $StudentVariableNumber = $student =~ tr/a-zA-Z//; return $ah->{score}==1 && $CorrectVariableNumber<$StudentVariableNumber; } => ["Simplify your answer.", checkCorrect => 1, score => 0] ))); $showPartialCorrectAnswers = 1; ###################################### ; ENDDOCUMENT();