> ## Documentation Index
> Fetch the complete documentation index at: https://docsa.stemfard.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Stemfard matrix statistics endpoints: mean, sum, variance

> Reference for the 21 Stemfard matrix statistics endpoints — min, max, sum, mean, median, variance, and standard deviation across rows, columns, or the matrix.

The matrix statistics endpoints let you compute descriptive statistics on a matrix — across individual rows, across individual columns, or over all elements at once. There are 21 endpoints in this group: a combined endpoint that accepts a `type` parameter to choose the specific statistic, and 20 individual endpoints organized by operation. All endpoints accept a single input matrix `a` and the full set of [common request parameters](/api-reference/overview#common-request-parameters).

The sample matrix below is used throughout the examples on this page:

```
A = [[4, 7, 2, 1],
     [8, 3, 6, 5],
     [9, 0, 4, 3]]
```

***

## Combined endpoint

Use this endpoint to compute any statistic by setting the `type` field.

**`POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics`**

### Parameters

<ParamField body="a" type="number[][]" required>
  The input matrix, expressed as an array of row arrays.
</ParamField>

<ParamField body="type" type="string" required>
  The statistic to compute. Accepted values: `"all"`, `"row-min"`, `"col-min"`, `"mat-min"`, `"row-max"`, `"col-max"`, `"mat-max"`, `"row-sum"`, `"col-sum"`, `"mat-sum"`, `"row-mean"`, `"col-mean"`, `"mat-mean"`, `"row-median"`, `"col-median"`, `"mat-median"`, `"row-var"`, `"col-var"`, `"mat-var"`, `"row-std"`, `"col-std"`, `"mat-std"`.

  Pass `"all"` to compute and return every statistic in a single response.
</ParamField>

<ParamField body="result_name" type="string" default="ans">
  Name assigned to the computed result in the response.
</ParamField>

<ParamField body="api_level" type="string" default="detailed">
  Response verbosity: `"lite"`, `"standard"`, or `"detailed"`.
</ParamField>

<ParamField body="steps_bg" type="boolean" default="true">
  Include background theory alongside solution steps.
</ParamField>

<ParamField body="steps_output_formats" type="string[]" default="[&#x22;&#x22;]">
  Format for step content: `"html"`, `"latex"`, or `"speech"`.
</ParamField>

<ParamField body="decimals" type="integer | null" default="null">
  Decimal precision for rounding the result. Pass `null` for full precision.
</ParamField>

<ParamField body="apply_decimals_in_steps" type="boolean" default="false">
  Apply `decimals` rounding to intermediate step values.
</ParamField>

<ParamField body="request_params" type="boolean" default="true">
  Include normalized request parameters in the response.
</ParamField>

<ParamField body="learning_pathways" type="boolean" default="true">
  Include curated learning resource links in the response.
</ParamField>

<ParamField body="related" type="boolean" default="true">
  Include links to related Stemfard endpoints in the response.
</ParamField>

<ParamField body="properties" type="boolean" default="true">
  Include a description of the result object's properties.
</ParamField>

### Example — compute all statistics

<CodeGroup>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics \
    --header 'Authorization: Bearer <your-api-key>' \
    --header 'Content-Type: application/json' \
    --data '{
      "a": [[4, 7, 2, 1], [8, 3, 6, 5], [9, 0, 4, 3]],
      "type": "all",
      "result_name": "stats",
      "api_level": "standard",
      "decimals": 4
    }'
  ```

  ```python Python theme={null}
  import requests

  data = requests.post(
      'https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics',
      headers={
          'Authorization': 'Bearer <your-api-key>',
          'Content-Type': 'application/json',
      },
      json={
          'a': [[4, 7, 2, 1], [8, 3, 6, 5], [9, 0, 4, 3]],
          'type': 'all',
          'result_name': 'stats',
          'api_level': 'standard',
          'decimals': 4,
      },
  ).json()
  ```
</CodeGroup>

```json 200 theme={null}
{
  "stats": {
    "row_min": [1, 3, 0],
    "col_min": [4, 0, 2, 1],
    "mat_min": 0,
    "row_max": [7, 8, 9],
    "col_max": [9, 7, 6, 5],
    "mat_max": 9,
    "row_sum": [14, 22, 16],
    "col_sum": [21, 10, 12, 9],
    "mat_sum": 52,
    "row_mean": [3.5, 5.5, 4.0],
    "col_mean": [7.0, 3.3333, 4.0, 3.0],
    "mat_mean": 4.3333,
    "row_median": [3.0, 5.5, 3.5],
    "col_median": [8.0, 3.0, 4.0, 3.0],
    "mat_median": 4.0,
    "row_var": [5.25, 3.6875, 10.6875],
    "col_var": [4.6667, 8.6667, 2.6667, 2.6667],
    "mat_var": 6.8056,
    "row_std": [2.2913, 1.9209, 3.2692],
    "col_std": [2.1602, 2.9439, 1.6330, 1.6330],
    "mat_std": 2.6087
  }
}
```

***

## Individual endpoints

The individual endpoints are grouped below by operation type. For all endpoints, `a` is the only operation-specific parameter; all other parameters are the [common request parameters](/api-reference/overview#common-request-parameters).

The base path for all individual endpoints is:
`/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/`

### Min and max

<AccordionGroup>
  <Accordion title="POST .../row-min — minimum of each row">
    Returns an array containing the minimum value from each row of `a`.

    **`POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/row-min`**

    <ParamField body="a" type="number[][]" required>
      The input matrix.
    </ParamField>

    <ParamField body="result_name" type="string" default="ans">
      Name for the result in the response.
    </ParamField>

    <ParamField body="api_level" type="string" default="detailed">
      Response verbosity: `"lite"`, `"standard"`, or `"detailed"`.
    </ParamField>

    <ParamField body="decimals" type="integer | null" default="null">
      Decimal precision for rounding.
    </ParamField>

    **Example**

    <CodeGroup>
      ```bash cURL theme={null}
      curl --request POST \
        --url https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/row-min \
        --header 'Authorization: Bearer <your-api-key>' \
        --header 'Content-Type: application/json' \
        --data '{
          "a": [[4, 7, 2, 1], [8, 3, 6, 5], [9, 0, 4, 3]],
          "result_name": "row_minimums",
          "api_level": "lite"
        }'
      ```

      ```python Python theme={null}
      import requests

      data = requests.post(
          'https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/row-min',
          headers={'Authorization': 'Bearer <your-api-key>', 'Content-Type': 'application/json'},
          json={
              'a': [[4, 7, 2, 1], [8, 3, 6, 5], [9, 0, 4, 3]],
              'result_name': 'row_minimums',
              'api_level': 'lite',
          },
      ).json()
      ```
    </CodeGroup>

    ```json 200 theme={null}
    {
      "row_minimums": [1, 3, 0]
    }
    ```
  </Accordion>

  <Accordion title="POST .../col-min — minimum of each column">
    Returns an array containing the minimum value from each column of `a`.

    **`POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/col-min`**

    <ParamField body="a" type="number[][]" required>
      The input matrix.
    </ParamField>

    <ParamField body="result_name" type="string" default="ans">
      Name for the result in the response.
    </ParamField>

    <ParamField body="api_level" type="string" default="detailed">
      Response verbosity: `"lite"`, `"standard"`, or `"detailed"`.
    </ParamField>

    <ParamField body="decimals" type="integer | null" default="null">
      Decimal precision for rounding.
    </ParamField>

    **Example**

    <CodeGroup>
      ```bash cURL theme={null}
      curl --request POST \
        --url https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/col-min \
        --header 'Authorization: Bearer <your-api-key>' \
        --header 'Content-Type: application/json' \
        --data '{
          "a": [[4, 7, 2, 1], [8, 3, 6, 5], [9, 0, 4, 3]],
          "result_name": "col_minimums",
          "api_level": "lite"
        }'
      ```

      ```python Python theme={null}
      import requests

      data = requests.post(
          'https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/col-min',
          headers={'Authorization': 'Bearer <your-api-key>', 'Content-Type': 'application/json'},
          json={
              'a': [[4, 7, 2, 1], [8, 3, 6, 5], [9, 0, 4, 3]],
              'result_name': 'col_minimums',
              'api_level': 'lite',
          },
      ).json()
      ```
    </CodeGroup>

    ```json 200 theme={null}
    {
      "col_minimums": [4, 0, 2, 1]
    }
    ```
  </Accordion>

  <Accordion title="POST .../mat-min — minimum of the entire matrix">
    Returns the single smallest value across all elements of `a`.

    **`POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/mat-min`**

    <ParamField body="a" type="number[][]" required>
      The input matrix.
    </ParamField>

    <ParamField body="result_name" type="string" default="ans">
      Name for the result in the response.
    </ParamField>

    <ParamField body="api_level" type="string" default="detailed">
      Response verbosity: `"lite"`, `"standard"`, or `"detailed"`.
    </ParamField>

    **Example**

    ```bash cURL theme={null}
    curl --request POST \
      --url https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/mat-min \
      --header 'Authorization: Bearer <your-api-key>' \
      --header 'Content-Type: application/json' \
      --data '{"a": [[4, 7, 2, 1], [8, 3, 6, 5], [9, 0, 4, 3]], "result_name": "minimum", "api_level": "lite"}'
    ```

    ```json 200 theme={null}
    {
      "minimum": 0
    }
    ```
  </Accordion>

  <Accordion title="POST .../row-max — maximum of each row">
    Returns an array containing the maximum value from each row of `a`.

    **`POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/row-max`**

    <ParamField body="a" type="number[][]" required>
      The input matrix.
    </ParamField>

    <ParamField body="result_name" type="string" default="ans">
      Name for the result in the response.
    </ParamField>

    <ParamField body="api_level" type="string" default="detailed">
      Response verbosity: `"lite"`, `"standard"`, or `"detailed"`.
    </ParamField>

    **Example**

    ```bash cURL theme={null}
    curl --request POST \
      --url https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/row-max \
      --header 'Authorization: Bearer <your-api-key>' \
      --header 'Content-Type: application/json' \
      --data '{"a": [[4, 7, 2, 1], [8, 3, 6, 5], [9, 0, 4, 3]], "result_name": "row_maximums", "api_level": "lite"}'
    ```

    ```json 200 theme={null}
    {
      "row_maximums": [7, 8, 9]
    }
    ```
  </Accordion>

  <Accordion title="POST .../col-max — maximum of each column">
    Returns an array containing the maximum value from each column of `a`.

    **`POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/col-max`**

    <ParamField body="a" type="number[][]" required>
      The input matrix.
    </ParamField>

    <ParamField body="result_name" type="string" default="ans">
      Name for the result in the response.
    </ParamField>

    <ParamField body="api_level" type="string" default="detailed">
      Response verbosity: `"lite"`, `"standard"`, or `"detailed"`.
    </ParamField>

    **Example**

    ```bash cURL theme={null}
    curl --request POST \
      --url https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/col-max \
      --header 'Authorization: Bearer <your-api-key>' \
      --header 'Content-Type: application/json' \
      --data '{"a": [[4, 7, 2, 1], [8, 3, 6, 5], [9, 0, 4, 3]], "result_name": "col_maximums", "api_level": "lite"}'
    ```

    ```json 200 theme={null}
    {
      "col_maximums": [9, 7, 6, 5]
    }
    ```
  </Accordion>

  <Accordion title="POST .../mat-max — maximum of the entire matrix">
    Returns the single largest value across all elements of `a`.

    **`POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/mat-max`**

    <ParamField body="a" type="number[][]" required>
      The input matrix.
    </ParamField>

    <ParamField body="result_name" type="string" default="ans">
      Name for the result in the response.
    </ParamField>

    <ParamField body="api_level" type="string" default="detailed">
      Response verbosity: `"lite"`, `"standard"`, or `"detailed"`.
    </ParamField>

    **Example**

    ```bash cURL theme={null}
    curl --request POST \
      --url https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/mat-max \
      --header 'Authorization: Bearer <your-api-key>' \
      --header 'Content-Type: application/json' \
      --data '{"a": [[4, 7, 2, 1], [8, 3, 6, 5], [9, 0, 4, 3]], "result_name": "maximum", "api_level": "lite"}'
    ```

    ```json 200 theme={null}
    {
      "maximum": 9
    }
    ```
  </Accordion>
</AccordionGroup>

### Sum and mean

<AccordionGroup>
  <Accordion title="POST .../row-sum — sum of each row">
    Returns an array containing the sum of all elements in each row of `a`.

    **`POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/row-sum`**

    <ParamField body="a" type="number[][]" required>
      The input matrix.
    </ParamField>

    <ParamField body="result_name" type="string" default="ans">
      Name for the result in the response.
    </ParamField>

    <ParamField body="api_level" type="string" default="detailed">
      Response verbosity: `"lite"`, `"standard"`, or `"detailed"`.
    </ParamField>

    <ParamField body="decimals" type="integer | null" default="null">
      Decimal precision for rounding.
    </ParamField>

    **Example**

    <CodeGroup>
      ```bash cURL theme={null}
      curl --request POST \
        --url https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/row-sum \
        --header 'Authorization: Bearer <your-api-key>' \
        --header 'Content-Type: application/json' \
        --data '{
          "a": [[4, 7, 2, 1], [8, 3, 6, 5], [9, 0, 4, 3]],
          "result_name": "row_totals",
          "api_level": "standard"
        }'
      ```

      ```javascript JavaScript theme={null}
      const response = await fetch(
        'https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/row-sum',
        {
          method: 'POST',
          headers: {
            'Authorization': 'Bearer <your-api-key>',
            'Content-Type': 'application/json',
          },
          body: JSON.stringify({
            a: [[4, 7, 2, 1], [8, 3, 6, 5], [9, 0, 4, 3]],
            result_name: 'row_totals',
            api_level: 'standard',
          }),
        }
      );
      const data = await response.json();
      ```
    </CodeGroup>

    ```json 200 theme={null}
    {
      "row_totals": [14, 22, 16]
    }
    ```
  </Accordion>

  <Accordion title="POST .../col-sum — sum of each column">
    Returns an array containing the sum of all elements in each column of `a`.

    **`POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/col-sum`**

    <ParamField body="a" type="number[][]" required>
      The input matrix.
    </ParamField>

    <ParamField body="result_name" type="string" default="ans">
      Name for the result in the response.
    </ParamField>

    <ParamField body="api_level" type="string" default="detailed">
      Response verbosity: `"lite"`, `"standard"`, or `"detailed"`.
    </ParamField>

    <ParamField body="decimals" type="integer | null" default="null">
      Decimal precision for rounding.
    </ParamField>

    **Example**

    ```bash cURL theme={null}
    curl --request POST \
      --url https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/col-sum \
      --header 'Authorization: Bearer <your-api-key>' \
      --header 'Content-Type: application/json' \
      --data '{"a": [[4, 7, 2, 1], [8, 3, 6, 5], [9, 0, 4, 3]], "result_name": "col_totals", "api_level": "lite"}'
    ```

    ```json 200 theme={null}
    {
      "col_totals": [21, 10, 12, 9]
    }
    ```
  </Accordion>

  <Accordion title="POST .../mat-sum — sum of all elements">
    Returns the sum of every element in the matrix.

    **`POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/mat-sum`**

    <ParamField body="a" type="number[][]" required>
      The input matrix.
    </ParamField>

    <ParamField body="result_name" type="string" default="ans">
      Name for the result in the response.
    </ParamField>

    <ParamField body="api_level" type="string" default="detailed">
      Response verbosity: `"lite"`, `"standard"`, or `"detailed"`.
    </ParamField>

    **Example**

    ```bash cURL theme={null}
    curl --request POST \
      --url https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/mat-sum \
      --header 'Authorization: Bearer <your-api-key>' \
      --header 'Content-Type: application/json' \
      --data '{"a": [[4, 7, 2, 1], [8, 3, 6, 5], [9, 0, 4, 3]], "result_name": "total", "api_level": "lite"}'
    ```

    ```json 200 theme={null}
    {
      "total": 52
    }
    ```
  </Accordion>

  <Accordion title="POST .../row-mean — mean of each row">
    Returns an array containing the arithmetic mean of the elements in each row of `a`.

    **`POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/row-mean`**

    <ParamField body="a" type="number[][]" required>
      The input matrix.
    </ParamField>

    <ParamField body="result_name" type="string" default="ans">
      Name for the result in the response.
    </ParamField>

    <ParamField body="api_level" type="string" default="detailed">
      Response verbosity: `"lite"`, `"standard"`, or `"detailed"`.
    </ParamField>

    <ParamField body="decimals" type="integer | null" default="null">
      Decimal precision for rounding.
    </ParamField>

    **Example**

    ```bash cURL theme={null}
    curl --request POST \
      --url https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/row-mean \
      --header 'Authorization: Bearer <your-api-key>' \
      --header 'Content-Type: application/json' \
      --data '{"a": [[4, 7, 2, 1], [8, 3, 6, 5], [9, 0, 4, 3]], "result_name": "row_means", "api_level": "lite", "decimals": 4}'
    ```

    ```json 200 theme={null}
    {
      "row_means": [3.5, 5.5, 4.0]
    }
    ```
  </Accordion>

  <Accordion title="POST .../col-mean — mean of each column">
    Returns an array containing the arithmetic mean of the elements in each column of `a`.

    **`POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/col-mean`**

    <ParamField body="a" type="number[][]" required>
      The input matrix.
    </ParamField>

    <ParamField body="result_name" type="string" default="ans">
      Name for the result in the response.
    </ParamField>

    <ParamField body="api_level" type="string" default="detailed">
      Response verbosity: `"lite"`, `"standard"`, or `"detailed"`.
    </ParamField>

    <ParamField body="decimals" type="integer | null" default="null">
      Decimal precision for rounding.
    </ParamField>

    **Example**

    ```bash cURL theme={null}
    curl --request POST \
      --url https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/col-mean \
      --header 'Authorization: Bearer <your-api-key>' \
      --header 'Content-Type: application/json' \
      --data '{"a": [[4, 7, 2, 1], [8, 3, 6, 5], [9, 0, 4, 3]], "result_name": "col_means", "api_level": "lite", "decimals": 4}'
    ```

    ```json 200 theme={null}
    {
      "col_means": [7.0, 3.3333, 4.0, 3.0]
    }
    ```
  </Accordion>

  <Accordion title="POST .../mat-mean — mean of all elements">
    Returns the arithmetic mean of all elements in the matrix.

    **`POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/mat-mean`**

    <ParamField body="a" type="number[][]" required>
      The input matrix.
    </ParamField>

    <ParamField body="result_name" type="string" default="ans">
      Name for the result in the response.
    </ParamField>

    <ParamField body="api_level" type="string" default="detailed">
      Response verbosity: `"lite"`, `"standard"`, or `"detailed"`.
    </ParamField>

    <ParamField body="decimals" type="integer | null" default="null">
      Decimal precision for rounding.
    </ParamField>

    **Example**

    ```bash cURL theme={null}
    curl --request POST \
      --url https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/mat-mean \
      --header 'Authorization: Bearer <your-api-key>' \
      --header 'Content-Type: application/json' \
      --data '{"a": [[4, 7, 2, 1], [8, 3, 6, 5], [9, 0, 4, 3]], "result_name": "mean", "api_level": "lite", "decimals": 4}'
    ```

    ```json 200 theme={null}
    {
      "mean": 4.3333
    }
    ```
  </Accordion>
</AccordionGroup>

### Median

<AccordionGroup>
  <Accordion title="POST .../row-median — median of each row">
    Returns an array containing the median value of the elements in each row of `a`.

    **`POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/row-median`**

    <ParamField body="a" type="number[][]" required>
      The input matrix.
    </ParamField>

    <ParamField body="result_name" type="string" default="ans">
      Name for the result in the response.
    </ParamField>

    <ParamField body="api_level" type="string" default="detailed">
      Response verbosity: `"lite"`, `"standard"`, or `"detailed"`.
    </ParamField>

    <ParamField body="decimals" type="integer | null" default="null">
      Decimal precision for rounding.
    </ParamField>

    **Example**

    <CodeGroup>
      ```bash cURL theme={null}
      curl --request POST \
        --url https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/row-median \
        --header 'Authorization: Bearer <your-api-key>' \
        --header 'Content-Type: application/json' \
        --data '{
          "a": [[4, 7, 2, 1], [8, 3, 6, 5], [9, 0, 4, 3]],
          "result_name": "row_medians",
          "api_level": "standard",
          "decimals": 2
        }'
      ```

      ```python Python theme={null}
      import requests

      data = requests.post(
          'https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/row-median',
          headers={'Authorization': 'Bearer <your-api-key>', 'Content-Type': 'application/json'},
          json={
              'a': [[4, 7, 2, 1], [8, 3, 6, 5], [9, 0, 4, 3]],
              'result_name': 'row_medians',
              'api_level': 'standard',
              'decimals': 2,
          },
      ).json()
      ```
    </CodeGroup>

    ```json 200 theme={null}
    {
      "row_medians": [3.0, 5.5, 3.5]
    }
    ```

    <Note>
      For rows with an even number of elements, the median is the average of the two middle values after sorting. For the row `[8, 3, 6, 5]`, the sorted order is `[3, 5, 6, 8]`, so the median is `(5 + 6) / 2 = 5.5`.
    </Note>
  </Accordion>

  <Accordion title="POST .../col-median — median of each column">
    Returns an array containing the median value of the elements in each column of `a`.

    **`POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/col-median`**

    <ParamField body="a" type="number[][]" required>
      The input matrix.
    </ParamField>

    <ParamField body="result_name" type="string" default="ans">
      Name for the result in the response.
    </ParamField>

    <ParamField body="api_level" type="string" default="detailed">
      Response verbosity: `"lite"`, `"standard"`, or `"detailed"`.
    </ParamField>

    <ParamField body="decimals" type="integer | null" default="null">
      Decimal precision for rounding.
    </ParamField>

    **Example**

    ```bash cURL theme={null}
    curl --request POST \
      --url https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/col-median \
      --header 'Authorization: Bearer <your-api-key>' \
      --header 'Content-Type: application/json' \
      --data '{"a": [[4, 7, 2, 1], [8, 3, 6, 5], [9, 0, 4, 3]], "result_name": "col_medians", "api_level": "lite"}'
    ```

    ```json 200 theme={null}
    {
      "col_medians": [8.0, 3.0, 4.0, 3.0]
    }
    ```
  </Accordion>

  <Accordion title="POST .../mat-median — median of all elements">
    Returns the median value across all elements in the matrix, treating the entire matrix as a flat list of values.

    **`POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/mat-median`**

    <ParamField body="a" type="number[][]" required>
      The input matrix.
    </ParamField>

    <ParamField body="result_name" type="string" default="ans">
      Name for the result in the response.
    </ParamField>

    <ParamField body="api_level" type="string" default="detailed">
      Response verbosity: `"lite"`, `"standard"`, or `"detailed"`.
    </ParamField>

    <ParamField body="decimals" type="integer | null" default="null">
      Decimal precision for rounding.
    </ParamField>

    **Example**

    ```bash cURL theme={null}
    curl --request POST \
      --url https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/mat-median \
      --header 'Authorization: Bearer <your-api-key>' \
      --header 'Content-Type: application/json' \
      --data '{"a": [[4, 7, 2, 1], [8, 3, 6, 5], [9, 0, 4, 3]], "result_name": "median", "api_level": "lite"}'
    ```

    ```json 200 theme={null}
    {
      "median": 4.0
    }
    ```
  </Accordion>
</AccordionGroup>

### Variance and standard deviation

<AccordionGroup>
  <Accordion title="POST .../row-var — variance of each row">
    Returns an array containing the variance of the elements in each row of `a`.

    **`POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/row-var`**

    <ParamField body="a" type="number[][]" required>
      The input matrix.
    </ParamField>

    <ParamField body="result_name" type="string" default="ans">
      Name for the result in the response.
    </ParamField>

    <ParamField body="api_level" type="string" default="detailed">
      Response verbosity: `"lite"`, `"standard"`, or `"detailed"`.
    </ParamField>

    <ParamField body="decimals" type="integer | null" default="null">
      Decimal precision for rounding.
    </ParamField>

    **Example**

    <CodeGroup>
      ```bash cURL theme={null}
      curl --request POST \
        --url https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/row-var \
        --header 'Authorization: Bearer <your-api-key>' \
        --header 'Content-Type: application/json' \
        --data '{
          "a": [[4, 7, 2, 1], [8, 3, 6, 5], [9, 0, 4, 3]],
          "result_name": "row_variances",
          "api_level": "standard",
          "decimals": 4
        }'
      ```

      ```python Python theme={null}
      import requests

      data = requests.post(
          'https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/row-var',
          headers={'Authorization': 'Bearer <your-api-key>', 'Content-Type': 'application/json'},
          json={
              'a': [[4, 7, 2, 1], [8, 3, 6, 5], [9, 0, 4, 3]],
              'result_name': 'row_variances',
              'api_level': 'standard',
              'decimals': 4,
          },
      ).json()
      ```
    </CodeGroup>

    ```json 200 theme={null}
    {
      "row_variances": [5.25, 3.6875, 10.6875]
    }
    ```
  </Accordion>

  <Accordion title="POST .../col-var — variance of each column">
    Returns an array containing the variance of the elements in each column of `a`.

    **`POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/col-var`**

    <ParamField body="a" type="number[][]" required>
      The input matrix.
    </ParamField>

    <ParamField body="result_name" type="string" default="ans">
      Name for the result in the response.
    </ParamField>

    <ParamField body="api_level" type="string" default="detailed">
      Response verbosity: `"lite"`, `"standard"`, or `"detailed"`.
    </ParamField>

    <ParamField body="decimals" type="integer | null" default="null">
      Decimal precision for rounding.
    </ParamField>

    **Example**

    ```bash cURL theme={null}
    curl --request POST \
      --url https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/col-var \
      --header 'Authorization: Bearer <your-api-key>' \
      --header 'Content-Type: application/json' \
      --data '{"a": [[4, 7, 2, 1], [8, 3, 6, 5], [9, 0, 4, 3]], "result_name": "col_variances", "api_level": "lite", "decimals": 4}'
    ```

    ```json 200 theme={null}
    {
      "col_variances": [4.6667, 8.6667, 2.6667, 2.6667]
    }
    ```
  </Accordion>

  <Accordion title="POST .../mat-var — variance of all elements">
    Returns the variance computed across every element in the matrix.

    **`POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/mat-var`**

    <ParamField body="a" type="number[][]" required>
      The input matrix.
    </ParamField>

    <ParamField body="result_name" type="string" default="ans">
      Name for the result in the response.
    </ParamField>

    <ParamField body="api_level" type="string" default="detailed">
      Response verbosity: `"lite"`, `"standard"`, or `"detailed"`.
    </ParamField>

    <ParamField body="decimals" type="integer | null" default="null">
      Decimal precision for rounding.
    </ParamField>

    **Example**

    ```bash cURL theme={null}
    curl --request POST \
      --url https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/mat-var \
      --header 'Authorization: Bearer <your-api-key>' \
      --header 'Content-Type: application/json' \
      --data '{"a": [[4, 7, 2, 1], [8, 3, 6, 5], [9, 0, 4, 3]], "result_name": "variance", "api_level": "lite", "decimals": 4}'
    ```

    ```json 200 theme={null}
    {
      "variance": 6.8056
    }
    ```
  </Accordion>

  <Accordion title="POST .../row-std — standard deviation of each row">
    Returns an array containing the standard deviation of the elements in each row of `a`.

    **`POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/row-std`**

    <ParamField body="a" type="number[][]" required>
      The input matrix.
    </ParamField>

    <ParamField body="result_name" type="string" default="ans">
      Name for the result in the response.
    </ParamField>

    <ParamField body="api_level" type="string" default="detailed">
      Response verbosity: `"lite"`, `"standard"`, or `"detailed"`.
    </ParamField>

    <ParamField body="decimals" type="integer | null" default="null">
      Decimal precision for rounding.
    </ParamField>

    **Example**

    <CodeGroup>
      ```bash cURL theme={null}
      curl --request POST \
        --url https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/row-std \
        --header 'Authorization: Bearer <your-api-key>' \
        --header 'Content-Type: application/json' \
        --data '{
          "a": [[4, 7, 2, 1], [8, 3, 6, 5], [9, 0, 4, 3]],
          "result_name": "row_std_devs",
          "api_level": "standard",
          "decimals": 4
        }'
      ```

      ```python Python theme={null}
      import requests

      data = requests.post(
          'https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/row-std',
          headers={'Authorization': 'Bearer <your-api-key>', 'Content-Type': 'application/json'},
          json={
              'a': [[4, 7, 2, 1], [8, 3, 6, 5], [9, 0, 4, 3]],
              'result_name': 'row_std_devs',
              'api_level': 'standard',
              'decimals': 4,
          },
      ).json()
      ```
    </CodeGroup>

    ```json 200 theme={null}
    {
      "row_std_devs": [2.2913, 1.9209, 3.2692]
    }
    ```
  </Accordion>

  <Accordion title="POST .../col-std — standard deviation of each column">
    Returns an array containing the standard deviation of the elements in each column of `a`.

    **`POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/col-std`**

    <ParamField body="a" type="number[][]" required>
      The input matrix.
    </ParamField>

    <ParamField body="result_name" type="string" default="ans">
      Name for the result in the response.
    </ParamField>

    <ParamField body="api_level" type="string" default="detailed">
      Response verbosity: `"lite"`, `"standard"`, or `"detailed"`.
    </ParamField>

    <ParamField body="decimals" type="integer | null" default="null">
      Decimal precision for rounding.
    </ParamField>

    **Example**

    ```bash cURL theme={null}
    curl --request POST \
      --url https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/col-std \
      --header 'Authorization: Bearer <your-api-key>' \
      --header 'Content-Type: application/json' \
      --data '{"a": [[4, 7, 2, 1], [8, 3, 6, 5], [9, 0, 4, 3]], "result_name": "col_std_devs", "api_level": "lite", "decimals": 4}'
    ```

    ```json 200 theme={null}
    {
      "col_std_devs": [2.1602, 2.9439, 1.6330, 1.6330]
    }
    ```
  </Accordion>

  <Accordion title="POST .../mat-std — standard deviation of all elements">
    Returns the standard deviation computed across every element in the matrix.

    **`POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/mat-std`**

    <ParamField body="a" type="number[][]" required>
      The input matrix.
    </ParamField>

    <ParamField body="result_name" type="string" default="ans">
      Name for the result in the response.
    </ParamField>

    <ParamField body="api_level" type="string" default="detailed">
      Response verbosity: `"lite"`, `"standard"`, or `"detailed"`.
    </ParamField>

    <ParamField body="decimals" type="integer | null" default="null">
      Decimal precision for rounding.
    </ParamField>

    **Example**

    ```bash cURL theme={null}
    curl --request POST \
      --url https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/mat-std \
      --header 'Authorization: Bearer <your-api-key>' \
      --header 'Content-Type: application/json' \
      --data '{"a": [[4, 7, 2, 1], [8, 3, 6, 5], [9, 0, 4, 3]], "result_name": "std_dev", "api_level": "lite", "decimals": 4}'
    ```

    ```json 200 theme={null}
    {
      "std_dev": 2.6087
    }
    ```
  </Accordion>
</AccordionGroup>
