On 6/11/07, Joshua Kantor <[EMAIL PROTECTED]> wrote:
> I noticed that dealing with complex numbers doesn't work as well as I
> would expect. Simple example, how do you get  sage/maxima to perform
> complex division
>
> sage: 1/(1+I)
>
> output 1/(1+I)
>
> I couldn't find any way to simplify other than CC(1/(1+I)) which
> probably isn't want you want.
>
> also
>
> It doesn't appear possible to expand complex exponentials into sines
> and cosines.
>
> For example
>
> sage: e^(I/2) + e^(-I/2)
>
> won't be simplified to a trig function
>
> The maxima simplification command to do this has the obtuse name
> demoivre.

In both cases getting the real and imaginary parts gives what you want.
We could  easily add a simplify_complex() method that simply computes
    obj.real() + I*obj.imag().

sage: x = 1/(1+i)
sage: x.real() + i * x.imag()
1/2 - (I/2)
sage: x = e^(i/2) + e^(-i/2)
sage: x.real() + i * x.imag()
2*cos(1/2)

-- William

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to