(abs(a+b)^2).full_simplify() not real

289 days ago by jan

var('a b', domain='real') A = abs((a+i*b))^2 pretty_print(A) print imag(A) 
       
\newcommand{\Bold}[1]{\mathbf{#1}}{\left| a + i \, b \right|}^{2}
0
\newcommand{\Bold}[1]{\mathbf{#1}}{\left| a + i \, b \right|}^{2}
0
As = A.full_simplify() pretty_print(As) print imag(As) 
       
\newcommand{\Bold}[1]{\mathbf{#1}}a^{2} + 2 i \, a b - b^{2}
2*a*b
\newcommand{\Bold}[1]{\mathbf{#1}}a^{2} + 2 i \, a b - b^{2}
2*a*b
B = (a + i*b)*(a + i*b).conjugate() pretty_print(B) print real(B) print imag(B) 
       
\newcommand{\Bold}[1]{\mathbf{#1}}{\left(a - i \, b\right)} {\left(a + i \, b\right)}
a^2 + b^2
0
\newcommand{\Bold}[1]{\mathbf{#1}}{\left(a - i \, b\right)} {\left(a + i \, b\right)}
a^2 + b^2
0
Bs = B.full_simplify() pretty_print(Bs) print real(Bs) print imag(Bs) 
       
\newcommand{\Bold}[1]{\mathbf{#1}}a^{2} + b^{2}
a^2 + b^2
0
\newcommand{\Bold}[1]{\mathbf{#1}}a^{2} + b^{2}
a^2 + b^2
0
abs? 
       

Type: <type 'builtin_function_or_method'>

Definition: abs( [noargspec] )

Docstring:


abs(number) -> number

Return the absolute value of the argument.

Type: <type 'builtin_function_or_method'>

Definition: abs( [noargspec] )

Docstring:


abs(number) -> number

Return the absolute value of the argument.
var('c', domain='complex') imag(abs(c)^2) 
       
0
0
var('c d', domain='complex') 
       
(c, d)
(c, d)
abs(c+d)^2 == (c+d)^2 
       
abs(c + d)^2 == (c + d)^2
abs(c + d)^2 == (c + d)^2
(abs(c+d)^2 == (c+d)^2).simplify_full() 
       
c^2 + 2*c*d + d^2 == c^2 + 2*c*d + d^2
c^2 + 2*c*d + d^2 == c^2 + 2*c*d + d^2
bool((abs(c+d)^2 == (c+d)^2).simplify_full()) 
       
True
True
assume(c, 'complex') 
       
bool((abs(c+d)^2 == (c+d)^2).simplify_full()) 
       
True
True
(abs(c+d)^2).simplify_full() 
       
c^2 + 2*c*d + d^2
c^2 + 2*c*d + d^2