2
$\begingroup$

In the following expression

Log[a/6] + Log[b/7]+Log[c/7] + Log[b/8] 

I want $log(\frac{b}{7})$ and $log(\frac{b}{8})$ to be replaced by $log(b)-log(7)$ and $log(b)-log(8)$. I have tried with this

Log[a/6] + Log[b/7] + Log[c/7] + Log[b/8] /. Log[b/x_] -> Log[b] - Log[x]

but it does not work.

$\endgroup$
1
  • 1
    $\begingroup$ Try using PowerExpand $\endgroup$
    – Carl Woll
    Feb 4, 2018 at 6:12

1 Answer 1

4
$\begingroup$

Look at

FullForm[Log[b/7]]
(* Log[Times[Rational[1,7],b]] *)

and adapt your pattern to

Log[a/6] + Log[b/7] + Log[c/7] + Log[b/8] /.
   Log[Rational[1, x_]*b] -> Log[b] - Log[x]

Further, note the comment of Carl and be aware of the functions

Log[a/6] + Log[b/7] + Log[c/7] + Log[b/8] // FunctionExpand
(* -2 Log[7] - Log[48] + Log[a] + 2 Log[b] + Log[c] *)

Log[a/6] + Log[b/7] + Log[c/7] + Log[b/8] // PowerExpand
(* -4 Log[2] - Log[3] - 2 Log[7] + Log[a] + 2 Log[b] + Log[c] *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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