First time here? Check out the FAQ!

Ask Your Question
0

how to use variables (`var`)

asked 11 years ago

updated 11 years ago

I thought they are complex by default. But even when I try to force the domain to be complex, I always get x.conjugate().simplify() == x. Why? See also below:

sage: t1,t2,t4 = var("t1 t2 t4")
sage: t2.conjugate().simplify()
t2
sage: t1,t2,t4 = var("t1 t2 t4", domain="complex")
sage: t2
t2
sage: t2.is_real()
False
sage: t2.conjugate().simplify()
t2
sage: (t2.real()*2 - t2).simplify()
t2
sage: t2.real().simplify()
t2
sage: t2.imag().simplify()
0
Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 11 years ago

tmonteil gravatar image

updated 11 years ago

This is a known issue, see for example trac ticket 6862, and ask question 2287.

What you can do is to use the assume function, as in the following:

sage: t1,t2,t4 = var("t1 t2 t4")
sage: assume(t2,'complex')
sage: t2.conjugate().simplify()
conjugate(t2)
sage: t2.real().simplify()
realpart(t2)
sage: t2.imag().simplify()
imagpart(t2)
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

Stats

Asked: 11 years ago

Seen: 856 times

Last updated: Jun 10 '13