Simplify expressions involving complex numbers

30 katselukertaa
Siirry ensimmäiseen lukemattomaan viestiin

Paul Royik

lukematon,
23.5.2023 klo 1.51.4623.5.2023
vastaanottaja sympy
How do I simplify the following expressions: i**(-2*i), (-i)**(-2*i), ((-sqrt(3) - i)/2)**(-2*i), ((sqrt(3) - i)/2)**(-2*i) ?

Is there any built-in function?

For example, i**(-2*i) should give e^pi and ((sqrt(3) - i)/2)**(-2*i) should give e^(-pi/3).


Thank you.

Oscar Benjamin

lukematon,
23.5.2023 klo 9.21.2923.5.2023
vastaanottaja sy...@googlegroups.com
The word "simplify" is ambiguous but I assume from your examples that
what you want is to rewrite powers as exponentials if possible. If so
that can be done with e.rewrite(exp):

>>> from sympy import *
>>> i = I
>>> a = i**(-2*i), (-i)**(-2*i), ((-sqrt(3) - i)/2)**(-2*i), ((sqrt(3) - i)/2)**(-2*i)
>>> [ai.rewrite(exp) for ai in a]
[exp(pi), exp(-pi), exp(-5*pi/3), exp(-pi/3)]

--
Oscar

Peter Stahlecker

lukematon,
23.5.2023 klo 11.21.4623.5.2023
vastaanottaja sy...@googlegroups.com
Your replies are the best way to learn more about sympy, thanks!!

--
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 sympy+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAHVvXxSjECmJoTVL6SJ27uzYrXHOWUiqKaMTK0gW6LfJXJrsfQ%40mail.gmail.com.
--
Best regards,

Peter Stahlecker

Paul Royik

lukematon,
23.5.2023 klo 14.56.2823.5.2023
vastaanottaja sympy
Thank you!

Aaron Meurer

lukematon,
23.5.2023 klo 15.26.2023.5.2023
vastaanottaja sy...@googlegroups.com
On Tue, May 23, 2023 at 7:21 AM Oscar Benjamin <oscar.j....@gmail.com> wrote:
On Tue, 23 May 2023 at 06:51, Paul Royik <distan...@gmail.com> wrote:
>
> How do I simplify the following expressions: i**(-2*i), (-i)**(-2*i), ((-sqrt(3) - i)/2)**(-2*i), ((sqrt(3) - i)/2)**(-2*i) ?
>
> Is there any built-in function?
>
> For example, i**(-2*i) should give e^pi and ((sqrt(3) - i)/2)**(-2*i) should give e^(-pi/3).

The word "simplify" is ambiguous but I assume from your examples that

In this case, there's a fairly unambiguous meaning for 'simplify'. The expressions are all real, so they should be reexpressed without using i.

Aaron Meurer

what you want is to rewrite powers as exponentials if possible. If so
that can be done with e.rewrite(exp):

>>> from sympy import *
>>> i = I
>>> a =  i**(-2*i), (-i)**(-2*i), ((-sqrt(3) - i)/2)**(-2*i), ((sqrt(3) - i)/2)**(-2*i)
>>> [ai.rewrite(exp) for ai in a]
[exp(pi), exp(-pi), exp(-5*pi/3), exp(-pi/3)]

--
Oscar

emanuel.c...@gmail.com

lukematon,
27.5.2023 klo 7.21.4727.5.2023
vastaanottaja sympy

Le mardi 23 mai 2023 à 21:26:20 UTC+2, asme…@gmail.com a écrit :

On Tue, May 23, 2023 at 7:21 AM Oscar Benjamin <oscar.j....@gmail.com> wrote:
On Tue, 23 May 2023 at 06:51, Paul Royik <distan...@gmail.com> wrote:
>
> How do I simplify the following expressions: i**(-2*i), (-i)**(-2*i), ((-sqrt(3) - i)/2)**(-2*i), ((sqrt(3) - i)/2)**(-2*i) ?
>
> Is there any built-in function?
>
> For example, i**(-2*i) should give e^pi and ((sqrt(3) - i)/2)**(-2*i) should give e^(-pi/3).

The word "simplify" is ambiguous but I assume from your examples that

In this case, there's a fairly unambiguous meaning for 'simplify'. The expressions are all real, so they should be reexpressed without using i.

Oh yeah ? Wait…

Vastaa kaikille
Vastaa kirjoittajalle
Välitä
0 uutta viestiä