Rounding Error in Derivative Calculation for Non-Constant Functions

  • Thread starter Thread starter SprucerMoose
  • Start date Start date
  • Tags Tags
    Calculator Error
SprucerMoose
Messages
62
Reaction score
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
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.
 
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.
 
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.
 
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.
 
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?
 
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>
 
Back
Top