# Normalize

## Normalize(y*, x, i*)

Rescales the values in «y» so that the area under the curve described by the points (x, y') is equal to 1, where *y'* is the result. When either «y» or «x» is an index, you can omit «i», and use just Normalize(y, x), although it is highly recommended that you always include the «i» parameter to avoid mistakes and mis-interpretation that may result when it is omitted.

Normalize(y, x, i) is equivalent to:

`y/Area(y, x, i: i)`

Normalize does not force the values along index «i» to sum to 1; to make the values sum to 1, use `y/Sum(y, i).`

Normalize does not cause the length of the resulting vector to be 1. To normalize in that sense, use `y/Sqrt(Sum(y^2, i)).`

## Library

Array functions

## Treatment of null values

When «x» contains a Null value, that point has no impact the normalization constant.

When «y» contains a Null value, the result for that cell will be null, and the point is interpreted as a gap in the function, so that the trapezoid extending from the previous «x» value to the next «x» value is not included in the normalization constant. See the wiki page on Integrate for more details about this treatment.

## Ordering of points

Normalize treats the points as a set of points, such that the ordering of the points does not impact the result. It is usually cleanest if the points are increasing in «x», but if they aren't, the result for each point is the same you would get for that point if you first sorted the points along «x». The one exception to order-invariance is when the same value occurs twice in «x», which encodes a discontinuity. In this case, the first point with the given «x» value provides the y-value to the left, and the last such point provides the value to the right of the discontinuity.

Enable comment auto-refresher