>Simple statistics

# Simple statistics

## Name

Simple statistics -- a basic structure for computing min, max, average and variance.

## Synopsis

 ``` #include struct GtsRange; void gts_range_init (GtsRange *r); void gts_range_add_value (GtsRange *r, gdouble val); void gts_range_update (GtsRange *r); void gts_range_reset (GtsRange *r); void gts_range_print (GtsRange *r, FILE *fptr);```

## Description

Using gts_range_init(), gts_range_add_value() and gts_range_update(), you can easily maintain basic statistics about an ensemble of values.

## Details

### struct GtsRange

 ```struct GtsRange { gdouble min, max, sum, sum2, mean, stddev; guint n; };```

A simple statistics structure.

 gdouble min Minimum value of the population. gdouble max Maximum value of the population. gdouble sum gdouble sum2 gdouble mean Average value of the population. gdouble stddev Standard deviation of the population. guint n Number of samples in the population.

### gts_range_init ()

 `void gts_range_init (GtsRange *r);`

Initializes a GtsRange.

 r : a GtsRange.

 ```void gts_range_add_value (GtsRange *r, gdouble val);```

 r : a GtsRange. val : a value to add to r.

### gts_range_update ()

 `void gts_range_update (GtsRange *r);`

 r : a GtsRange.

### gts_range_reset ()

 `void gts_range_reset (GtsRange *r);`

Sets all the fields of r to 0.

 r : a GtsRange.

### gts_range_print ()

 ```void gts_range_print (GtsRange *r, FILE *fptr);```

Writes a text representation of r in fptr.

 r : a GtsRange. fptr : a file pointer.