0
$\begingroup$

I would like to note before hand I am trying to improve my math by making a calculator application.

Anyways, let's say I would like to compute $2^{2.534}$.

Beforehand, I know that:

  1. $$a^x=e^{xln(a)}$$

I already have a working algorithm on finding $ln(a)$, but ultimately in the end this still gives me a rational number and without actually knowing how to compute it, I arrive to my original problem again.

At this point, I figure I can store a table of already computed values for $e^{x}$, and then just interpolate values? However, I feel that my accuracy would greatly depend on how many values I store and it makes me come to hte question of how did anyone create these tables in the first place?

$\endgroup$
  • 1
    $\begingroup$ you can break $2^{2.534}$ as $2^2 * 2^\frac{5}{10}* 2^\frac{3}{100}..$ $\endgroup$ – Raghukul Raman Oct 7 '17 at 17:43
  • $\begingroup$ @RaghukulRaman Let's assume in place of $2.534$, I had an irrational number such as $√2$. What would I do then? $\endgroup$ – user382540 Oct 7 '17 at 17:46
  • $\begingroup$ you can only find an approximate answer, due to limitations of memory and computations,btw $\sqrt 2 $ can also be computed $\endgroup$ – Raghukul Raman Oct 7 '17 at 17:49
1
$\begingroup$

The logarithm and trigonometric tables were tools I still used in the early 70s when I attended high school and calculators were too expensive ans/or not allowed in classroom. The mathematicians of precomputer era calculated tables by hand. They had polynomial expansion like Taylor or MacLaurin formulae.

Logarithm standard formula

$$\log(1+x)=x-x^2/2+x^3/3-x^4/4+x^5/5-x^6/6+x^7/7-x^8/8+\ldots$$

is too slow, and soon were invented accelerated methods for alternating series like this.

Essentially the calculation were done by hand

Example. For small $x$

$\sin x\approx x-\frac{x^3}{6}+\frac{x^5}{120}$

Try $x=0.15$

$\sin 0.15 \approx 0.15 -\frac{0.15^3}{6}+\frac{0.15}{120}=\frac{3}{20}-\frac{27}{8000}+\frac{243}{3200000}= \color{red}{0.149438132}8125$

My calculator gives $\color{red}{0.149438132}4736$

Impressive, isn't it? Only three terms, such a precision... but caution if we look for values "far" from zero, like $x=2$ we get a bad result

$\sin 2\approx 2-8/3+32/120\approx 0.93$

while $\sin 1\approx 0.909297$

Hope this can be useful

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ Could you explain how I could compute $e^x$ where $0<x<1$? $\endgroup$ – user382540 Oct 7 '17 at 22:11
  • $\begingroup$ Use $$e^x\approx 1+x+x^2/2+x^3/6+x^4/24$$ If you want more precision just add $x^5/5!+x^6/6!\ldots$. Anyway with $5$ terms you get $3$ exact decimals $\endgroup$ – Raffaele Oct 8 '17 at 9:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.