Ask Your Question
0

complex conjugate of a variable

asked 13 years ago

d3banjan gravatar image

updated 13 years ago

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.

Preview: (hide)

Comments

why isn't the markdown for code working?

d3banjan gravatar imaged3banjan ( 13 years ago )
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 ( 13 years ago )

1 Answer

Sort by » oldest newest most voted
3

answered 13 years ago

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
Preview: (hide)
link

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: 13 years ago

Seen: 4,042 times

Last updated: Apr 15 '12