0

Why is in Matlab

$$ e^{\pi\cdot\frac{\sqrt{163}}{3}} - 640320 = -2.3283 * 10^{-10} $$

exp(pi * sqrt(163)/3) - 640320
ans =-2.3283e-10 

I know that it does have something to do with IEEE754, but I can't figure exactly out why.

exp(pi*sqrt(163)/3) = 640320, 

so the result should be 0.

Can anyone explain?

Nord
  • 11
  • The correct value is by the way $$6.04863735049016039471741818818539475771485760366591819465222 E-10$$ – Peter Jul 08 '23 at 21:55
  • 1
    without the "/3" it has something to do with the Heegner-numbers , no idea why it is an almost integer also with this division. – Peter Jul 08 '23 at 21:56
  • @Peter, the result term exp(pi*sqrt(163)/3) is 640320, so the result should actually be 0. Sorry if it was unclear, I edited my quesiton. – Nord Jul 08 '23 at 22:02
  • 1
    Why do you think that the expression is exactly an integer ? This is not the case. It is an almost-integer , very near to an integer , but not an integer. Maybe you computed it with a calculator with insufficient accuracy, – Peter Jul 08 '23 at 22:05
  • 3
    $$e^{\pi\cdot \frac{\sqrt{163}}{3}}\simeq 640320.000000000604863735049036$$ – gpmath Jul 08 '23 at 22:07
  • $e^{\pi \sqrt{163}}$ is Ramanujan's constant – Claude Leibovici Jul 09 '23 at 06:36

1 Answers1

6

First, that expression is not an integer, but very close to an integer $640320$. In fact, as @Peter mentioned, this is related to some deep theory of modular $j$-functions and Heegner numbers, e.g. see Wikipedia and this MSE question. Anyway, the main reason is that we have

$$ e^{\pi \sqrt{163}} \approx 640320^3 + 744 $$

with an error $< 10^{-12}$, so

$$ e^{\frac{\pi\sqrt{163}}{3}} \approx (640320^3 + 744)^{1/3} = 640320 \cdot \left(1 + \frac{744}{640320^3}\right)^{1/3} \approx 644320 $$

where the last approximation is due to

$$ \left(1 + \frac{744}{640320^3}\right)^{1/3} \approx (1 + 3 \cdot 10^{-15})^{1/3} \approx 1 + 10^{-15}. $$

Seewoo Lee
  • 15,137
  • 2
  • 19
  • 49