Opened 10 years ago
Closed 9 years ago
#11668 closed defect (fixed)
abs(a+b)^2 == (a+b)^2
Reported by: | jan | Owned by: | burcin |
---|---|---|---|
Priority: | major | Milestone: | sage-5.11 |
Component: | symbolics | Keywords: | maxima abs |
Cc: | kcrisman, mjo | Merged in: | sage-5.11.beta3 |
Authors: | Karl-Dieter Crisman | Reviewers: | Michael Orlitzky |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
sage: version() 'Sage Version 4.7, Release Date: 2011-05-23' sage: var('a b', domain='real'); sage: A = abs((a+i*b))^2 sage: A abs(a + I*b)^2 sage: imag(A) 0 sage: A.simplify_full() a^2 + 2*I*a*b - b^2 sage: imag(A.simplify_full()) 2*a*b
The last result is clearly wrong. abs() is real by definition. simplify_full() doesn't handle abs() correctly.
Demo Notebook: http://demo.sagenb.org/home/pub/181/
Attachments (1)
Change History (9)
comment:1 Changed 10 years ago by
- Component changed from sage-mode to symbolics
- Owner changed from ncalexan to burcin
comment:2 Changed 10 years ago by
- Cc kcrisman added
comment:3 Changed 9 years ago by
comment:4 Changed 9 years ago by
- Cc mjo added
- Status changed from new to needs_review
comment:5 Changed 9 years ago by
Two minor things, can you use a,b = SR.var('a,b')
to create the variables? That will eliminate one line of unrelated output. And just a style preference, since sage outputs the complex unit as I
, I think it's a tiny bit more consistent to use that for input as well, but I'll take it either way.
comment:6 Changed 9 years ago by
Two minor things
Sure, no problem. I put the i
instead of I
just because I copied from the original example in the ticket, but that is unimportant. Thanks!
comment:7 Changed 9 years ago by
- Reviewers set to Michael Orlitzky
- Status changed from needs_review to positive_review
comment:8 Changed 9 years ago by
- Merged in set to sage-5.11.beta3
- Resolution set to fixed
- Status changed from positive_review to closed
The exact place is
This is how
radcan
in Maxima does this over the real domain, whichsimplify_radical
temporarily makes us in.I'm not sure what the best thing to do here is. Two ideas:
domain:complex
in Maxima, sort of missing the point ofsimplify_radical
\sqrt{x^2}\neq x
but sometimes it's useful to simplify it that way.)I do not think we pass the domain information from the (Pynac) variables in any case, or if that would be very easy to do.