Vocabulary/hat

From J Wiki
Jump to navigation Jump to search

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

^ y Exponential

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


ey, the y-th power of the mathematical constant: e .

The antilogarithm of a natural logarithm.

   ^1
2.71828
   ^2
7.38906
   ^ ^. 123.45
123.45

Related Primitives

Logarithm (^. y)


Use These Combinations

Combinations using ^ y that have exceptionally good performance include:

What it does Type;

Precisions;
Ranks

Syntax Variants;

Restrictions

Benefits;

Bug Warnings

eπy ^@o. y handles large values of y


x ^ y Power

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


xy, the y-th power of numeric noun: x .

   2^8
256

Related Primitives

Logarithm (x ^. y)


Details

1. Some results are defined in J that are often left undefined:

  • 0 ^ 0 = 1
  • _ ^ 0 = 1
  • 1 ^ _ = 1

2. Taking a rational power of an extended integer produces a floating-point result whenever the denominator of the power is not 1.


Use These Combinations

Combinations using x ^ y that have exceptionally good performance include:

What it does Type;

Precisions;
Ranks

Syntax Variants;

Restrictions

Benefits;

Bug Warnings

Integer powers non-complex x, integer y x ^ y Uses repeated multiplication (avoids log)
Powers mod(m) integer, extended integer x m&|@^ y

m&|@(n&^) y

Avoids the large result of exponentiation


x ^!.p y Stope Function

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


x ^!.p y is x*(x+p)*(x+2*p)*... for y terms.

   5 ^!.1 (3)   NB. 5 * 6 * 7
210

Common Uses

1. Calculate the number of permutations of x things taken y at a time, xPy

   5 ^!._1 (3)   NB. 5 * 4 * 3
60

2. Calculate the rising Pochhammer symbol (x)y as used in the hypergeometric function

   5.1 ^!.1 (3)  NB. 5.1 * 6.1 * 7.1
220.881

More Information

1. y must be nonnegative and tolerantly equal to an integer.

2. x ^!.p y is the same as */x + p*i. y .