2
$\begingroup$

I have:

PowerExpand[Log[Product[f[i], {i, 1, n}]]] // InputForm
(* Output: Log[Product[f[i], {i, 1, n}]] *)

However, I would expect to get the following as the output instead: Sum[Log[f[i]], {i,1,n}]

Is it possible to tweak the code somehow to achieve such behavior?

$\endgroup$
  • 1
    $\begingroup$ I think you only can introduce a rule like this: rule = Log[Product[f_[i], {i, 1, n_}]] :> Sum[Log[f[i]], {i, 1, n}] and apply it to such expressions. $\endgroup$ – Alexei Boulbitch Apr 1 '19 at 12:35
3
$\begingroup$

Amplifying @AlexeiBoulbitch 's comment: you may have to implement this transformation manually, as it makes a lot of assumptions.

A = Log[Product[f[i], {i, 1, n}]]

$$ \log \left(\prod_{i=1}^n f(i)\right) $$

A /. Log[Product[a_, b_]] :> Sum[Log[a], b]

$$ \sum_{i=1}^n \log(f(i)) $$

| improve this answer | |
$\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.