Simple Ways to Compute Square Root

Here are some methods to compute the square root of a positive number c. Nothing innovative; but classic.

Method 1: Taylor expansion

If c>1, then

\sqrt{c}=\sqrt{\frac{1}{1-q}}=1+\frac{1}{2}q+\frac{3}{8}q^2+\cdots+(-1)^n{-1/2 \choose n}q^n+\cdots

If c<1, then

\sqrt{c}=\sqrt{1-q}=1-\frac{1}{2}q+\frac{3}{8}q^2+\cdots+(-1)^n{1/2 \choose n}q^n+\cdots

Convergence: linear.

Method 2: Fixed point iteration

x_{n+1}\leftarrow\frac{1}{2}\left(x_n+\frac{c}{x_n}\right)

Convergence: quadratic.

Method 3: Fixed point iteration

x_{n+1}\leftarrow\dfrac{x_n(x_n^2+3c)}{3x_n^2+c}

Convergence: cubic.

Advertisements

3 Responses to “Simple Ways to Compute Square Root”


  1. 1 nenny March 2, 2010 at 3:14 pm

    thank you for this post.. this helps me a lot.. really.. thanks..! 😀

  2. 2 Frank April 17, 2010 at 11:40 pm

    Hi,

    I want to plot a implicit function on matlab, would you please let me know the commands?

    Here is the function:

    k=[x-k]x/[3x-2k]+[2x-3k][1-x]/[1-x-k]

    x in (0,1)

    Thanks a lot.

  3. 3 Jie April 19, 2010 at 8:27 pm

    Frank, you can do this:

    xm = 0:0.01:1;
    km = 0:0.01:4;
    [x,k] = meshgrid(xm,km);
    f = (x-k).*x./(3*x-2*k)+(2*x-3*k).*(1-x)./(1-x-k) – k;
    contour(x,k,f,[0,0]);

    Btw, your question should be posted here instead..

    https://chenfuture.wordpress.com/2007/07/12/implicit-function-plot/


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Categories

Blog Stats

  • 247,883 hits

%d bloggers like this: