roots ( x t -- seq ) (original) (raw)

roots ( x t -- seq )

Vocabulary
math.functions

Inputs

x a number
t an integer

Outputs

seq a sequence

Word description
Outputs the t roots of a number x.

Notes
The results are not necessarily real.

Definition

USING: kernel math math.constants sequences ;

IN: math.functions

: roots ( x t -- seq )
[ [ log ] [ recip ] bi* * e^ ]
[ recip 2pi * 0 swap complex boa e^ ]
[ [ ^ * ] 2with map ] tri ;