[GiNaC-list] Fw: [sage-support] (5-e^x).substitute(x=log(x)) goes wrong?

Burcin Erocal burcin at erocal.org
Fri Sep 10 22:06:40 CEST 2010


Hi,

This was reported to the sage-support list. I was intending to CC
ginac-list in my reply, but hit send a bit too soon.

Cheers,
Burcin

Begin forwarded message:

On Fri, 10 Sep 2010 08:10:45 -0700 (PDT)
KvS <keesvanschaik at gmail.com> wrote:

> Dear all,
> 
> I'm sorry I have yet again something to bother you with. Running the
> following few lines:
> 
> eq=5-e^x
> print "1:",eq.substitute(x=3*x)
> print "2:",eq.substitute(x=log(x))
> 
> yields the output (Sage 4.5.2 with Ubuntu):
> 
> 1: -e^(3*x) + 5
> 2: -log(x) + 5
> 
> So 1 is fine, but it seems that to get to 2 Sage actually substitutes
> twice no: 5-e^x -> 5-x -> 5-log(x). I had expected it would just give
> me 5-x rather, is it a bug or a feature?

Thanks for reporting the problem. 

This looks like a bug in GiNaC, the library we use for the symbolic
expressions.

ginsh - GiNaC Interactive Shell (ginac V1.5.7)
  __,  _______  Copyright (C) 1999-2010 Johannes Gutenberg University
Mainz, (__) *       | Germany.  This is free software with ABSOLUTELY
NO WARRANTY. ._) i N a C | You are welcome to redistribute it under
certain conditions. <-------------' For details type `warranty;'.

Type ?? for a list of help topics.
> subs(5-exp(x),x==log(x));
5-log(x)


I opened a ticket for this:

http://trac.sagemath.org/sage_trac/ticket/9891


More information about the GiNaC-list mailing list