#567 logcontract and ratfac

closed
nobody
3
2010-04-27
2004-05-04
No

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?

Discussion

  • Robert Dodier

    Robert Dodier - 2006-07-29
    • labels: --> Lisp Core - Simplification
     
  • Robert Dodier

    Robert Dodier - 2006-07-29

    Logged In: YES
    user_id=501686

    Same behavior in 5.9.3cvs.

     
  • Dieter Kaiser

    Dieter Kaiser - 2010-04-27
    • status: open --> closed
     
  • Dieter Kaiser

    Dieter Kaiser - 2010-04-27

    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

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks