Platinum Partner
architects,bigdata,google,statistics,tool,tips and tricks,tools & methods,r,wolfram alpha

Rationality, and MS Excel (and Other Calculators)

This morning, Mathieu had a nice experience in his course on computational method in actuarial science. But let us start with some mathematical formal definitions.

First, recall that^x is – somehow – a standard expression. No one should be surprised to see such an expression. Generally (as explained in… ), this function is defined only when\in\mathbb{R}_+. The idea is that the definition of^x is that^x%20=%20\exp\left(x\log[y>\right)

And it is a definition. Such a function exists only if\in\mathbb{R}_+ (maybe excluding This would be a standard definition in real-analysis.

Now, this ‘power’ function appears also in complex analysis, when dealing with unit roots. From instance, if^{\frac{1}{k}}e^{i%20\frac{2n\pi}{k}}, where\in\mathbb{R}_+ and\in\mathbb{N}_\star, for some\in\mathbb{N}, then^k=y. Thus, in complex-analysis it might be more complex to define properly^x since it might not be unique. But we can relate (sometimes, when is the inverse of an integer, or maybe a rational number ?) with roots of polynomial functions. So far, nothing new…

Let us get back to Mathieu’s problem. Actually, in his course, he wanted to compute^{\frac{1}{3}}. With a French version of Excel, entering

you do get If you look at the ‘help’ window, you have some more details

It looks like this hat function can be used to define objects such as^x. But with

you get

(meaning that this is a problem…). It is also possible to use the power (puissance in French) function of Excel,

Here, you also get

The weird part here is that, in the ‘help’ window, you can read that this power function can be used with any number in\mathbb{R}.

Another point… what about  ? Somehow, it is just the square of the previous one (with the fraction)… Here, typing

you get

(similarly with the power function). So clearly, it is not that simple to use this power function. Now, if you use Google (which is now my new online calculator when I am in class, when I cannot use R), if the power is a fraction (or to be more specific the inverse of an integer), then it works as Excel


you get

 But if you type (which should be close, from a continuity property of the power function)


you get

and similarly

On Wolfram Mathworld, enter

Mathematica does recognize that we try to deal with unit roots: the result is here

with – as expected – a numerical approximation

With Matlab, Mathieu did obtain the same as Mathematica (its decimal approximation). And to conclude, with R, Mathieu did obtain

> (-8)^(1/3)
[1] NaN
> (-8)^(.333333333333333)
[1] NaN

So for R, you cannot use this hat function on negative numbers.

Now, how can we interpret those outputs ?

1) My understanding is that clearly, with MS Excel,^{ab}\neq%20\left(x^a\right)^bsince^{\frac{2}{3}}\neq%20\left((-8)^{\frac{1}{3}}\right)^2

which is problematic. For instance, in insurance, with monthly discounts, we do have functions like^{\frac{k}{12}}. What if^{\frac{k}{12}}\neq%20\left(u^{\frac{1}{12}}\right)^k

2) The problem comes – probably (MS Excel is not an open software, so it might be hard to check) -  from the fact that^{\frac{1}{n}} is interpreted as an inverse of a (possibly) bijective function. To be more specific,^{\frac{1}{n}}means that^n=y. When is an odd integer, then (in real-analysis) there is a unique inverse, and thus,^{\frac{1}{n}} is uniquely defined, since\mapsto%20x^n is a bijective\mathbb{R}\rightarrow\mathbb{R} function. This is what MS Excel (and Google) is doing:\mapsto%20x^3 is a bijective\mathbb{R}\rightarrow\mathbb{R} function, so^{\frac{1}{3}} means that we need to find theunique (real) value such that^3=-8. Thus, somehow, it makes sense to return

3) There is still a problem with Google, and Mathematica. That is fine to return unit roots in\mathbb{C}. But how comes there is only one value ? I mean, yes\sqrt{3}%20\%20i is a possible answer, since\sqrt{3}%20\%20i)^3=-8

but one can also observe that , and similarly,^3=-8 and\sqrt{3}%20\%20i)^3=-8

One can check with

With R, since we do not deal with power function here, but with roots, if we want to find such that^3=-8, the function is

> polyroot(c(8,0,0,1))
[1]  1+1.732051i -2+0.000000i  1-1.732051i

Which is different… Weird isn’t it ?

Published at DZone with permission of {{ articles[0].authors[0].realName }}, DZone MVB. (source)

Opinions expressed by DZone contributors are their own.

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ }}
{{ parent.authors[0].realName ||}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks