0

WolframAlpha gives me $\int_{-1}^0 x^x dx≈0.901786350437...$

I figure for every odd fraction, the number is negative. For every even fraction, the number is complex. But that's just for rational numbers, which by themselves would (if I understand Lebesgue) sum to zero. I have no idea how to treat negative exponents of negative numbers when both numbers are irrational.

Interestingly, WolframAlpha and others first seem to calculate an approximation, which gives around $\int_{-1}^0 x^x dx = 0.0444232 - 0.857363 i$

This suggest to me that this is a numerical approximation, but in the end WolframAlpha finds an exact solution where the complex part has cancelled out.

Any help as how to tackle this problem would be appreciated.

  • 6
    A more fundamental question is what the expression $x^x$ means for $x\in[-1,0]$. –  Jun 01 '22 at 15:45
  • 1
    Probably Alpha is using the formula $x^x = \exp(x \ln x) = \exp(x (\ln |x| + \pi i))$ for $x$ real and negative, but note that function doesn't match what you say about $x^x$ for rational inputs - for example, it says $(-1/3)^{-1/3}$ is not real. – aschepler Jun 01 '22 at 16:02
  • 2
    Actually $\int_{-1}^0 \exp(x(\ln|x| + \pi i)), dx$ is the $0.044-0.857 i$ value. I have no idea where the $0.902$ value comes from. – aschepler Jun 01 '22 at 16:13

1 Answers1

1

I have no idea how to treat negative exponents of negative numbers when both numbers are irrational.

In general, $x^y = \exp(y \ln x)$, where $\exp(x) = \sum_{n=0}^\infty \frac{x^n}{n!}$.

For complex numbers, $\exp(x + iy) = e^x(\cos y + i \sin y)$, per Euler's Formula. So, if you have a complex number expressed in polar form $z = r (\cos \theta + i \sin \theta)$, then $\ln z = \ln r + i\theta$. If $z$ is a negative real number, then $r = |z| = -z$, and $\theta$ can be any odd multiple of $\pi$.

So, for real $x < 0$, $x^x = \exp(x (\ln |x| + i\pi(2k+1)))$ for some integer $k$.

AFAIK, the antiderivative of this thing is not an elementary function, but let's approximate it numerically.

from cmath import *

def f(x, k): return exp(x * (log(abs(x)) + 1j * pi * (2 * k + 1)))

def approx_integral(k, n): # Integrate f on [-1, 0] in n equal subintervals using the Midpoint Rule s = 0 for i in range(n): m = -1 + (i + 0.5) / n s += f(m, k) return s / n

Using 1 million sub-intervals for various choices of $k$ gives:

  • $k = -4 \rightarrow -0.0040993104699921885 + 0.0938832734634674i$
  • $k = -3 \rightarrow -0.006937570496007115 + 0.1332016994940697i$
  • $k = -2 \rightarrow -0.014598635327415115 + 0.22985540622507397i$
  • $k = -1 \rightarrow 0.04442317879344657 + 0.8573631716446783i$
  • $k = 0 \rightarrow 0.04442317879344657 - 0.8573631716446783i$
  • $k = 1 \rightarrow -0.014598635327415115 - 0.22985540622507397i$
  • $k = 2 \rightarrow -0.006937570496007115 - 0.1332016994940697i$
  • $k = 3 \rightarrow -0.0040993104699921885 - 0.0938832734634674i$
  • $k = 4 \rightarrow -0.002738121519781084 - 0.07250289245728589i$

So, WolframAlpha appears to be using a numerical approximation with $k = 0$, i.e., it defines $\ln(-x) = \ln |x| + i\pi$.

Dan
  • 14,978
  • 1
    I like your approach (not sure why you got downvoted, wasn't me). This pretty much gives me everything to handle irrational exponents of negative numbers. Also, for negative odd fractions, like (-1/3), that formula gives me the cubic root of 3, as expected. But for even fraction, like (-1/2), with k=0, now I get $-\sqrt(2)$, rather than $\sqrt{2}i$ which I would expect. Did I make some trivial mistake? – Andy Chow Jun 01 '22 at 19:49