0
$\begingroup$

In evaluation of limits , there's a critical point c at which the output becomes indeterminate, like 0/0 etc. Now I came across some weird examples where when I tried putting values close to that critical value, but I got output different from the answer analytical evaluation gave me.

Example 1: $$f(x)=\frac{\sin\left(\pi {\left(\cos\left(x\right)\right)}^{2}\right)}{{x}^{2}}$$ In this function if we take limit as x-->0 then we should get π. But I tried putting values close to zero in desmos: enter image description here

Everything goes fine till 10^-5 but after that values start getting deflected from π and after that the value goes to ZERO!!

Example 2: $$f(x)=(\frac{1-5{x}^{2}}{1-3{x}^{2}}{)}^{\frac{1}{{x}^{2}}}$$ In this example if we take limit as x-->0 I should get e^2 which is approx 7.38905609893. But this is what happened in desmos:

enter image description here

At x=10^-7 , the output suddenly became more INACCURATE and more inaccurate at 10^-8 and then goes straight to ONE!!

Main question: Why are the output values different from the expected answer from analytical method and more importantly why are they following this ambiguous pattern?

$\endgroup$
2
  • 3
    $\begingroup$ Probably the same reason as here math.stackexchange.com/a/3267889/272494 If you want more precision, you should use something like Wolfram Alpha or Matlab or else. $\endgroup$
    – Desura
    Oct 26 '21 at 5:55
  • $\begingroup$ Not just "probably". Always remember that computers do not do math to perfect accuracy. Most computer mathematics is done with a finite number of possible values (generally close to $2^{32}$ or $2^{64}$). When a calculation is made you get an allowed value close to the correct answer, rather than that answer itself. Beyond this base limitation to accuracy, the algorithms used may result in further inaccuracies depending on their nature. Many things cannot be exactly calculated, only approximated. It is clear here that you are exceeding Desmos' ability to calculate. $\endgroup$ Oct 26 '21 at 15:34
2
$\begingroup$

To help illustrate my comment. Look at your second example, though as given in Desmos, not the altered version you reproduced in the question:

$$h(x)=\left(\frac{1+5x^2}{1+3x^2}\right)^{\frac 1{x^2}}$$

The double precision floating point number that is commonly used for computing can store numbers to about 16 digits of accuracy. That is, starting with the leading non-zero digit in the actual number, It can store roughly only the next 16 digits ("roughly" because it actually stores the number in binary, not decimal). Now look what happens when you try to calculate $h(x)$ for $x = 10^{-9})$. First, it calculates

  • $1 + 5x^2 = 1 + 5\times 10^{-18} = 1.000,000,000,000,000,005$, except that is 19 digits, and it can only store about 16. So it rounds it to the nearest number it can store: $1$.
  • $1 + 3x^2 = 1.000,000,000,000,000,003$. Again, this is rounded to $1$.

Since the ratio of $1$ to $1$ is $1$, and $1$ raised to any power is $1$, it calculates $h(10^{-9}) = 1$.

At $x=10^{-8}$, it can just barely fit in a bit of extra information (though you need to look at the actual binary representation to see why), but that information is not enough to accurately calculate the value, so you get the bad result. Even at $x = 10^{-7}$, there is not enough precision to get more than a couple digits of accuracy.

$\endgroup$

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.