Short question, I have:

log(0.617424e−1.19761(W−0.427026)2)−log(0.617424e−1.19761(0.116019−W)2)

\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−10W2+0.744933W−0.202266-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

=================

=================

3 Answers

3

=================

Use PowerExpand to do the Log[Exp] reduction:

Simplify[PowerExpand[expr]]

(* -0.202265 + 0.74493 W *)

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 *)

Not that straightforward as I expected, but thank you! 🙂

– QuantumMechanics

Nov 19 ’15 at 14:24

I completely agree; @John Doty’s answer is as it has to be.

– Fred Simons

Nov 19 ’15 at 15:01

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 *)