Goto main content

sqrt

This function computes the square root of a number.

SQRT

NAME

sqrt - This function computes the square root of a number.

SYNOPSIS

sqrt(number)

DESCRIPTION

This mathematical function computes the square root of a number defined in the real and positive plane. It returns a number y whose square is x, meaning that y multiplied by itself equals x. X needs always to be positive whereas y can be both positive or negative. However, the given answer will always be the positive value of y. Since the square root of a negative number equals a complex number, that is a real number plus an imaginary number, the latter being not defined for this function the user will receive Not a number as an answer.

PARAMETERS

number
Specify the number (float) used as argument for the sqrt function.

RETURN

The square root value of the argument.

EXAMPLES

Note: In the followings examples, the _ between the { should be removed to make it work.

One can use this function with a variable :

test(q(res={_{
%include "/includes/extenso.sn";
a=4;
sqrt(a);
}}.),
q(res=2.));

With a trigonometric function:

test(q(res={_{
%include "/includes/extenso.sn";
a=cos(0);
sqrt(a);
}}.),
q(res=1.));

With a float:

test(q(res={_{sqrt(0.99);}}.),q(res=.994987.));

With big integers:

test(q(res={_{sqrt(45);}}.),q(res=6.7082.));

With an array:

test(q(res={_{sqrt(25,0,4);}}.),q(res=\[5,0,2\].));

But not with negative numbers:

test(q(res={_{sqrt(-4);}}.),q(res=NAN.));

SEE ALSO

{{ include("includes/maths.sn") }}

AUTHOR

Written by Caroline Laplante, <claplante@sednove.com>

MODIFICATIONS

1.0 2014-09-09 21:24:14 laplante@sednove.com

Edit

© 2021 extenso Inc. All rights reserved.