- labels: --> Lisp Core - Simplification
logcontract(2*log(x+1)) => log((x+1)^2)
but
logcontract(2*log(x+1)+1) => log(x^2+2*x+1)+1
That is, it performs a ratsimp only in the second case.
logcontract is documented to perform the ratsimp, in
fact. But in general, it doesn't seem like a good idea.
Consider, e.g. logcontract(1000*log(x+1)+log(x)). This
stack-overflows since it expands out the result, but it
could just as well return log((x+1)^1000*x).
There is a workaround, which is to bind ratfac to true,
which leaves things in factored form. Perhaps
logcontract should always have ratfac:true?
Logged In: YES
user_id=501686
Same behavior in 5.9.3cvs.
As suggested in this bug report 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.
The examples of this bug report give:
(%i2) logcontract(2*log(x+1)+1);
(%o2) log((x+1)^2)+1
(%i3) logcontract(1000*log(x+1)+log(x));
(%o3) log(x*(x+1)^1000)
Closing this bug report as fixed.
Dieter Kaiser