# Vocabulary/ampdotco

>>
<< ` `
Back to: Vocabulary
Thru to: Dictionary

`[x] u&.:v y`Under Conjunction

Rank Infinity *-- operates on [x and] y as a whole --*
WHY IS THIS IMPORTANT?

Executes `v` on the argument(s); then executes `u` on the result(s) of `v`;
then executes ` v^:_1 ` (i.e. the obverse of `v`) on the result of `u`, giving the end result.

In mathematical terms:

- Verb
`v`defines a*transformation*of the argument(s) (*x*and)*y***taken as a whole**into the*v-domain* - Next, verb
`u`operates on the transformed argument(s) - Lastly the result is transformed back from the
*v-domain*to the original domain.

We say that `u` is *applied under* `v`.

**Example:**
Addition (`+`) *applied under* logarithm (`^.`) gives multiplication

u =: + v =: ^. 3 4 u&.:v 5 1 15 4

Under (Dual) (`&.`) happens to give the same answer as (`&.:`) here.
But only because (`+`) and (`^.`) both have rank 0,
which ensures (say) that ` 3 4 ^. 5 1 ` is the same as ` (3 ^. 5) , (4 ^. 1) `

3 4 u&.v 5 1 15 4

### Common Uses

1. Compute the Geometric Mean as: the Arithmetic Mean taken in the "log-domain"

y =: 2 4 8 16 mean =: +/ % # NB. The Arithmetic Mean of y mean y 7.5 ^ mean ^. y NB. The Geometric Mean: log (^.), then arithmetic mean, then antilog (^) 5.65685 mean&.:^. y NB. ditto, but done using (&.:) NOTE: (&.) DOES NOT WORK 5.65685

**Note:**
Under (Dual) (`&.`) **does not give the same answer** as (`&.:`)

mean&.:^. y 5.65685 mean&.^. y 2 4 8 16

Contrast this with the above Example of addition under logarithm.

This is because `mean` does not have rank 0, it has rank Infinity

mean b.0 _ _ _ (mean&.^.) b.0 0 0 0

See below: **More Information (1.)**

2. Compute *standard deviation* as the root-mean-square of a list of differences from the mean value

y =: 0 _3 1 2 NB. list of differences from the mean value u =: mean =: +/ % # NB. mean value of y v =: *: NB. square of y stddev =: u&.:v NB. square root of mean of sum of squares of y stddev 0 _3 1 2 1.87083

3. Compute Vector Length (Euclidean Length) in **R**^{n}

u=. +/ v=. *: y=. 6 3 2 u &. v y NB. u is acting on each list item of v y (that wasn't the intension) 6 3 2 u &.: v y NB. u is acting on the result of v y (the whole list) 7 %: +/ *: y NB. straight forward computing of the norm 7

### Semiduals `x u&.:(a:`v) y` and `x u&.:(v`a:) y`

The operation encapsulated by `u&.:v` is used often and is important as a notation to aid thought. When the operation is dyadic, sometimes the sequence of transforming/operating/transforming back should be applied to just one argument, with the other argument being passed unchanged into `u`. This can be represented by a gerund form where `a:` indicates which argument is to be used unmodified:

`x u&.:(a:`v) y`is`v^:_1 x u (v y)``x u&.:(v`a:) y`is`v^:_1 (v x) u y`

1 +&.:(a:`^.) 2 3 5.43656 8.15485 ^ 1 + ^. 2 3 5.43656 8.15485

### Related Primitives

Under (Dual) (`&.`)

### More Information

1. Under (Dual) (`&.`) differs from Under (`&.:`) in that ` u&.v ` *applies* `u` *under* `v` cell-by-cell,
whereas ` u&.:v ` *applies* `u` *under* `v` to the entire argument(s) (`x` and) `y` .
Template:Admon/caution

2. ` [x] u&.:v y ` is the same as

`v^:_1 [x] u&:v y``[x] v^:_1 @: (u&:v) y``v^:_1 [(v x)] u (v y)`

3. ` u&.:v y ` is the same as

`v^:_1 u v y``v^:_1 @: u @: v y``([: v^:_1 [: u v) y`

4. ` x u&.:v y ` is the same as

`v^:_1 (v x) u (v y)``x v^:_1 @: u &: v y``x ([: v^:_1 v@[ u v@]) y`