Ask Your Question
0

complex conjugate of a variable

asked 2012-04-15 05:00:58 -0500

d3banjan gravatar image

updated 2012-04-15 07:50:40 -0500

I attempted to construct the complex conjugate of a variable thus -

x = var('x')
f = x*conjugate(x)
f({x:2+2i})

this throws a SyntaxError, although the f({x:2}) case works perfectly.

edit retag flag offensive close merge delete

Comments

why isn't the markdown for code working?

d3banjan gravatar imaged3banjan ( 2012-04-15 05:01:40 -0500 )edit
1

Missing linebreak. There seemed to be HTML tags interspersed in your post for some reason. Incidentally, you can click on the "010101" button to select and format code instead of doing a manual indent.

DSM gravatar imageDSM ( 2012-04-15 06:11:57 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
3

answered 2012-04-15 06:14:54 -0500

DSM gravatar image

f({x:2+2i}) can never have worked: 2i isn't valid Sage. Either use *I or j, depending on where you want the result to live:

sage: 2+2i   
------------------------------------------------------------
   File "<ipython console>", line 1
     Integer(2)+2i
                 ^
SyntaxError: invalid syntax

sage: 2+2j
2.00000000000000 + 2.00000000000000*I
sage: parent(_)
Complex Field with 53 bits of precision
sage: 2+2*I    
2*I + 2
sage: parent(_)
Symbolic Ring
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2012-04-15 05:00:58 -0500

Seen: 796 times

Last updated: Apr 15 '12