Rounding Error in Derivative Calculation for Non-Constant Functions

  • Context: Graduate 
  • Thread starter Thread starter SprucerMoose
  • Start date Start date
  • Tags Tags
    Calculator Error
Click For Summary

Discussion Overview

The discussion revolves around the rounding error encountered in derivative calculations for the function f(x) = (x^2 +1)sin(x). Participants explore the implications of numerical methods and rounding in the context of finding minima and evaluating derivatives, focusing on the discrepancies between symbolic and numerical outputs from a calculator.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant reports a rounding error when calculating the derivative of f(x) using a CAS, noting a discrepancy between the CAS output and manual calculations.
  • Another participant suggests that the x value provided by the CAS is rounded and proposes a more accurate approximation for the minima.
  • Some participants argue that the issue may stem from the error tolerance of numerical methods rather than rounding error specifically.
  • A participant questions why the CAS returns zero when evaluating the derivative at the rounded x value, while manual substitution into the derivative function yields a non-zero result.
  • There is a discussion about whether the calculator computes derivatives symbolically or numerically, with implications for the observed discrepancies.
  • One participant proposes that the confusion arises from calculating the derivative of a constant when evaluating at a specific point, suggesting a misunderstanding of the calculation process.

Areas of Agreement / Disagreement

Participants express differing views on the nature of the rounding error and the behavior of the calculator, indicating that multiple competing interpretations of the issue remain unresolved.

Contextual Notes

Participants note that the discrepancies may depend on the definitions and methods used in numerical calculations, and there are unresolved mathematical steps regarding the evaluation of derivatives at specific points.

Who May Find This Useful

Readers interested in numerical methods, calculus, and the behavior of computational tools in mathematical contexts may find this discussion relevant.

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 derivative 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 derivative should be most accurate? Any help would be appreciated.
 
Physics 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 derivative of f(x) at that point, the result is zero, but when I plug it into the actual function of the derivative (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 derivative 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 derivative of f(x) at that point, the result is zero, but when I plug it into the actual function of the derivative (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 derivative 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 derivative 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 derivative, but when I actually ask it to calculate the derivative 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 derivative of a constant, not the derivative at that point...

<quietly sneaks away>
 

Similar threads

Replies
3
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 18 ·
Replies
18
Views
3K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 6 ·
Replies
6
Views
5K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
6K
  • · Replies 1 ·
Replies
1
Views
2K