f

#### Simplifying Log[a] + Log[expr_] - Log[2 expr_]: Brute force necessary?

```Hello,
This works as I would hope it would:

Simplify[Log[a^2] + Log[b^2] - Log[-2 b^2],
Assumptions -> Element[a, Reals] && Element[b, Reals]]

It returns -Log[-2/a^2]

However, something a little more complicated:

Simplify[
Log -
- 2 Log[-2 ((R + x)^2 + y^2 + (z - zvar)^2)]
+    2 Log[(R + x)^2 + y^2 + (z - zvar)^2]),
Assumptions ->
{Element[zvar,Reals], Element[x,Reals],Element[y, Reals], Element[z, Reals}]

doesn't simplify. I can't see a way to do this, but brute force.

Any ideas?
Thanks,

W. Craig Carter

``` 0 10/1/2007 8:55:22 AM comp.soft-sys.math.mathematica  28821 articles. 0 followers. 4 Replies 440 Views Similar Articles

[PageSpeed] 32

```W. Craig Carter wrote:

> This works as I would hope it would:
>
> Simplify[Log[a^2] + Log[b^2] - Log[-2 b^2],
>   Assumptions -> Element[a, Reals] && Element[b, Reals]]
>
> It returns -Log[-2/a^2]
>
> However, something a little more complicated:
>
> Simplify[
> Log -
---------^
Too many minus signs.
>    - 2 Log[-2 ((R + x)^2 + y^2 + (z - zvar)^2)]
>     +    2 Log[(R + x)^2 + y^2 + (z - zvar)^2]),
------------------------------------------------^
Extraneous parenthesis.
>   Assumptions ->
> {Element[zvar,Reals], Element[x,Reals],Element[y, Reals], Element[z, Reals}]
----------------------------------------------------------------------------^
Missing square bracket.
>
> doesn't simplify. I can't see a way to do this, but brute force.
>
> Any ideas?

Fixing the syntax errors and adding the parameter R in the list of real
argument does not help. You could use *ComplexExpand*.

In:= Simplify[
Log - 2 Log[-2 ((R + x)^2 + y^2 + (z - zvar)^2)] +
2 Log[(R + x)^2 + y^2 + (z - zvar)^2],
Assumptions -> Element[{R, zvar, x, y, z}, Reals]]

Out= Log - 2 Log[-2 ((R + x)^2 + y^2 + (z - zvar)^2)] +
2 Log[(R + x)^2 + y^2 + (z - zvar)^2]

In:= ComplexExpand[
Log - 2 Log[-2 ((R + x)^2 + y^2 + (z - zvar)^2)] +
2 Log[(R + x)^2 + y^2 + (z - zvar)^2]]

Out= -2 \[ImaginaryI] \[Pi] - 2 Log + Log

HTH,
--
Jean-Marc

``` 0 10/2/2007 9:24:46 AM
```W. Craig Carter schrieb:
>
> Hello,
> This works as I would hope it would:
>
> Simplify[Log[a^2] + Log[b^2] - Log[-2 b^2],
>   Assumptions -> Element[a, Reals] && Element[b, Reals]]
>
> It returns -Log[-2/a^2]
>
> However, something a little more complicated:
>
> Simplify[
> Log -
>    - 2 Log[-2 ((R + x)^2 + y^2 + (z - zvar)^2)]
>     +    2 Log[(R + x)^2 + y^2 + (z - zvar)^2]),
>   Assumptions ->
> {Element[zvar,Reals], Element[x,Reals],Element[y, Reals], Element[z, Reals}]
>
> doesn't simplify. I can't see a way to do this, but brute force.
>
> Any ideas?
> Thanks,
>
> W. Craig Carter
>

You can use a rule to bring everything under one Log:

LogZusammenRule={
n_. Log[a_]+m_. Log[b_]:>Log[a^n b^m],
n_. Log[a_]-m_. Log[b_]:>Log[a^n/b^m],
a_ Log[b_]:>Log[b^a] };

ll= - 2 Log[-2 ((R + x)^2 + y^2 + (z - zvar)^2)] +
2 Log[(R + x)^2 + y^2 + (z - zvar)^2]

will be reduced to Log:

ll/.LogZusammenRule   =====>  Log

Gruss Peter
--
==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de

``` 0 10/3/2007 10:33:50 AM
```On 3 Oct 2007, at 19:33, Peter Breitfeld wrote:

> W. Craig Carter schrieb:
>>
>> Hello,
>> This works as I would hope it would:
>>
>> Simplify[Log[a^2] + Log[b^2] - Log[-2 b^2],
>>   Assumptions -> Element[a, Reals] && Element[b, Reals]]
>>
>> It returns -Log[-2/a^2]
>>
>> However, something a little more complicated:
>>
>> Simplify[
>> Log -
>>    - 2 Log[-2 ((R + x)^2 + y^2 + (z - zvar)^2)]
>>     +    2 Log[(R + x)^2 + y^2 + (z - zvar)^2]),
>>   Assumptions ->
>> {Element[zvar,Reals], Element[x,Reals],Element[y, Reals], Element
>> [z, Reals}]
>>
>> doesn't simplify. I can't see a way to do this, but brute force.
>>
>> Any ideas?
>> Thanks,
>>
>> W. Craig Carter
>>
>
> You can use a rule to bring everything under one Log:
>
> LogZusammenRule={
>   n_. Log[a_]+m_. Log[b_]:>Log[a^n b^m],
>   n_. Log[a_]-m_. Log[b_]:>Log[a^n/b^m],
>   a_ Log[b_]:>Log[b^a] };
>
>
> ll= - 2 Log[-2 ((R + x)^2 + y^2 + (z - zvar)^2)] +
>        2 Log[(R + x)^2 + y^2 + (z - zvar)^2]
>
> will be reduced to Log:
>
> ll/.LogZusammenRule   =====>  Log
>
> Gruss Peter
> --
>

The only problm is that the original expression is never equal to Log
 for any real values of the parameters. In fact it is:

ComplexExpand[-2*Log[-2*((R + x)^2 + y^2 + (z - zvar)^2)] +
2*Log[(R + x)^2 + y^2 + (z - zvar)^2]]
-2*I*Pi - 2*Log

Andrzej Kozlowski

``` 0 10/4/2007 8:53:23 AM
```>>
>> You can use a rule to bring everything under one Log:
>>
>> LogZusammenRule={
>>   n_. Log[a_]+m_. Log[b_]:>Log[a^n b^m],
>>   n_. Log[a_]-m_. Log[b_]:>Log[a^n/b^m],
>>   a_ Log[b_]:>Log[b^a] };
>
>  ComplexExpand[-2*Log[-2*((R + x)^2 + y^2 + (z - zvar)^2)] +
>   2*Log[(R + x)^2 + y^2 + (z - zvar)^2]]
>  -2*I*Pi - 2*Log

Thanks everyone. I view the rules as brute force (but that
is a matter of taste, not a disparaging comment on the
useful help). In the complexexpand example, I had to do this:
ComplexExpand[FullSimplify[logexpression,Assumptions->assumptions]]
to get the result that I wanted (which was Sqrt[-1] Pi)

``` 0 10/5/2007 9:12:03 AM