Opened 14 years ago

Closed 13 years ago

#6159 closed defect (fixed)

[with patch, positive review] Implement real_part for CDF and CC

Reported by: Jason Grout Owned by: Alex Ghitza
Priority: major Milestone: sage-4.1.1
Component: basic arithmetic Keywords:
Cc: Merged in: sage-4.1.1.alpha0
Authors: Alex Ghitza Reviewers: Burcin Erocal
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

sage: CC(I).real_part()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)

/home/jason/.sage/temp/littleone/9440/_home_jason__sage_init_sage_0.py in <module>()

AttributeError: 'sage.rings.complex_number.ComplexNumber' object has no attribute 'real_part'


sage: CDF(I).real_part()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)

/home/jason/.sage/temp/littleone/9440/_home_jason__sage_init_sage_0.py in <module>()

AttributeError: 'sage.rings.complex_double.ComplexDoubleElement' object has no attribute 'real_part'

but

sage: (3+I).real_part()
3

Attachments (1)

trac_6159.patch (2.3 KB) - added by Alex Ghitza 13 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 13 years ago by Alex Ghitza

Authors: Alex Ghitza
Summary: Implement real_part for CDF and CC[with patch, needs review] Implement real_part for CDF and CC

Done in the attached patch. I even threw in imag_part() for free.

Changed 13 years ago by Alex Ghitza

Attachment: trac_6159.patch added

comment:2 Changed 13 years ago by Alex Ghitza

Owner: changed from somebody to Alex Ghitza
Status: newassigned

comment:3 Changed 13 years ago by Burcin Erocal

Reviewers: Burcin Erocal
Summary: [with patch, needs review] Implement real_part for CDF and CC[with patch, positive review] Implement real_part for CDF and CC

Looks good.

comment:4 Changed 13 years ago by Minh Van Nguyen

Merged in: sage-4.1.1.alpha0

After a first merge of the patch trac_6159.patch and running full doctests on the Sage library, I got this failure:

sage -t -long devel/sage-exp/sage/modules/vector_double_dense.pyx
**********************************************************************
File "/scratch/mvngu/release/sage-4.1.1.alpha0/devel/sage-exp/sage/modules/vector_double_dense.pyx", line 656:
    sage: v.stats_kurtosis()
Expected:
    -1.23
Got:
    doctest:106: SyntaxWarning: assertion is always true, perhaps remove parentheses?
    -1.23
**********************************************************************
1 items had failures:
   1 of   6 in __main__.example_29
***Test Failed*** 1 failures.
For whitespace errors, see the file /scratch/mvngu/release/sage-4.1.1.alpha0/tmp/.doctest_vector_double_dense.py
	 [2.6 s]

I then unmerged that patch, and all doctests passed. As another attempt, I merged trac_6159.patch a second time, ran all doctests in the Sage library, and they passed.

comment:5 Changed 13 years ago by Minh Van Nguyen

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.