Opened 10 years ago
Closed 10 years ago
#9913 closed defect (fixed)
n() returns symbolic expression
Reported by: | zimmerma | Owned by: | burcin |
---|---|---|---|
Priority: | critical | Milestone: | sage-4.6.1 |
Component: | symbolics | Keywords: | |
Cc: | cwitty | Merged in: | sage-4.6.1.alpha0 |
Authors: | Burcin Erocal | Reviewers: | Paul Zimmermann |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
from sage-support: http://groups.google.com/group/sage-support/browse_thread/thread/b36c90f1490eac19#
sage: a=(sqrt(4*(sqrt(3) - 5)*(sqrt(3) + 5) + 48) + 4*sqrt(3))/ (sqrt(3) + 5) sage: a.imag().n() 0.939469338708203*sin(0.500000000000000*pi)
Attachments (1)
Change History (10)
comment:1 Changed 10 years ago by
comment:2 Changed 10 years ago by
- Cc cwitty added
Note also the strange tty output (look in the 2nd argument of arctan2
):
sage: a=(sqrt(4*(sqrt(3) - 5)*(sqrt(3) + 5) + 48) + 4*sqrt(3))/ (sqrt(3) + 5) sage: a.imag() sin(1/2*arctan2(0, -88* + 48))*sqrt(abs(4*(sqrt(3) - 5)*(sqrt(3) + 5) + 48))/(sqrt(3) + 5)
Should I open a separate ticket for that? Paul
comment:3 Changed 10 years ago by
- Component changed from basic arithmetic to symbolics
- Owner changed from AlexGhitza to burcin
I'm changing the component to symbolics
, since this is probably a bug in pynac.
Regarding the problem with the output Carl mentions in comment:2: This is also present in GiNaC, but the printing is better:
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. > a=(sqrt(4*(sqrt(3) - 5)*(sqrt(3) + 5) + 48) + 4*sqrt(3))/ (sqrt(3) + 5); (sqrt(48+4*(5+sqrt(3))*(-5+sqrt(3)))+4*sqrt(3))*(5+sqrt(3))^(-1) > imag_part(a); (5+sqrt(3))^(-1)*sqrt(abs(48+4*(5+sqrt(3))*(-5+sqrt(3))))*sin(1/2*atan2(0,48+4*(-22)))
Note the term 4*(-22)
at the end of the last line.
We should open a new ticket for this and report it on the GiNaC list. I'm not sure if this has anything to do with this ticket ATM. Numeric evaluation seems to work fine in GiNaC:
> evalf(imag_part(a)); 0.9394693387082032295
comment:4 follow-up: ↓ 5 Changed 10 years ago by
Burcin,
We should open a new ticket for this and report it on the GiNaC list.
I've reported a new ticket (#9947). I let you report it on the GiNaC list.
Paul
comment:5 in reply to: ↑ 4 Changed 10 years ago by
- Keywords pynac added
Replying to zimmerma:
Burcin,
We should open a new ticket for this and report it on the GiNaC list.
I've reported a new ticket (#9947). I let you report it on the GiNaC list.
This issue was fixed upstream by Richard Kreckel.
While the fix makes the original example on this ticket work, Jason's example from comment:1 or the one reported by Tian Wei on sage-support (below) still don't work.
sage: b = sqrt(-log(2)) sage: print b.imag().n() 0.832554611157698*sin(0.500000000000000*pi)
Changed 10 years ago by
comment:6 Changed 10 years ago by
- Keywords pynac removed
- Status changed from new to needs_review
I uploaded a patch to fix this. The problem wasn't in pynac after all, it was the numeric approximation function for arctan2()
.
comment:7 Changed 10 years ago by
- Reviewers set to Paul Zimmermann
- Status changed from needs_review to positive_review
positive review, good work Burcin!
Paul
comment:8 Changed 10 years ago by
- Milestone changed from sage-4.6 to sage-4.6.1
comment:9 Changed 10 years ago by
- Merged in set to sage-4.6.1.alpha0
- Resolution set to fixed
- Status changed from positive_review to closed
Even simpler: