# A potential bug which should have a ticket

0 views

### Nathann Cohen

Dec 11, 2009, 7:46:31 AM12/11/09
to Sage devel
Hello everybody !!!

I just met what I believe is a Sage bug if not a misuse of it from my
behalf, and I have no idea of how to create the corresponding ticket,
symbolics not being my field in any way. besides, I produced this bug
using the sage version with is installed in sage.math ( recompiling
the new version at the moment, I do not have any Sage available ). It
may be solved already but here it is anyway :

sage: var('delta k')
sage: m1=2*delta**2 + 2**2*delta*k
sage: n=delta*k+2
sage: m2=(2*delta)**2+(k-1)*4
sage: m=(delta+delta*k-(delta-1))
sage: ((m1/n)-(m2/n)).expand().simplify()

I will find another way to compute this, I was just too lazy to use
paper, so I am not blocked in any way, but this remains a bug that may
be created by a more clever use of Sage :-)

Thankkkkks !!! :-)

Nathann

### Burcin Erocal

Dec 11, 2009, 9:19:37 AM12/11/09
Hi Nathann,

On Fri, 11 Dec 2009 13:46:31 +0100
Nathann Cohen <nathan...@gmail.com> wrote:

> Hello everybody !!!
>
> I just met what I believe is a Sage bug if not a misuse of it from my
> behalf, and I have no idea of how to create the corresponding ticket,
> symbolics not being my field in any way. besides, I produced this bug
> using the sage version with is installed in sage.math ( recompiling
> the new version at the moment, I do not have any Sage available ). It
> may be solved already but here it is anyway :
>
>
> sage: var('delta k')
> sage: m1=2*delta**2 + 2**2*delta*k
> sage: n=delta*k+2
> sage: m2=(2*delta)**2+(k-1)*4
> sage: m=(delta+delta*k-(delta-1))
> sage: ((m1/n)-(m2/n)).expand().simplify()

On 4.3.rc0, I get this:

TypeError: unsupported operand parent(s) for '*': 'Symbolic Ring' and
'<class 'sage.functions.generalized.FunctionDiracDelta'>'

Is this same problem you're seeing?

The Maxima interface seems to give precedence to the global function
dictionary instead of the local variables when converting Maxima output
back to Sage expressions.

sage: dirac_delta(x)
dirac_delta(x)
sage: maxima(dirac_delta(x))
delta(x)

I opened a ticket for this:

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

You can work around the problem by avoiding the variable name delta:

sage: var('d k')
(d, k)
sage: m1=2*d**2 + 2**2*d*k
sage: n=d*k+2
sage: m2=(2*d)**2+(k-1)*4
sage: sage: m=(d+d*k-(d-1))
sage: m=(d+d*k-(d-1))
sage: ((m1/n)-(m2/n)).expand().simplify()
-2*d^2/(d*k + 2) + 4*d*k/(d*k + 2) - 4*k/(d*k + 2) + 4/(d*k + 2)

Cheers,
Burcin