When you enter 1/4, Python evaluates this as a float. That's why all your
expressions have floating point numbers. Use Rational(1, 4), or root(-1,
4). If you do that, then expand_complex() will give you the answer you
want. See also http://docs.sympy.org/latest/tutorial/gotchas.html.

Aaron Meurer

On Mon, Sep 5, 2016 at 7:51 PM, Richard Fateman <[email protected]> wrote:

> There are 4 values for (-1)^(1/4) and there are 2 values for sqrt(-I).
>
> the Maxima program has a command cabs()  that returns 1/2 for this
> expression.
> Figure out what cabs does, and you are set. :)
>
>
>
> On Sunday, September 4, 2016 at 9:16:31 AM UTC-7, bsdz wrote:
>>
>> Hi
>>
>> Can anyone recommend a way to simplify following expression?
>>
>> (-1)**(1/4)*sqrt(-I)/2
>>
>> I would like it to return 1/2 although various methods return different
>> equivalent expressions.
>>
>> i.e.
>>
>>    - sp.N(_) = 0.5 # note: I don't wish to evaluate it, here
>>    - sp.expand_complex(_) = 0.353553390593274*sqrt(2)
>>    - sp.simplify(_) = 0.353553390593274*sqrt(-I)*(1 + I)
>>    - sp.powsimp(_) = sqrt(-I)*(0.353553390593274 + 0.353553390593274*I)
>>
>> Thanks
>> Blair
>>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/sympy.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/sympy/6ea958be-131f-4f46-96b6-2d1c80ce5e9b%40googlegroups.com
> <https://groups.google.com/d/msgid/sympy/6ea958be-131f-4f46-96b6-2d1c80ce5e9b%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6K9KkMOS8sa137k0eZuwHWoE_-FHTgAAwgkrD5ebOmtJQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to