Calculating Sqrt of 2
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
Since $sqrt2$ is irrational, Is there a way to compute the 20 digits of it?
What I have done so far
I started the first digit decimal of the $sqrt2$ by calculating iterately so that it would not go to 3 so fast. It looks like this :
beginalign
sqrt 2 & = 1.4^2 equiv 1.96\
sqrt 2 & = 1.41^2 equiv 1.9881\
sqrt 2 & = 1.414^2 equiv 1.999396\
& ...
endalign
What I did is to first tell whether it pass such that $1.x^2$ would not greater than to 3.
If that passes, I will add a new decimal to it. Lets say y. $1.xy^2$
If that y fails, I increment y by 1 and square it again.
The process will keep repeating. The bad is that the process takes so much time.
approximation radicals
add a comment |Â
up vote
2
down vote
favorite
Since $sqrt2$ is irrational, Is there a way to compute the 20 digits of it?
What I have done so far
I started the first digit decimal of the $sqrt2$ by calculating iterately so that it would not go to 3 so fast. It looks like this :
beginalign
sqrt 2 & = 1.4^2 equiv 1.96\
sqrt 2 & = 1.41^2 equiv 1.9881\
sqrt 2 & = 1.414^2 equiv 1.999396\
& ...
endalign
What I did is to first tell whether it pass such that $1.x^2$ would not greater than to 3.
If that passes, I will add a new decimal to it. Lets say y. $1.xy^2$
If that y fails, I increment y by 1 and square it again.
The process will keep repeating. The bad is that the process takes so much time.
approximation radicals
1
You can go on trying to compute the square of $1.414x$, where $x$ is a number between $0$ and $9$. The greatest number between $1.4140$ and $1.4149$ such that its square is less then $2$ is your next candidate to repeat the process.
â Gibbs
1 hour ago
See en.wikipedia.org/wiki/Methods_of_computing_square_roots
â lhf
1 hour ago
@Gibbs I tried that so far. But the reason is that it takes more time to compute it.
â MMJM
1 hour ago
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
Since $sqrt2$ is irrational, Is there a way to compute the 20 digits of it?
What I have done so far
I started the first digit decimal of the $sqrt2$ by calculating iterately so that it would not go to 3 so fast. It looks like this :
beginalign
sqrt 2 & = 1.4^2 equiv 1.96\
sqrt 2 & = 1.41^2 equiv 1.9881\
sqrt 2 & = 1.414^2 equiv 1.999396\
& ...
endalign
What I did is to first tell whether it pass such that $1.x^2$ would not greater than to 3.
If that passes, I will add a new decimal to it. Lets say y. $1.xy^2$
If that y fails, I increment y by 1 and square it again.
The process will keep repeating. The bad is that the process takes so much time.
approximation radicals
Since $sqrt2$ is irrational, Is there a way to compute the 20 digits of it?
What I have done so far
I started the first digit decimal of the $sqrt2$ by calculating iterately so that it would not go to 3 so fast. It looks like this :
beginalign
sqrt 2 & = 1.4^2 equiv 1.96\
sqrt 2 & = 1.41^2 equiv 1.9881\
sqrt 2 & = 1.414^2 equiv 1.999396\
& ...
endalign
What I did is to first tell whether it pass such that $1.x^2$ would not greater than to 3.
If that passes, I will add a new decimal to it. Lets say y. $1.xy^2$
If that y fails, I increment y by 1 and square it again.
The process will keep repeating. The bad is that the process takes so much time.
approximation radicals
approximation radicals
edited 1 hour ago
asked 1 hour ago
MMJM
646
646
1
You can go on trying to compute the square of $1.414x$, where $x$ is a number between $0$ and $9$. The greatest number between $1.4140$ and $1.4149$ such that its square is less then $2$ is your next candidate to repeat the process.
â Gibbs
1 hour ago
See en.wikipedia.org/wiki/Methods_of_computing_square_roots
â lhf
1 hour ago
@Gibbs I tried that so far. But the reason is that it takes more time to compute it.
â MMJM
1 hour ago
add a comment |Â
1
You can go on trying to compute the square of $1.414x$, where $x$ is a number between $0$ and $9$. The greatest number between $1.4140$ and $1.4149$ such that its square is less then $2$ is your next candidate to repeat the process.
â Gibbs
1 hour ago
See en.wikipedia.org/wiki/Methods_of_computing_square_roots
â lhf
1 hour ago
@Gibbs I tried that so far. But the reason is that it takes more time to compute it.
â MMJM
1 hour ago
1
1
You can go on trying to compute the square of $1.414x$, where $x$ is a number between $0$ and $9$. The greatest number between $1.4140$ and $1.4149$ such that its square is less then $2$ is your next candidate to repeat the process.
â Gibbs
1 hour ago
You can go on trying to compute the square of $1.414x$, where $x$ is a number between $0$ and $9$. The greatest number between $1.4140$ and $1.4149$ such that its square is less then $2$ is your next candidate to repeat the process.
â Gibbs
1 hour ago
See en.wikipedia.org/wiki/Methods_of_computing_square_roots
â lhf
1 hour ago
See en.wikipedia.org/wiki/Methods_of_computing_square_roots
â lhf
1 hour ago
@Gibbs I tried that so far. But the reason is that it takes more time to compute it.
â MMJM
1 hour ago
@Gibbs I tried that so far. But the reason is that it takes more time to compute it.
â MMJM
1 hour ago
add a comment |Â
5 Answers
5
active
oldest
votes
up vote
5
down vote
Calculating the square root of a number is one of the first problems tackled with numerical methods, known I think to the ancient Babylonians. The observation is that if $x,,y>0$ and $ynesqrtx$ the $y,,x/y$ will be on opposite sides of $sqrtx$, and we could try averaging them. So try $y_0=1,,y_n+1=frac12(y_n+fracxy_n)$. This is actually the Newton-Raphson method 5xum mentioned. The number of correct decimal places approximately doubles at each stage, i.e. you probably only have to go as far as $y_5$ or so.
Definitely one of the fastest methods: $$ y_0 = 1.colortan0;\ y_1 = 1.colortan5;\ y_2 = 1.41colortan666666666666666666666666666...;\ y_3 = 1.41421colortan568627450980392156862745...;\ y_4 = 1.41421356237colortan468991062629557889...;\ y_5 = 1.41421356237309504880168colortan962350...;\ cdots $$
â Oleg567
55 mins ago
1
@Oleg567 We could go even faster with post-Newton Householder methods, but the individual steps become more computationally complex. BTW the calculator you used to check that probably also used Newton-Raphson for the division.
â J.G.
52 mins ago
The beauty of this method is that the initial estimate can be way off and the method will converge quickly anyway. of course, making an educated guess to pick the initial estimate helps to reduce the number of iterations.
â Vasya
49 mins ago
Love the intuitive explanation for it!
â dbx
30 mins ago
add a comment |Â
up vote
1
down vote
Here the way I learnt to obtain decimal digit after decimal digit when I began middle school:
beginarraylcl
2&big( &1.414,21 \[1ex]
1,00&& 24times colorred4=96<100\
-96,&& 25times5=125>100\[1ex]
phantom-04,00&&281timescolorred1<400\
;:-2,81&&282times2>400\[1ex]
phantom-0119,00&&2824timescolorred4<11900\
phantom0-112,96&&2825times5>11900 \[1ex]
phantom00;604,00&&28282timescolorred2 < 60400 \
&&28283times3> 60400
endarray
&c.
add a comment |Â
up vote
0
down vote
Newton-Rhapson is a good idea because of the convergence rate. However, I am more of a fan of using Taylor's expansions here since it is super easy to derive on the go to give fairly ok estimates in quite a reasonable time. So, the way to go to find $sqrtx$ is to find first the closest integer which approximates $sqrtx$ and call this $a$, then apply Taylor to $a^2$. Then Taylor says
$$ sqrtx approx a + (x-a^2)cdot frac12 a - (x-a^2)^2/2 cdot frac14 a^3 + cdots. $$
The thing that is nice here is that you also get bounds on the error you make. So, denote $f(x) = sqrtx$, then the error of a $n$th order approximation (i.e., going as far as $(x-a^2)^n/n! cdot f^(n)(a^2)$ in the approximation above) is given by $$ (x-a)^n+1/(n+1)! cdot f^(n+1)(xi)$$ for a certain $xi$ between $a^2$ and $x$. This can be estimated quite easily since this $f^(n+1)$ is monotone around $x$. Thus look at the boundaries of the domain of $xi$ and find the 'best' maximal value which you can calculate without a calculator.
Example for $x=2$. Apparently $1$ is the closest integer to $sqrt2$ and thus we will take $a=1$. Then, let's take a second order approximation
$$sqrt2 approx 1 + (2-1)cdot frac12 - (2-1)^2/2cdot frac14 = 1 + 0.5 - 0.125 = 1.375 $$
and the absolute error is given by
$$ E=left|(2-1)^3/3!cdot frac38 cdot xi^2sqrtxiright| = frac116 cdot frac1xi^2sqrtxi$$
for a certain $xi$ between $1$ and $2$. Since this is a decreasing function on $(1,2)$. The maximum is attained at $1$ and hence the error is bounded by
$$ E leq frac116 $$
which seems to be a good estimate since $E = 0.039dots$ and $1/16 = 0.0625$.
add a comment |Â
up vote
0
down vote
You can compute it manually using the algorithm:
- $p=0$, $r=0$, $i=0$
- Split the number into sections of two digits
- Take i'th section $n_i$, let $k=100t+n_i$
- Find the greatest number $x$, such that $$y=x(20p+x)leq k$$
- Assign $p=10 p + x$, $i=i+1$, if the accyracy of the result is not satisfied, then return to 3.
Example:
02.00 00 00 00 00
- $n_0 = 2$, $k=2$, therefore for $x=1$: $y=1$ and $p=1$
- $n_1=0$, $k=100$, so for $x=4$: $y=24*4=96<100$ and $p=14$
- $n_2=0$, $k=400$, so for $x=1$, $y=281*1=281<400$ and $p=141$
- $n_3=0$, $k=11900$, so for $x=4$, $y=2824*4=11296<11900$ and $p=1414$
- $n_4=0$, $k=60400$, so for $x=2$, $y=28282*2=56564<60400$ and $p=14142$
- $n_5=0$, $k=383600$, so for $x=1$, $y=282841*1=282841<383600$ and $p=141421$
- ...
After all just remember to point the comma in place, where it should be, ie. after first number (it depends how many sections were there on the left side of our number), so you'll have:
$$sqrt2approx 1.41421$$
To obtain accuracy of 20 numbers after the comma, you should append 20 sections of 00 in the step 2. , ie.:
02.00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
add a comment |Â
up vote
-1
down vote
The number $sqrt2$ is the solution to the equation $x^2-2=0$, so any method for numerically approximating the roots of an equation (such as the Newton method) will be able to approximate $sqrt2$.
add a comment |Â
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
Calculating the square root of a number is one of the first problems tackled with numerical methods, known I think to the ancient Babylonians. The observation is that if $x,,y>0$ and $ynesqrtx$ the $y,,x/y$ will be on opposite sides of $sqrtx$, and we could try averaging them. So try $y_0=1,,y_n+1=frac12(y_n+fracxy_n)$. This is actually the Newton-Raphson method 5xum mentioned. The number of correct decimal places approximately doubles at each stage, i.e. you probably only have to go as far as $y_5$ or so.
Definitely one of the fastest methods: $$ y_0 = 1.colortan0;\ y_1 = 1.colortan5;\ y_2 = 1.41colortan666666666666666666666666666...;\ y_3 = 1.41421colortan568627450980392156862745...;\ y_4 = 1.41421356237colortan468991062629557889...;\ y_5 = 1.41421356237309504880168colortan962350...;\ cdots $$
â Oleg567
55 mins ago
1
@Oleg567 We could go even faster with post-Newton Householder methods, but the individual steps become more computationally complex. BTW the calculator you used to check that probably also used Newton-Raphson for the division.
â J.G.
52 mins ago
The beauty of this method is that the initial estimate can be way off and the method will converge quickly anyway. of course, making an educated guess to pick the initial estimate helps to reduce the number of iterations.
â Vasya
49 mins ago
Love the intuitive explanation for it!
â dbx
30 mins ago
add a comment |Â
up vote
5
down vote
Calculating the square root of a number is one of the first problems tackled with numerical methods, known I think to the ancient Babylonians. The observation is that if $x,,y>0$ and $ynesqrtx$ the $y,,x/y$ will be on opposite sides of $sqrtx$, and we could try averaging them. So try $y_0=1,,y_n+1=frac12(y_n+fracxy_n)$. This is actually the Newton-Raphson method 5xum mentioned. The number of correct decimal places approximately doubles at each stage, i.e. you probably only have to go as far as $y_5$ or so.
Definitely one of the fastest methods: $$ y_0 = 1.colortan0;\ y_1 = 1.colortan5;\ y_2 = 1.41colortan666666666666666666666666666...;\ y_3 = 1.41421colortan568627450980392156862745...;\ y_4 = 1.41421356237colortan468991062629557889...;\ y_5 = 1.41421356237309504880168colortan962350...;\ cdots $$
â Oleg567
55 mins ago
1
@Oleg567 We could go even faster with post-Newton Householder methods, but the individual steps become more computationally complex. BTW the calculator you used to check that probably also used Newton-Raphson for the division.
â J.G.
52 mins ago
The beauty of this method is that the initial estimate can be way off and the method will converge quickly anyway. of course, making an educated guess to pick the initial estimate helps to reduce the number of iterations.
â Vasya
49 mins ago
Love the intuitive explanation for it!
â dbx
30 mins ago
add a comment |Â
up vote
5
down vote
up vote
5
down vote
Calculating the square root of a number is one of the first problems tackled with numerical methods, known I think to the ancient Babylonians. The observation is that if $x,,y>0$ and $ynesqrtx$ the $y,,x/y$ will be on opposite sides of $sqrtx$, and we could try averaging them. So try $y_0=1,,y_n+1=frac12(y_n+fracxy_n)$. This is actually the Newton-Raphson method 5xum mentioned. The number of correct decimal places approximately doubles at each stage, i.e. you probably only have to go as far as $y_5$ or so.
Calculating the square root of a number is one of the first problems tackled with numerical methods, known I think to the ancient Babylonians. The observation is that if $x,,y>0$ and $ynesqrtx$ the $y,,x/y$ will be on opposite sides of $sqrtx$, and we could try averaging them. So try $y_0=1,,y_n+1=frac12(y_n+fracxy_n)$. This is actually the Newton-Raphson method 5xum mentioned. The number of correct decimal places approximately doubles at each stage, i.e. you probably only have to go as far as $y_5$ or so.
answered 1 hour ago
J.G.
14.2k11525
14.2k11525
Definitely one of the fastest methods: $$ y_0 = 1.colortan0;\ y_1 = 1.colortan5;\ y_2 = 1.41colortan666666666666666666666666666...;\ y_3 = 1.41421colortan568627450980392156862745...;\ y_4 = 1.41421356237colortan468991062629557889...;\ y_5 = 1.41421356237309504880168colortan962350...;\ cdots $$
â Oleg567
55 mins ago
1
@Oleg567 We could go even faster with post-Newton Householder methods, but the individual steps become more computationally complex. BTW the calculator you used to check that probably also used Newton-Raphson for the division.
â J.G.
52 mins ago
The beauty of this method is that the initial estimate can be way off and the method will converge quickly anyway. of course, making an educated guess to pick the initial estimate helps to reduce the number of iterations.
â Vasya
49 mins ago
Love the intuitive explanation for it!
â dbx
30 mins ago
add a comment |Â
Definitely one of the fastest methods: $$ y_0 = 1.colortan0;\ y_1 = 1.colortan5;\ y_2 = 1.41colortan666666666666666666666666666...;\ y_3 = 1.41421colortan568627450980392156862745...;\ y_4 = 1.41421356237colortan468991062629557889...;\ y_5 = 1.41421356237309504880168colortan962350...;\ cdots $$
â Oleg567
55 mins ago
1
@Oleg567 We could go even faster with post-Newton Householder methods, but the individual steps become more computationally complex. BTW the calculator you used to check that probably also used Newton-Raphson for the division.
â J.G.
52 mins ago
The beauty of this method is that the initial estimate can be way off and the method will converge quickly anyway. of course, making an educated guess to pick the initial estimate helps to reduce the number of iterations.
â Vasya
49 mins ago
Love the intuitive explanation for it!
â dbx
30 mins ago
Definitely one of the fastest methods: $$ y_0 = 1.colortan0;\ y_1 = 1.colortan5;\ y_2 = 1.41colortan666666666666666666666666666...;\ y_3 = 1.41421colortan568627450980392156862745...;\ y_4 = 1.41421356237colortan468991062629557889...;\ y_5 = 1.41421356237309504880168colortan962350...;\ cdots $$
â Oleg567
55 mins ago
Definitely one of the fastest methods: $$ y_0 = 1.colortan0;\ y_1 = 1.colortan5;\ y_2 = 1.41colortan666666666666666666666666666...;\ y_3 = 1.41421colortan568627450980392156862745...;\ y_4 = 1.41421356237colortan468991062629557889...;\ y_5 = 1.41421356237309504880168colortan962350...;\ cdots $$
â Oleg567
55 mins ago
1
1
@Oleg567 We could go even faster with post-Newton Householder methods, but the individual steps become more computationally complex. BTW the calculator you used to check that probably also used Newton-Raphson for the division.
â J.G.
52 mins ago
@Oleg567 We could go even faster with post-Newton Householder methods, but the individual steps become more computationally complex. BTW the calculator you used to check that probably also used Newton-Raphson for the division.
â J.G.
52 mins ago
The beauty of this method is that the initial estimate can be way off and the method will converge quickly anyway. of course, making an educated guess to pick the initial estimate helps to reduce the number of iterations.
â Vasya
49 mins ago
The beauty of this method is that the initial estimate can be way off and the method will converge quickly anyway. of course, making an educated guess to pick the initial estimate helps to reduce the number of iterations.
â Vasya
49 mins ago
Love the intuitive explanation for it!
â dbx
30 mins ago
Love the intuitive explanation for it!
â dbx
30 mins ago
add a comment |Â
up vote
1
down vote
Here the way I learnt to obtain decimal digit after decimal digit when I began middle school:
beginarraylcl
2&big( &1.414,21 \[1ex]
1,00&& 24times colorred4=96<100\
-96,&& 25times5=125>100\[1ex]
phantom-04,00&&281timescolorred1<400\
;:-2,81&&282times2>400\[1ex]
phantom-0119,00&&2824timescolorred4<11900\
phantom0-112,96&&2825times5>11900 \[1ex]
phantom00;604,00&&28282timescolorred2 < 60400 \
&&28283times3> 60400
endarray
&c.
add a comment |Â
up vote
1
down vote
Here the way I learnt to obtain decimal digit after decimal digit when I began middle school:
beginarraylcl
2&big( &1.414,21 \[1ex]
1,00&& 24times colorred4=96<100\
-96,&& 25times5=125>100\[1ex]
phantom-04,00&&281timescolorred1<400\
;:-2,81&&282times2>400\[1ex]
phantom-0119,00&&2824timescolorred4<11900\
phantom0-112,96&&2825times5>11900 \[1ex]
phantom00;604,00&&28282timescolorred2 < 60400 \
&&28283times3> 60400
endarray
&c.
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Here the way I learnt to obtain decimal digit after decimal digit when I began middle school:
beginarraylcl
2&big( &1.414,21 \[1ex]
1,00&& 24times colorred4=96<100\
-96,&& 25times5=125>100\[1ex]
phantom-04,00&&281timescolorred1<400\
;:-2,81&&282times2>400\[1ex]
phantom-0119,00&&2824timescolorred4<11900\
phantom0-112,96&&2825times5>11900 \[1ex]
phantom00;604,00&&28282timescolorred2 < 60400 \
&&28283times3> 60400
endarray
&c.
Here the way I learnt to obtain decimal digit after decimal digit when I began middle school:
beginarraylcl
2&big( &1.414,21 \[1ex]
1,00&& 24times colorred4=96<100\
-96,&& 25times5=125>100\[1ex]
phantom-04,00&&281timescolorred1<400\
;:-2,81&&282times2>400\[1ex]
phantom-0119,00&&2824timescolorred4<11900\
phantom0-112,96&&2825times5>11900 \[1ex]
phantom00;604,00&&28282timescolorred2 < 60400 \
&&28283times3> 60400
endarray
&c.
answered 27 mins ago
Bernard
112k635102
112k635102
add a comment |Â
add a comment |Â
up vote
0
down vote
Newton-Rhapson is a good idea because of the convergence rate. However, I am more of a fan of using Taylor's expansions here since it is super easy to derive on the go to give fairly ok estimates in quite a reasonable time. So, the way to go to find $sqrtx$ is to find first the closest integer which approximates $sqrtx$ and call this $a$, then apply Taylor to $a^2$. Then Taylor says
$$ sqrtx approx a + (x-a^2)cdot frac12 a - (x-a^2)^2/2 cdot frac14 a^3 + cdots. $$
The thing that is nice here is that you also get bounds on the error you make. So, denote $f(x) = sqrtx$, then the error of a $n$th order approximation (i.e., going as far as $(x-a^2)^n/n! cdot f^(n)(a^2)$ in the approximation above) is given by $$ (x-a)^n+1/(n+1)! cdot f^(n+1)(xi)$$ for a certain $xi$ between $a^2$ and $x$. This can be estimated quite easily since this $f^(n+1)$ is monotone around $x$. Thus look at the boundaries of the domain of $xi$ and find the 'best' maximal value which you can calculate without a calculator.
Example for $x=2$. Apparently $1$ is the closest integer to $sqrt2$ and thus we will take $a=1$. Then, let's take a second order approximation
$$sqrt2 approx 1 + (2-1)cdot frac12 - (2-1)^2/2cdot frac14 = 1 + 0.5 - 0.125 = 1.375 $$
and the absolute error is given by
$$ E=left|(2-1)^3/3!cdot frac38 cdot xi^2sqrtxiright| = frac116 cdot frac1xi^2sqrtxi$$
for a certain $xi$ between $1$ and $2$. Since this is a decreasing function on $(1,2)$. The maximum is attained at $1$ and hence the error is bounded by
$$ E leq frac116 $$
which seems to be a good estimate since $E = 0.039dots$ and $1/16 = 0.0625$.
add a comment |Â
up vote
0
down vote
Newton-Rhapson is a good idea because of the convergence rate. However, I am more of a fan of using Taylor's expansions here since it is super easy to derive on the go to give fairly ok estimates in quite a reasonable time. So, the way to go to find $sqrtx$ is to find first the closest integer which approximates $sqrtx$ and call this $a$, then apply Taylor to $a^2$. Then Taylor says
$$ sqrtx approx a + (x-a^2)cdot frac12 a - (x-a^2)^2/2 cdot frac14 a^3 + cdots. $$
The thing that is nice here is that you also get bounds on the error you make. So, denote $f(x) = sqrtx$, then the error of a $n$th order approximation (i.e., going as far as $(x-a^2)^n/n! cdot f^(n)(a^2)$ in the approximation above) is given by $$ (x-a)^n+1/(n+1)! cdot f^(n+1)(xi)$$ for a certain $xi$ between $a^2$ and $x$. This can be estimated quite easily since this $f^(n+1)$ is monotone around $x$. Thus look at the boundaries of the domain of $xi$ and find the 'best' maximal value which you can calculate without a calculator.
Example for $x=2$. Apparently $1$ is the closest integer to $sqrt2$ and thus we will take $a=1$. Then, let's take a second order approximation
$$sqrt2 approx 1 + (2-1)cdot frac12 - (2-1)^2/2cdot frac14 = 1 + 0.5 - 0.125 = 1.375 $$
and the absolute error is given by
$$ E=left|(2-1)^3/3!cdot frac38 cdot xi^2sqrtxiright| = frac116 cdot frac1xi^2sqrtxi$$
for a certain $xi$ between $1$ and $2$. Since this is a decreasing function on $(1,2)$. The maximum is attained at $1$ and hence the error is bounded by
$$ E leq frac116 $$
which seems to be a good estimate since $E = 0.039dots$ and $1/16 = 0.0625$.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Newton-Rhapson is a good idea because of the convergence rate. However, I am more of a fan of using Taylor's expansions here since it is super easy to derive on the go to give fairly ok estimates in quite a reasonable time. So, the way to go to find $sqrtx$ is to find first the closest integer which approximates $sqrtx$ and call this $a$, then apply Taylor to $a^2$. Then Taylor says
$$ sqrtx approx a + (x-a^2)cdot frac12 a - (x-a^2)^2/2 cdot frac14 a^3 + cdots. $$
The thing that is nice here is that you also get bounds on the error you make. So, denote $f(x) = sqrtx$, then the error of a $n$th order approximation (i.e., going as far as $(x-a^2)^n/n! cdot f^(n)(a^2)$ in the approximation above) is given by $$ (x-a)^n+1/(n+1)! cdot f^(n+1)(xi)$$ for a certain $xi$ between $a^2$ and $x$. This can be estimated quite easily since this $f^(n+1)$ is monotone around $x$. Thus look at the boundaries of the domain of $xi$ and find the 'best' maximal value which you can calculate without a calculator.
Example for $x=2$. Apparently $1$ is the closest integer to $sqrt2$ and thus we will take $a=1$. Then, let's take a second order approximation
$$sqrt2 approx 1 + (2-1)cdot frac12 - (2-1)^2/2cdot frac14 = 1 + 0.5 - 0.125 = 1.375 $$
and the absolute error is given by
$$ E=left|(2-1)^3/3!cdot frac38 cdot xi^2sqrtxiright| = frac116 cdot frac1xi^2sqrtxi$$
for a certain $xi$ between $1$ and $2$. Since this is a decreasing function on $(1,2)$. The maximum is attained at $1$ and hence the error is bounded by
$$ E leq frac116 $$
which seems to be a good estimate since $E = 0.039dots$ and $1/16 = 0.0625$.
Newton-Rhapson is a good idea because of the convergence rate. However, I am more of a fan of using Taylor's expansions here since it is super easy to derive on the go to give fairly ok estimates in quite a reasonable time. So, the way to go to find $sqrtx$ is to find first the closest integer which approximates $sqrtx$ and call this $a$, then apply Taylor to $a^2$. Then Taylor says
$$ sqrtx approx a + (x-a^2)cdot frac12 a - (x-a^2)^2/2 cdot frac14 a^3 + cdots. $$
The thing that is nice here is that you also get bounds on the error you make. So, denote $f(x) = sqrtx$, then the error of a $n$th order approximation (i.e., going as far as $(x-a^2)^n/n! cdot f^(n)(a^2)$ in the approximation above) is given by $$ (x-a)^n+1/(n+1)! cdot f^(n+1)(xi)$$ for a certain $xi$ between $a^2$ and $x$. This can be estimated quite easily since this $f^(n+1)$ is monotone around $x$. Thus look at the boundaries of the domain of $xi$ and find the 'best' maximal value which you can calculate without a calculator.
Example for $x=2$. Apparently $1$ is the closest integer to $sqrt2$ and thus we will take $a=1$. Then, let's take a second order approximation
$$sqrt2 approx 1 + (2-1)cdot frac12 - (2-1)^2/2cdot frac14 = 1 + 0.5 - 0.125 = 1.375 $$
and the absolute error is given by
$$ E=left|(2-1)^3/3!cdot frac38 cdot xi^2sqrtxiright| = frac116 cdot frac1xi^2sqrtxi$$
for a certain $xi$ between $1$ and $2$. Since this is a decreasing function on $(1,2)$. The maximum is attained at $1$ and hence the error is bounded by
$$ E leq frac116 $$
which seems to be a good estimate since $E = 0.039dots$ and $1/16 = 0.0625$.
edited 36 mins ago
answered 43 mins ago
Stan Tendijck
1,301110
1,301110
add a comment |Â
add a comment |Â
up vote
0
down vote
You can compute it manually using the algorithm:
- $p=0$, $r=0$, $i=0$
- Split the number into sections of two digits
- Take i'th section $n_i$, let $k=100t+n_i$
- Find the greatest number $x$, such that $$y=x(20p+x)leq k$$
- Assign $p=10 p + x$, $i=i+1$, if the accyracy of the result is not satisfied, then return to 3.
Example:
02.00 00 00 00 00
- $n_0 = 2$, $k=2$, therefore for $x=1$: $y=1$ and $p=1$
- $n_1=0$, $k=100$, so for $x=4$: $y=24*4=96<100$ and $p=14$
- $n_2=0$, $k=400$, so for $x=1$, $y=281*1=281<400$ and $p=141$
- $n_3=0$, $k=11900$, so for $x=4$, $y=2824*4=11296<11900$ and $p=1414$
- $n_4=0$, $k=60400$, so for $x=2$, $y=28282*2=56564<60400$ and $p=14142$
- $n_5=0$, $k=383600$, so for $x=1$, $y=282841*1=282841<383600$ and $p=141421$
- ...
After all just remember to point the comma in place, where it should be, ie. after first number (it depends how many sections were there on the left side of our number), so you'll have:
$$sqrt2approx 1.41421$$
To obtain accuracy of 20 numbers after the comma, you should append 20 sections of 00 in the step 2. , ie.:
02.00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
add a comment |Â
up vote
0
down vote
You can compute it manually using the algorithm:
- $p=0$, $r=0$, $i=0$
- Split the number into sections of two digits
- Take i'th section $n_i$, let $k=100t+n_i$
- Find the greatest number $x$, such that $$y=x(20p+x)leq k$$
- Assign $p=10 p + x$, $i=i+1$, if the accyracy of the result is not satisfied, then return to 3.
Example:
02.00 00 00 00 00
- $n_0 = 2$, $k=2$, therefore for $x=1$: $y=1$ and $p=1$
- $n_1=0$, $k=100$, so for $x=4$: $y=24*4=96<100$ and $p=14$
- $n_2=0$, $k=400$, so for $x=1$, $y=281*1=281<400$ and $p=141$
- $n_3=0$, $k=11900$, so for $x=4$, $y=2824*4=11296<11900$ and $p=1414$
- $n_4=0$, $k=60400$, so for $x=2$, $y=28282*2=56564<60400$ and $p=14142$
- $n_5=0$, $k=383600$, so for $x=1$, $y=282841*1=282841<383600$ and $p=141421$
- ...
After all just remember to point the comma in place, where it should be, ie. after first number (it depends how many sections were there on the left side of our number), so you'll have:
$$sqrt2approx 1.41421$$
To obtain accuracy of 20 numbers after the comma, you should append 20 sections of 00 in the step 2. , ie.:
02.00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
add a comment |Â
up vote
0
down vote
up vote
0
down vote
You can compute it manually using the algorithm:
- $p=0$, $r=0$, $i=0$
- Split the number into sections of two digits
- Take i'th section $n_i$, let $k=100t+n_i$
- Find the greatest number $x$, such that $$y=x(20p+x)leq k$$
- Assign $p=10 p + x$, $i=i+1$, if the accyracy of the result is not satisfied, then return to 3.
Example:
02.00 00 00 00 00
- $n_0 = 2$, $k=2$, therefore for $x=1$: $y=1$ and $p=1$
- $n_1=0$, $k=100$, so for $x=4$: $y=24*4=96<100$ and $p=14$
- $n_2=0$, $k=400$, so for $x=1$, $y=281*1=281<400$ and $p=141$
- $n_3=0$, $k=11900$, so for $x=4$, $y=2824*4=11296<11900$ and $p=1414$
- $n_4=0$, $k=60400$, so for $x=2$, $y=28282*2=56564<60400$ and $p=14142$
- $n_5=0$, $k=383600$, so for $x=1$, $y=282841*1=282841<383600$ and $p=141421$
- ...
After all just remember to point the comma in place, where it should be, ie. after first number (it depends how many sections were there on the left side of our number), so you'll have:
$$sqrt2approx 1.41421$$
To obtain accuracy of 20 numbers after the comma, you should append 20 sections of 00 in the step 2. , ie.:
02.00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
You can compute it manually using the algorithm:
- $p=0$, $r=0$, $i=0$
- Split the number into sections of two digits
- Take i'th section $n_i$, let $k=100t+n_i$
- Find the greatest number $x$, such that $$y=x(20p+x)leq k$$
- Assign $p=10 p + x$, $i=i+1$, if the accyracy of the result is not satisfied, then return to 3.
Example:
02.00 00 00 00 00
- $n_0 = 2$, $k=2$, therefore for $x=1$: $y=1$ and $p=1$
- $n_1=0$, $k=100$, so for $x=4$: $y=24*4=96<100$ and $p=14$
- $n_2=0$, $k=400$, so for $x=1$, $y=281*1=281<400$ and $p=141$
- $n_3=0$, $k=11900$, so for $x=4$, $y=2824*4=11296<11900$ and $p=1414$
- $n_4=0$, $k=60400$, so for $x=2$, $y=28282*2=56564<60400$ and $p=14142$
- $n_5=0$, $k=383600$, so for $x=1$, $y=282841*1=282841<383600$ and $p=141421$
- ...
After all just remember to point the comma in place, where it should be, ie. after first number (it depends how many sections were there on the left side of our number), so you'll have:
$$sqrt2approx 1.41421$$
To obtain accuracy of 20 numbers after the comma, you should append 20 sections of 00 in the step 2. , ie.:
02.00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
answered 16 mins ago
Jaroslaw Matlak
3,928830
3,928830
add a comment |Â
add a comment |Â
up vote
-1
down vote
The number $sqrt2$ is the solution to the equation $x^2-2=0$, so any method for numerically approximating the roots of an equation (such as the Newton method) will be able to approximate $sqrt2$.
add a comment |Â
up vote
-1
down vote
The number $sqrt2$ is the solution to the equation $x^2-2=0$, so any method for numerically approximating the roots of an equation (such as the Newton method) will be able to approximate $sqrt2$.
add a comment |Â
up vote
-1
down vote
up vote
-1
down vote
The number $sqrt2$ is the solution to the equation $x^2-2=0$, so any method for numerically approximating the roots of an equation (such as the Newton method) will be able to approximate $sqrt2$.
The number $sqrt2$ is the solution to the equation $x^2-2=0$, so any method for numerically approximating the roots of an equation (such as the Newton method) will be able to approximate $sqrt2$.
answered 1 hour ago
5xum
82.8k383147
82.8k383147
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2916718%2fcalculating-sqrt-of-2%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
You can go on trying to compute the square of $1.414x$, where $x$ is a number between $0$ and $9$. The greatest number between $1.4140$ and $1.4149$ such that its square is less then $2$ is your next candidate to repeat the process.
â Gibbs
1 hour ago
See en.wikipedia.org/wiki/Methods_of_computing_square_roots
â lhf
1 hour ago
@Gibbs I tried that so far. But the reason is that it takes more time to compute it.
â MMJM
1 hour ago