Rounding Error in Derivative Calculation for Non-Constant Functions

In summary, the conversation discusses a rounding error encountered on a calculator when finding the minima of a function. The calculator gives a rounded value of x=-20.5173 which results in a large rounding error when plugged into the derivative of the function. It is suggested that this is due to the error tolerance of the numerical method used. Further discussion delves into the discrepancy between the calculated derivative and the symbolic derivative of the function. Ultimately, it is determined that the issue lies in asking the calculator to calculate the derivative of a constant, rather than the derivative at a specific point.
  • #1
SprucerMoose
62
0
Gday,
I'm encountering a rounding error on my Ti-nspire CAS and was wondering if this approximation is acceptable.

For the function f(x) = (x^2 +1)sin(x), I obtained (by hand, confirmed with CAS) a derivitive of f'(x) = 2xsinx + (x^2 + 1)cos(x).

Calculating the minima of f(x) with the CAS yields x=-20.5173. However, if i plug this value into f'(x) manually, a result of f'(-20.5173) = -0.002071 is obtained. This is the biggest rounding error I have encountered and I was wondering what's going on. Strangly though, if I ask the CAS to do d/dx (f(-20.5173)) the result is 0. I am assuming that this x value is not a true minima, as plugging it directly into the raw derivitive should be most accurate? Any help would be appreciated.
 
Mathematics news on Phys.org
  • #2
There is indeed a local minima at that point. The only problem is your x given by your CAS is rounded off.

A more accurate approximation is x = -20.51729514

which gives f'(x) = -00000137

You will never get it to work exactly. You are aware, I suppose, that that minima is just one of infinitely many.
 
  • #3
Also, since some numerical methods are certain to be used in getting the answer, it's not actually "rounding error" but rather just the error tolerance of the numerical method. I'm just pointing out that technically they are two different things.
 
  • #4
Thanks for the responses guys.

Why is it that when I plug the rounded -20.5173 into the calculator to solve for the derivitive of f(x) at that point, the result is zero, but when I plug it into the actual function of the derivitive (ie. 2xsinx + (x^2 + 1)cos(x)) I don't get zero unless I substitute your much more accurate x? It's as if the calculator doesn't use the function of the derivitive itself to calculate derivitives/slopes.
 
  • #5
SprucerMoose said:
Thanks for the responses guys.

Why is it that when I plug the rounded -20.5173 into the calculator to solve for the derivitive of f(x) at that point, the result is zero, but when I plug it into the actual function of the derivitive (ie. 2xsinx + (x^2 + 1)cos(x)) I don't get zero unless I substitute your much more accurate x? It's as if the calculator doesn't use the function of the derivitive itself to calculate derivitives/slopes.

That's interesting. I'm not familiar with that calculator but when you ask it to calculate the derivative does it give you the answer symbolically or numerically? If it's calculating the derivative numerically then that level of error is more understandable.
 
  • #6
It's weird. If I define the following in the calculator:

a(x) = (x^2 +1)sin(x)
b(x) = a'(x)

It then shows b(x) = 2xsinx + (x^2 + 1)cos(x), so its gives the output of the derivitive function symbolically. When I substitute the less accurate x = -20.5173 into b(x) I get -0.002071. Yet when I substitute x = -20.5173 into a'(x), I get zero. These two values which should be identical are not. It's like the calculator gives me a symbolic output for the function of the derivitive, but when I actually ask it to calculate the derivitive at a point of a given function, it approximates. Is this correct?
 
  • #7
I was pondering whether or not I should make this public, but I think I have figured out the root of the problem.

Asking the calculator to calculate dy/dx of f(-20.5173), is going to be derivitive of a constant, not the derivitive at that point...

<quietly sneaks away>
 

FAQ: Rounding Error in Derivative Calculation for Non-Constant Functions

What is a calculator rounding error?

A calculator rounding error occurs when the result of a calculation is not an exact representation of the actual value due to the limitations of the calculator's precision.

Why do calculator rounding errors occur?

Calculator rounding errors occur because calculators use a finite number of digits to represent numbers, leading to rounding off of values that may result in slight inaccuracies in calculations.

How do calculator rounding errors affect calculations?

Calculator rounding errors can affect calculations by producing results that are slightly different from the actual values, which can impact the accuracy of the final result.

Can calculator rounding errors be avoided?

While it is not possible to completely eliminate calculator rounding errors, they can be minimized by using a calculator with a higher precision or by manually rounding off the result to the appropriate number of digits.

Are calculator rounding errors significant?

The significance of calculator rounding errors depends on the context of the calculation. For most everyday calculations, the errors are negligible and do not significantly impact the overall result. However, in more precise calculations, such as those used in scientific research, calculator rounding errors can have a larger impact and need to be carefully considered.

Similar threads

Replies
5
Views
1K
Replies
31
Views
2K
Replies
6
Views
4K
Replies
11
Views
536
Replies
1
Views
883
Replies
2
Views
2K
Back
Top