## WeBWorK Problems

### Rendering inverse (hyperbolic) trig functions ### Rendering inverse (hyperbolic) trig functions

by Thomas Wong -
Number of replies: 2
Hi,

I am wondering if there is a way to alter the way inverse functions are rendered in the question?

For example, inverse tan is rendered as $\tan^{-1}(x)$ in the question text. To keep notation consistent with the rest of the subject, I am hoping to render it as $\arctan(x)$.

I recall seeing a similar post previously, but have been unable to locate it. Any directions would be appreciated.

I've attached a small example of the type of problem I am trying to create below.

Thank you very much
Regards,
Thomas

--------------------------

DOCUMENT();

"PGstandard.pl", # Standard macros for PG language
"MathObjects.pl",
"PGchoicemacros.pl",
"PGML.pl",
);

# Print problem number and point value (weight) for the problem
TEXT(beginproblem());

# Setup
Context("Numeric");

$f = Compute(list_random("arcsinh(y)", "arctan(y)"));$df = $f->D('y');$F = Compute("$df * e^($f)")->reduce();

# Text
Context()->texStrings;
BEGIN_TEXT
Enter the function $$F(y) = F$$ in the box below
$PAR $$F(y) =$$ \{ans_rule(10)\}. END_TEXT Context()->normalStrings; # Answers ANS($F->cmp() );
## 1/(1+y^2)exp(arctan(y))
## 1/sqrt(1+y^2)*exp(arcsinh(y))

ENDDOCUMENT(); ### Re: Rendering inverse (hyperbolic) trig functions

by Andrew Parker -
You can change the TeX output for existing functions by modifying them within the context. For example, this code will render inverse-tangent as arctangent:

Context()->functions->set(atan=>{TeX=>'\arctan'});
$f = Formula("tan^-1(x)"); then$f will render as \arctan(x) in texStrings (or PGML). 