Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

... by also changing the text after copy+paste of (the second) assume(A,'real') . Make it

assume( B, 'real' )

For my taste i would do (although explicitly is possibly better):

sage: for v in var( 'a,b,A,B' ):    assume( 'v', 'real' )

sage: equ = sqrt(a+b*I) == A + B*I
sage: equ1 = ( (equ.lhs()^2) == (equ.rhs()^2).expand() )

sage: show(equ1)
....: show(equ1.lhs().real_part().expand())
....: show(equ1.rhs().real_part().expand())
....: 
\newcommand{\Bold}[1]{\mathbf{#1}}a + i \, b = A^{2} + 2 i \, A B - B^{2}
\newcommand{\Bold}[1]{\mathbf{#1}}a
\newcommand{\Bold}[1]{\mathbf{#1}}A^{2} - B^{2}

... by also changing the text after copy+paste of (the second) assume(A,'real') . Make it

assume( B, 'real' )

For my taste i would do (although explicitly is possibly better):

sage: for v in var( 'a,b,A,B' ):    assume( 'v', v, 'real' )

sage: equ = sqrt(a+b*I) == A + B*I
sage: equ1 = ( (equ.lhs()^2) == (equ.rhs()^2).expand() )

sage: show(equ1)
....: show(equ1.lhs().real_part().expand())
....: show(equ1.rhs().real_part().expand())
....: 
\newcommand{\Bold}[1]{\mathbf{#1}}a + i \, b = A^{2} + 2 i \, A B - B^{2}
\newcommand{\Bold}[1]{\mathbf{#1}}a
\newcommand{\Bold}[1]{\mathbf{#1}}A^{2} - B^{2}