Ask Your Question
0

complex conjugate of a variable

asked 2012-04-15 12:00:58 +0200

d3banjan gravatar image

updated 2012-04-15 14:50:40 +0200

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 12:01:40 +0200 )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 13:11:57 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2012-04-15 13:14:54 +0200

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 12:00:58 +0200

Seen: 3,549 times

Last updated: Apr 15 '12