- #1
MHD93
- 93
- 0
Hello
What follows is one way of calculating the square root of 2, as Wikipedia shows:
I built the following function as an attempt to express the calculation:
f(x) = 2 + 1 / f(x/2) if x is not 0
f(x) = 1 if x is 0
then square root of 2 = 1 + 1 / f(1)
I used the preceding approach to find the square root of 2, using C++, and it worked..
But the problem is that I have a way for showing that it's wrong!
What's wrong with that function, how can I convince myself logically!?
Thanks for help.. in advance.
What follows is one way of calculating the square root of 2, as Wikipedia shows:
I built the following function as an attempt to express the calculation:
f(x) = 2 + 1 / f(x/2) if x is not 0
f(x) = 1 if x is 0
then square root of 2 = 1 + 1 / f(1)
I used the preceding approach to find the square root of 2, using C++, and it worked..
But the problem is that I have a way for showing that it's wrong!
What's wrong with that function, how can I convince myself logically!?
Thanks for help.. in advance.
Last edited: