From J Wiki
Jump to: navigation, search

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

o. y Pi Times

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

Returns (π times y) given any number y .

   o. i.5
0 3.14159 6.28319 9.42478 12.5664

Common uses

1. Represent, in J, common physics expressions involving π

   sin=: 1&o.   NB. see below: dyadic (o.)
   pi=: o. : ([ * [: o. ])
   r=: 10

   pi 0 1 2
0 3.14159 6.28319
   2 pi r

You can also use J's 'p'-notation to accurately represent expressions involving π

   1p1          NB. pi
   3p2          NB. 3 times pi-squared
   3* (1p1)^2   NB. (equiv)

2. Convert radians <--> degrees

   rfd=: 180 %~ o.   NB. radians from degrees
   dfr=: rfd^:_1     NB. degrees from radians

   rfd 180
   dfr 1p1
   dfr 0.5p1

Use These Combinations

Combinations using o. y that have exceptionally good performance include:

What it does Type;


Syntax Variants;



Bug Warnings

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

x o. y Circle Function

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

Combines the common trigonometric and hyperbolic functions, and their inverses, without the need for reserved words like sin, cos, etc.

   cop=: 0&o.        NB. sqrt (1-(y^2))
   sin=: 1&o.        NB. sine of y
   cos=: 2&o.        NB. cosine of y
   tan=: 3&o.        NB. tangent of y
   coh=: 4&o.        NB. sqrt (1+(y^2))
   sinh=: 5&o.       NB. hyperbolic sine of y
   cosh=: 6&o.       NB. hyperbolic cosine of y
   tanh=: 7&o.       NB. hyperbolic tangent of y
   conh=: 8&o.       NB. sqrt -(1+(y^2))
   real=: 9&o.       NB. Real part of y
   magn=: 10&o.      NB. Magnitude of y
   imag=: 11&o.      NB. Imaginary part of y
   angle=: 12&o.     NB. Angle of y

   arcsin=:  _1&o.   NB. inverse sine
   arccos=:  _2&o.   NB. inverse cosine
   arctan=:  _3&o.   NB. inverse tangent
   cohn=:    _4&o.   NB. sqrt (_1+(y^2))
   arcsinh=: _5&o.   NB. inverse hyperbolic sine
   arccosh=: _6&o.   NB. inverse hyperbolic cosine
   arctanh=: _7&o.   NB. inverse hyperbolic tangent
   nconh=:   _8&o.   NB. -sqrt -(1+(y^2))
   same=:    _9&o.   NB. y
   conj=:    _10&o.  NB. complex conjugate of y
   jdot=:    _11&o.  NB. j. y
   expj=:    _12&o.  NB. ^ j. y

Common uses

1. To work with trigonometric functions.

2. 9 o. y (real) and 11 o. y (imag) are the best ways to extract the real and imaginary parts of y.

3. To manipulate screen graphics.

4. cop offers occasional convenience in modifying circle functions to work with complementary y

likewise coh for hyperbolic functions

cop leverages the identity: assert 1 -: (*: sin y) + (*: cos y) for all y

   sin rfd 30
   cop@sin rfd 60

5. Euler's Identity 0 = 1 + e^ i π^

   1 + expj 1p1

Related Primitives

Real/Imag (+. y), Signum (Unit Circle) (* y), Length/Angle (*. y), Magnitude (* y), Imaginary * Complex (j.), Angle * Polar (r.)

More Information

1. The inverse of  x o. y is  (-x) o. y for _7x7.

2. As a mnemonic, the odd values of x correspond to odd functions and the even values of x to even functions.