Opened 9 years ago

Closed 9 years ago

#9881 closed defect (fixed)

fix the symbolic csgn function on complex input

Reported by: burcin Owned by: burcin
Priority: major Milestone: sage-4.6
Component: symbolics Keywords: pynac
Cc: Merged in: sage-4.6.alpha3
Authors: Burcin Erocal Reviewers: Karl-Dieter Crisman
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:


Our wrapper of the csgn function from GiNaC (in sage/symbolic/expression.pyx) doesn't reflect it's real definition:

  /** Return the complex half-plane (left or right) in which the number lies.
   *  csgn(x)==0 for x==0, csgn(x)==1 for Re(x)>0 or Re(x)=0 and Im(x)>0,
   *  csgn(x)==-1 for Re(x)<0 or Re(x)=0 and Im(x)<0.
   *  */

Fix this and add doctests.

We should also consider using GiNaC's csgn() function for the top level sgn() and sign() functions. This should be on a different ticket though.

Attachments (2)

trac_9881-csgn.patch (1.3 KB) - added by burcin 9 years ago.
trac_9881-csgn-reviewer.patch (1.6 KB) - added by kcrisman 9 years ago.
Apply after initial patch.

Download all attachments as: .zip

Change History (7)

Changed 9 years ago by burcin

comment:1 follow-up: Changed 9 years ago by burcin

  • Authors set to Burcin Erocal
  • Status changed from new to needs_review

The new pynac package at #9201 changes the csgn() function according to the description. attachment:trac_9881-csgn.patch adds doctests for the new specification.

The pynac package includes patches for #9394, #9834, #9878, #9879, #9900 as well as this ticket. See the ticket description of #9901 for the list (and order) of patches associated to the new version.

comment:2 in reply to: ↑ 1 Changed 9 years ago by burcin

Replying to burcin:

The new pynac package at #9201 changes the csgn() function according to the description.

That should have been "at #9901".

comment:3 Changed 9 years ago by kcrisman

  • Reviewers set to Karl-Dieter Crisman

Just FYI - this appears to still apply cleanly after the review patch at #9879.

comment:4 Changed 9 years ago by kcrisman

  • Status changed from needs_review to positive_review

Okay, this looks good on both Pynac and Sage side - with the exception that I think the documentation needed slightly more clarity, and that some of the examples got misplaced to binomial for some reason. Positive review; apply reviewer patch after initial patch.

Changed 9 years ago by kcrisman

Apply after initial patch.

comment:5 Changed 9 years ago by mpatel

  • Merged in set to sage-4.6.alpha3
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.