Sqrt


Sqrt(x)

Returns the square root of «x». Unless you are using complex numbers, «x» should be positive or zero.

Square root of negative numbers

When you evaluate Sqrt of a negative real number, the behavior of Sqrt depends on whether you have enabled complex numbers.

If you have not enabled complex numbers, a warning is issued, Square root of a negative number, which you won't see if you have the Show Result Warnings preference turned off, or if the expression is inside IgnoreWarnings. If you elect to ignore warnings, the result is NaN.

If you have enabled complex numbers, the result is an imaginary number. For example, Sqrt(-1) returns 1j.

Square root of complex numbers

If you evaluate Sqrt on a complex number, the result is a complex number. This does not depend on having complex numbers enabled.

Examples

Sqrt(0) → 0
Sqrt(1) → 1
Sqrt(25) → 5
Sqrt(3^2 + 4^2) → 5
Sqrt(0..10) → [0, 1, 1.414, 1.732, 2, 2.236, 2.449, 2.646, 2.828, 3, 3.162]
Sqrt(1j) → 0.707 + 0.707j
Sqrt(2j) → 1+1j
Sqrt(-3-2j) → .5502-1.817j

With complex numbers not enabled:

Sqrt(-1) → NaN { with a warning }

With complex numbers enabled:

Sqrt(-1) → 1j

History

This function was introduced in Analytica 4.5.

See Also

Comments


You are not allowed to post comments.