#6803: [with patch, needs review] Implement symbolic Kronecker delta and also
make
current signum (sgn) symbolic
-------------------------+--------------------------------------------------
Reporter: gmhossain | Owner:
Type: enhancement | Status: new
Priority: major | Milestone:
Component: symbolics | Keywords:
Reviewer: | Author: Golam Mortuza Hossain
Merged: |
-------------------------+--------------------------------------------------
Changes (by newvalueoldvalue):
* author: => Golam Mortuza Hossain
Old description:
> We should have a symbolic Kronecker delta in Sage.
>
> Also, current implementation of signum (sgn) function
> returns wrong answer for symbolic input.
> {{{
> sage: sgn(x)
> 1
> sage: sgn(-x)
> 1
> }}}
>
> So we should make sgn() symbolic aware. Given, implementation of
> these functions in new symbolics should be very similar to the existing
> generalized function '''Dirac delta''' and '''Heaviside''', I am putting
> them together here.
>
> Also, ticket #777 should be closed down as Sign is already in Sage
> and this ticket will further enhance it.
New description:
We should have a symbolic Kronecker delta in Sage.
Also, current implementation of signum (sgn) function
returns wrong answer for symbolic input.
{{{
sage: sgn(x)
1
sage: sgn(-x)
1
}}}
So we should make sgn() symbolic aware. Given, implementation of
these functions in new symbolics should be very similar to the existing
generalized function '''Dirac delta''' and '''Heaviside''', I am putting
them together here.
Also, ticket #777 should be closed down as Sign is already in Sage
and this ticket will further enhance it.
'''Patch:'''
Apart from implementing these two symbolic functions, attached patch
slightly speeds up three other generalized functions by avoiding default
`__call__` method of PrimitiveFunction. These functions take explicit
value either 0,-1,1 so those checks are not needed.
Timing '''before''' the patches:
{{{
sage: timeit('dirac_delta(1.0)')
625 loops, best of 3: 179 µs per loop
sage: timeit('unit_step(1.0)')
625 loops, best of 3: 345 µs per loop
sage: timeit('heaviside(1.0)')
625 loops, best of 3: 344 µs per loop
}}}
Timing '''after''' the patches:
{{{
sage: timeit('dirac_delta(1.0)')
625 loops, best of 3: 159 µs per loop
sage: timeit('heaviside(1.0)')
625 loops, best of 3: 324 µs per loop
sage: timeit('unit_step(1.0)')
625 loops, best of 3: 323 µs per loop
}}}
Also, it does slight re-arrangements of references.
--
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/6803#comment:1>
Sage <http://sagemath.org/>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---