Vocabulary/percentco

From J Wiki
Jump to navigation Jump to search

>> <<   Down to: Dyad   Back to: Vocabulary Thru to: Dictionary

%: y Square Root

Rank 0 -- operates on individual atoms of y, producing a result of the same shape -- WHY IS THIS IMPORTANT?


The square root of y .

   %: 49
7

Common Uses

Can lead to neater tacit expressions than using (y^0.5).


More Information

Square Root video

Related Primitives

Double (+: y), Square (*: y), Halve (-: y)


x %: y Root

Rank 0 0 -- operates on individual atoms of x and y, producing a result of the same shape -- WHY IS THIS IMPORTANT?


The x-th root of y .

   2 %: 49     NB. square-root
7
   3 %: 49     NB. cube-root
3.65931

Common Uses

Can lead to neater tacit expressions than using (y^%x).


Details

1. %: y and x %: y return the principal value of the root, which is defined as  ^ (^. y) % x

The logarithm (^.) is in turn defined to use the angle in the range: (-π, π]

A consequence of this definition is that all roots of negative numbers are complex, even cube roots:

   3 %: _1
0.5j0.866025


2. Taking an integer root of an extended integer by an integer (extended or not) produces an extended integer if the quotient is an integer, or floating-point otherwise.