2
$\begingroup$

Short question, I have:

$ \log \left(0.617424 e^{-1.19761 (W-0.427026)^2}\right)-\log \left(0.617424 e^{-1.19761 (0.116019\, -W)^2}\right) $

W is real and positive. Now I want just that Mathematica outputs:

$-8.49684100856507^{-10} W^2+0.744933 W-0.202266$

I tried already to use

Simplify[%]

FullSimplify[%]

Assuming[W>0,Simplify[%]]

Assuming[{W>0, W elem Reals},Simplify[%]]

and a lot of other operations, but nothing worked out well. I understand that Mathematicas tries sometimes to keep exp-function, because it's easier to use them later, but instead of a linear function??

Cheers

$\endgroup$
4
$\begingroup$

Use PowerExpand to do the Log[Exp] reduction:

Simplify[PowerExpand[expr]]
(* -0.202265 + 0.74493 W *)
$\endgroup$
1
$\begingroup$

Tell Mathematica that it has to use a simple rule (it is not applied automatically because of it makes the expression more complicated):

exp=Log[0.617424 Exp[-1.19761(W-0.427026)^2]] - Log[0.617424 Exp[-1.19761(0.116019-W)^2]]

Assuming[{W\[Element]Reals},Simplify[exp /. Log[a_ b_] :> Log[a]+Log[b]]]

(* -0.202265 + 0.74493 W *)
$\endgroup$
  • $\begingroup$ Not that straightforward as I expected, but thank you! :-) $\endgroup$ – QuantumMechanics Nov 19 '15 at 14:24
  • $\begingroup$ I completely agree; @John Doty's answer is as it has to be. $\endgroup$ – Fred Simons Nov 19 '15 at 15:01
1
$\begingroup$

Try FullSimplify with assumptions.

expr = Log[0.617424 Exp[-1.19761 (W - 0.427026)^2]] - Log[0.617424 Exp[-1.19761 (0.116019 - W)^2]];

Assuming[W > 0, FullSimplify[exp]]

(* -0.202265 + 0.74493 W *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.