MHB Approximating the value of a function

  • Thread starter Thread starter Yankel
  • Start date Start date
  • Tags Tags
    Function Value
Click For Summary
The discussion revolves around using binary search to approximate the square root of 5 by analyzing the function f(x) = x^2 - 5 within the interval [2, 3]. The user calculated values at various points and arrived at 2.1875 as the approximation. A participant clarified that the maximum deviation from this approximation is 0.0625, confirming that it meets the accuracy requirement of 1/16. The conversation highlights the method of determining accuracy in root-finding using binary search. Understanding the bounds of the approximation is crucial for verifying the desired accuracy.
Yankel
Messages
390
Reaction score
0
Hello,

I have a problem which I did solve, but I ain't sure of something in it, something small to be honest.

The question is:

Use a binary search and the function f(x)=x^2-5 in the domain [2,3] to find approximation for the value of the square root of 5, with an accuracy of 1/16.

What I did, I tried finding where the function is equal to 0, i.e. x^2-5=0 meaning x is the square root of 5.

I calculated f(2) and f(3), and then f(2.5), f(2.25), f(2.125) and finally f(2.1875), which is the answer (2.1875 is the answer). My simple question is, how, or where, do I see that I am 1/16 accurate ?

Thank you !
 
Physics news on Phys.org
Hi Yankel,

You didn't mention the values for f, but either way, the actual root is either between 2.125 and 2.1875, or between 2.1875 and 2.125.
So the maximum deviation from 2.1875 is 0.0625, which is 1/16.
 
There are probably loads of proofs of this online, but I do not want to cheat. Here is my attempt: Convexity says that $$f(\lambda a + (1-\lambda)b) \leq \lambda f(a) + (1-\lambda) f(b)$$ $$f(b + \lambda(a-b)) \leq f(b) + \lambda (f(a) - f(b))$$ We know from the intermediate value theorem that there exists a ##c \in (b,a)## such that $$\frac{f(a) - f(b)}{a-b} = f'(c).$$ Hence $$f(b + \lambda(a-b)) \leq f(b) + \lambda (a - b) f'(c))$$ $$\frac{f(b + \lambda(a-b)) - f(b)}{\lambda(a-b)}...

Similar threads

  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 36 ·
2
Replies
36
Views
6K
Replies
5
Views
2K
Replies
1
Views
2K
  • · Replies 20 ·
Replies
20
Views
4K