0

I wonder how can calculators or Wolfram evaluate such expressions as $2^{1.35}$ or $3^\pi$.

Do they use Taylor series for $2^x$ and $3^x$ or do they employ other means?

WW1
  • 10,497
  • Why are you interested in this question? (Answering that will help us help you.) – David G. Stork Aug 10 '18 at 22:14
  • Because it is not something you are taught in school. There are many elementary operations that are not taught well in high schools or in colleges, such as extracting square root. – James Warthington Aug 10 '18 at 22:19

2 Answers2

4

They likely evaluate $2^x=e^{x\ln(2)}$. For $e^x$ most use a rational approximation of $e^x$ and for the $\ln(2)$ they compute the $\ln$ using either a tabular approach (pre-computed values combined with the property $\ln(xy)=\ln(x)+\ln(y)$) or also a rational approximation, depends on the implementation.

0

If you have an implementation of the square root extraction you also have an implementation of the exponentiation. For instance $$ 3^\pi \approx 3^{11.0010010001\phantom{}_2}=3^3\sqrt{\sqrt{\sqrt{3\sqrt{\sqrt{\sqrt{3\sqrt{\sqrt{\sqrt{\sqrt{3}}}}}}}}}}$$ and there are several efficient implementations of the square root extraction.
This just follows from the definition of $3^x$, for any $x\in\mathbb{R}^+\setminus\mathbb{Q}$, as the limit of $3^{q_n}$ where $\{q_n\}$ is any sequence of dyadic rationals convergent to $x$.

To minimize the number of elementary operations involved is actually a pretty difficult problem, involving addition chains and addition-subtraction chains. Since modern CPUs are able to perform gazillions of op/s and an incredibly optimized implementation is able to outperform a naive one just by a factor of $\approx 2$, addition(-subtraction) chains ceased to be a research topic from quite some time, but they still are pretty interesting to study, at least IMHO.

Jack D'Aurizio
  • 353,855