WeBWorK Problems

ln(e) and MathObject differentiation

ln(e) and MathObject differentiation

by D. Brian Walton -
Number of replies: 2
When I use the D() operator on a MathObject formula involving exponentials of the form "e^x" instead of "exp(x)", the differentiation rule uses the general base rule: d/dx[b^x] = b^x ln(b). Consequently, when I "Show correct answers" on a problem, it always shows a factor ln(e).

Is there an easy way to make this go away?

- Brian


D. Brian Walton
James Madison University
In reply to D. Brian Walton

Re: ln(e) and MathObject differentiation

by Arnold Pizer -
Hi Brian,

I'm not sure if there is an easy way to make this go away, but if you do not like the way MathObjects format an answer (things like the derivative of e^x or x^x come to mind), you can always specify things the way you want. E.g.

$a = random(2,7,1);

$f = Compute("e^{${a}x}");
$ans = Compute("${a}e^{${a}x}");
###################################
# Main text

Context()->texStrings;
BEGIN_TEXT

Let \( f(x) = \displaystyle $f \).  Find \(f'(x)\).
$PAR
\(f'(x) =\) \{ans_rule(50) \}
END_TEXT
Context()->normalStrings;

###################################
# Answers

$showPartialCorrectAnswers = 1;
#$ans=$f->D('x');
ANS($ans->cmp);


Arnie

In reply to Arnold Pizer

Re: ln(e) and MathObject differentiation

by D. Brian Walton -
Yes, I suppose you are right. But that was the whole point in using MathObjects to begin with, so that I could avoid worrying about thinking through the rules when constructing the answer. (Of course, I also recognize that MathObjects does not do any algebra to simplify the answer, so maybe this is the approach I will want to take.)

- Brian