Manual Reference Pages  - sqrt (3fortran)

NAME

SQRT(3) - [MATHEMATICS] Square-root function

SYNOPSIS

result = sqrt(x)

         elemental TYPE(kind=KIND) function sqrt(x)

TYPE(kind=KIND),intent(in) :: x

CHARACTERISTICS

o TYPE may be real or complex.
o KIND may be any kind valid for the declared type.
o the result has the same characteristics as X.

DESCRIPTION

SQRT(3) computes the principal square root of X.

The number whose square root is being considered is known as the radicand.

In mathematics, a square root of a radicand X is a number Y such that Y*Y = X.

Every nonnegative radicand X has two square roots of the same unique magnitude, one positive and one negative. The nonnegative square root is called the principal square root.

The principal square root of 9 is 3, for example, even though (-3)*(-3) is also 9.

Square roots of negative numbers are a special case of complex numbers, where with COMPLEX input the components of the radicand need not be positive in order to have a valid square root.

OPTIONS

o X : The radicand to find the principal square root of. If X is real its value must be greater than or equal to zero.

RESULT

The principal square root of X is returned.

For a complex result the real part is greater than or equal to zero.

When the real part of the result is zero, the imaginary part has the same sign as the imaginary part of X.

EXAMPLES

Sample program:

    program demo_sqrt
    use, intrinsic :: iso_fortran_env, only : real_kinds, &
     & real32, real64, real128
    implicit none
    real(kind=real64) :: x, x2
    complex :: z, z2

! basics x = 2.0_real64 ! complex z = (1.0, 2.0) write(*,*)’input values ’,x,z

x2 = sqrt(x) z2 = sqrt(z) write(*,*)’output values ’,x2,z2

! elemental write(*,*)’elemental’,sqrt([64.0,121.0,30.0])

! alternatives x2 = x**0.5 z2 = z**0.5 write(*,*)’alternatively’,x2,z2

end program demo_sqrt

Results:

        input values    2.00000000000000      (1.000000,2.000000)
        output values    1.41421356237310      (1.272020,0.7861513)
        elemental   8.000000       11.00000       5.477226
        alternatively   1.41421356237310      (1.272020,0.7861513)

STANDARD

FORTRAN 77

SEE ALSO

EXP(3), LOG(3), LOG10(3)

fortran-lang intrinsic descriptions (license: MIT) @urbanjost


Nemo Release 3.1 sqrt (3fortran) April 28, 2024
Generated by manServer 1.08 from db034595-919c-4acf-8a27-7b1c2812d980 using man macros.