# Calculating Non-Integer Exponent

I just wanted to directly calculate the value of the number $2^{3.1}$ as I was wondering how a computer would do it. I've done some higher mathematics, but I'm very unsure of what I would do to solve this algorithmically, without a simple trial and error.

I noted that

$$2^{3.1} = 2^{3} \times 2^{0.1}$$

So I've simplified the problem to an "integer part" (which is easy enough) : $2^3 = 2\times 2\times 2$, but I'm still very confused about the "decimal part". I also know that :

$$2^{0.1} = e^{2\log{0.1}}$$

But that still presents a similar problem, because you'd need to calculate another non-integer exponent for the natural exponential. As far as I can see, the only way to do this is to let:

$$2^{0.1}=a$$

And then trial and error with some brute force approach (adjusting my guess for a as I go). Even Newton's method didn't seem to give me anything meaningful. Does anybody have any idea how we could calculate this with some working algorithm?

-
And by a simple trial and error, I mean: how would I solve this without just using a calculator to refine to more and more decimal places. – user2662833 Aug 8 '13 at 2:56
In short, you'll have to use a calculator for the general case--computing numeric results for $\log x$ involves either infinite series or numeric integration. (By general case, I mean that there will be exceptions, like $4^{3.5} = 8$ is easy to do without a calculator, but you can't do that in general). – apnorton Aug 8 '13 at 2:58
$2^{0.1} = e^{0.1\log 2}$ - you got the $2$ and $0.1$ backwards. – Thomas Andrews Aug 8 '13 at 3:16
Yes, you're right. I did get that backwards. That was a mistake I'm afraid :( However, I'm thinking of it from a more algorithmic standpoint. How does a calculator actually calculate a logarithm? – user2662833 Aug 8 '13 at 12:55

## 3 Answers

$$2^{3.2} = 2^3 2^{0.1} = 2^3 e^{0.1 \log{2}}$$

Now use a Taylor expansion, so that the above is approximately

$$2^3 \left [1+0.1 \log{2} + \frac{1}{2!} (0.1 \log{2})^2 + \frac{1}{3!} (0.1 \log{2})^3+\cdots + \frac{1}{n!} (0.1 \log{2})^n\right ]$$

wheer $n$ depends on the tolerance you require. In this case, if this error tolerance is $\epsilon$, then we want

$$\frac{1}{(n+1)!} (0.1 \log{2})^{n+1} \lt \epsilon$$

For example, if $\epsilon=5 \cdot 10^{-7}$, then $n=4$.

-
Tis a very good idea. That was actually how I solved this :) I just wrote a Small java program to do it using nothing but basic arithmetic. I'd be happy to post it if any body is interested – user2662833 Aug 10 '13 at 15:26

Trial and error is how a finance calculator will solve for interest in a present value calculation.

If a log function is solved quickly, it's possible to be a lookup table, or trial/error with a fast processor.

Try creating a spreadsheet, where ten consecutive cells each represent a single digit, from the whole number to nine beyond the decimal. If a^10=2 it would stand to reason to start with 1.0xxxx and I'd say that on a bet you can guess the next digit in a couple seconds.

You started by not wanting trial and error, but then gave into it toward the end of the question.

-

3.1 = 31/10

$2^{3.1}$ = 10th root of $2^{31}$ or $2^{31/10}$.

Adapted Newton's approximation to find the 10th root of a number $x$, it goes as follows.

Start off with some initial guess $y$ for the answer.

1. $y$ is your current guess (say, 8)
2. A better estimate is $$y - \frac{y^{10} - x}{10 y^9}$$ (which, in this case, gives 8.8)
3. Repeat until it is accurate enough.
-