Close
Close window
iroot - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.
Maplesoft logo
Maplesoft logo

Online Help

All Products Maple MapleSim


[フレーム] [フレーム]

isqrt

integer square root

iroot

integer n^th root

Calling Sequence

isqrt(x)

iroot(x, n, 'exact')

Parameters

x

-

integer

n

-

integer

exact

-

(optional) name

Description

The isqrt function computes an integer approximation to the square root of x. The approximation is exact for perfect squares, and the error is less than 1 otherwise. Note: if x<0, isqrt(x) returns 0.

The iroot function computes an integer approximation to the n^th root of x. The approximation is exact for perfect powers, and the error is less than 1 otherwise. If the optional third argument is given, it is set to true or false to show whether the root is exact or not. Note: if x<0, and n is even, iroot(x, n) returns 0; if x<0, and n is odd, iroot(x, n) returns - iroot(- x, n).

Thread Safety

The isqrt command is thread-safe as of Maple 15.

For more information on thread safety, see index/threadsafe .

Examples

>

isqrt4

2

(1)
>

isqrt5

2

(2)
>

isqrt8

3

(3)
>

isqrt10

3

(4)
>

iroot100&comma;3

5

(5)
>

iroot10&comma;2&comma;exact&semi;exact

3

false

(6)
>

iroot50653&comma;3&comma;exact&semi;exact

37

true

(7)
>

iroot200&comma;8

2

(8)

If x<0, isqrt(x) returns 0.

>

isqrt4

0

(9)

The iroot command will calculate odd roots of negative numbers.

>

iroot27&comma;3&comma;exact&semi;exact

−3

true

(10)
>

iroot500&comma;5&comma;exact&semi;exact

−3

false

(11)


Download Help Document

AltStyle によって変換されたページ (->オリジナル) /