I have a Calculus 2 integration problem where I want students to be able to enter their answer using the arcsec (x) form of this inverse trig. function, so I have added this option to the problem as shown below.
But MathQuill does not treat it properly, but instead inserts 'operatorname{arcsec}' in place of "arcsec".
To eliminate this error, do I have to create a custom grader? Or is there another way I could define the arcsec as a function that would work properly with MathQuill?
Thanks!
Paul
See image below for the error given and the problem code below that:
# DESCRIPTION # WeBWorK problem written by Paul Seeburger, <pseeburger@monroecc.edu> # ENDDESCRIPTION ## DBsubject(Calculus - single variable) ## DBchapter(Techniques of integration) ## DBsection(Trigonometric integrals) ## Date(2/5/2014) ## Institution(Monroe Community College) ## Author(Paul Seeburger) ## KEYWORDS('calculus', 'integral', 'antiderivatives', 'indefinite integrals', 'inverse trig', 'arcsec') ## Textbook tags ## HHChapter1('Integration') ## HHSection1('Inverse Trigonometric Integrals') DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "PGchoicemacros.pl", "hhAdditionalMacros.pl", "parserFormulaUpToConstant.pl", ); Context("Numeric"); $a = random(2,9,1); $asq = $a*$a; $b = random(2,5,1); $bsq = $b*$b; $c = $a*2+1; $bound = Compute(1.01*($a/$b)); Context()->variables->set(x=>{limits=>[$bound, 10]}); Context()->functions->set( asec => {TeX => '\text {arcsec}'}, ); Context()->flags->set( reduceConstants=>0, # no decimals reduceConstantFunctions=>1, # combine 4+5*2? formatStudentAnswer=>'parsed', # no decimals ); $aoverb = reduced_frac($a, $b); $bovera = reduced_frac($b, $a); $func = Compute("$c/(x*sqrt($bsq x^2 - $asq))"); $antider = Compute("($c/$a) arcsec(|$b x|/$a)"); $afunc = FormulaUpToConstant($antider." + C"); #$afunc->{test_at} = [[1, -$bound], [1, -$bound*2], [1, -$bound*10]]; $afunc->{test_at} = [-$bound, -$bound*2, -$bound*10]; TEXT(beginproblem()); Context()->texStrings; BEGIN_TEXT Antidifferentiate. You may need to transform the integrand first. $PAR \(\displaystyle \int\frac {$c}{x \sqrt{$bsq x^2 - $asq}}\, dx =\) \{ ans_rule(60) \} END_TEXT Context()->normalStrings; ANS($afunc->cmp() ); Context()->texStrings; BEGIN_SOLUTION $PAR SOLUTION $PAR Recognizing that this is NOT a natural log form integral, since we would need a factor of \(x\) in the numerator (and not in the denominator) for that, we check to see if this may be an inverse trig form integral by rewriting the denominator of the integrand. $PAR We see that \( a = $a \), \( u = $b x \), and \( du = $b \, dx \), $PAR and we recognize that the integral is in the $BBOLD arcsecant $EBOLD form, \[ \int\frac {du}{u\sqrt{u^2 - a^2}} = \frac{1}{a}\text{arcsec}\left(\frac {|u|}{a}\right) + C.\] Then we are able to evaluate the integral as follows: \[ \int\frac {$c}{x \sqrt{$bsq x^2 - $asq}}\, dx = $c \int\frac {$b}{$b x \sqrt{($b x)^2 - ($a)^2}}\, dx \] \[ = \frac {$c}{$a} \text{arcsec}\left(\frac{|$b x|}{$a} \right) + C = \frac {$c}{$a} \text{arcsec}\left($bovera |x| \right) + C. \] END_SOLUTION Context()->normalStrings; COMMENT('MathObject version'); ENDDOCUMENT();