logcontract issue - a bug or a feature?



Am Samstag, den 20.11.2010, 14:16 -0500 schrieb Stavros Macrakis:
> In your case %o2, automatically expanding the product created by a log
> contraction produces a simpler result, but that is not the general
> case.  I don't think it's a good idea to have, e.g.
> 
> 
>     logcontract(log(x+1)+log(x+2)+log(x+3)) => log(x^3+6*x^2+11*x+6)
> 
> 
>                -s
> 
> On Sat, Nov 20, 2010 at 14:05, Dr. David Kirkby
> <david.kirkby at onetel.net> wrote:
>         In Maxima 5.20.1, the following evaluates to 0, which is
>         correct, and the simplest way of expressing the result.
>         
>         (%i1) log(sqrt(2) - 1) + log(sqrt(2) + 1)$
>         
>         (%i2) logcontract(%);
>         (%o2)                                  0
>         
>         
>         However, in Maxima 5.22.1 the same inputs leads to something
>         quite different, although mathematically it is is a correct
>         result.
>         
>         %i3) log(sqrt(2) - 1) + log(sqrt(2) + 1)$
>         
>         (%i4) logcontract(%);
>         (%o4)                  log((sqrt(2) - 1) (sqrt(2) + 1))
>         
>         
>         
>         
>         Dave

The behavior of logcontract has changed with revision 1.32 of
comm2.lisp. The comment is:

Binding the option variable $ratfac in lgcplus to TRUE when calling
sratsimp. This maintains expressions as fully factored as possible
without calling factor.

In general the results of logcontract are more simple. Three examples of
the test_suite have to be adjusted.

Related bug report:
ID: 947808 - logcontract and ratfac


The bug report and the example of this posting show that it might be
more desirable to leave the expression in a factored form. Of course the
example of this thread shows a counterexample. It is necessary to expand
the result in addition:

(%i2) log(sqrt(2) - 1) + log(sqrt(2) + 1)$
(%i3) logcontract(%),expand;
(%o3) 0

Dieter Kaiser