Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't SymPy evaluate i^i?

I tried to evaluate the following in Python 3.8.2 using SymPy 1.5.1.

from sympy import *
a = I**I
print(a)

This returns:

I**I

Googling I**I and it gives exp(-pi/2) which is 0.2079. Does SymPy simply not know how to compute this? Or is there something I am missing?

like image 800
LightninBolt74 Avatar asked Oct 28 '25 13:10

LightninBolt74


1 Answers

You can rewrite in exponential form if you want:

In [12]: I**I                                                                                                                     
Out[12]: 
 ⅈ
ⅈ 

In [13]: (I**I).rewrite(exp)                                                                                                      
Out[13]: 
 -π 
 ───
  2 
ℯ 

You can also evaluate the result in floating point:

In [14]: (I**I).n()                                                                                                               
Out[14]: 0.207879576350762
like image 138
Oscar Benjamin Avatar answered Oct 31 '25 05:10

Oscar Benjamin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!