Skip to main content

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.

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. 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

a
number[][]
required
The input matrix, expressed as an array of row arrays.
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.
result_name
string
default:"ans"
Name assigned to the computed result in the response.
api_level
string
default:"detailed"
Response verbosity: "lite", "standard", or "detailed".
steps_bg
boolean
default:"true"
Include background theory alongside solution steps.
steps_output_formats
string[]
default:"[\"\"]"
Format for step content: "html", "latex", or "speech".
decimals
integer | null
default:"null"
Decimal precision for rounding the result. Pass null for full precision.
apply_decimals_in_steps
boolean
default:"false"
Apply decimals rounding to intermediate step values.
request_params
boolean
default:"true"
Include normalized request parameters in the response.
learning_pathways
boolean
default:"true"
Include curated learning resource links in the response.
Include links to related Stemfard endpoints in the response.
properties
boolean
default:"true"
Include a description of the result object’s properties.

Example — compute all statistics

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
  }'
200
{
  "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. The base path for all individual endpoints is: /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/

Min and max

Returns an array containing the minimum value from each row of a.POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/row-min
a
number[][]
required
The input matrix.
result_name
string
default:"ans"
Name for the result in the response.
api_level
string
default:"detailed"
Response verbosity: "lite", "standard", or "detailed".
decimals
integer | null
default:"null"
Decimal precision for rounding.
Example
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"
  }'
200
{
  "row_minimums": [1, 3, 0]
}
Returns an array containing the minimum value from each column of a.POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/col-min
a
number[][]
required
The input matrix.
result_name
string
default:"ans"
Name for the result in the response.
api_level
string
default:"detailed"
Response verbosity: "lite", "standard", or "detailed".
decimals
integer | null
default:"null"
Decimal precision for rounding.
Example
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"
  }'
200
{
  "col_minimums": [4, 0, 2, 1]
}
Returns the single smallest value across all elements of a.POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/mat-min
a
number[][]
required
The input matrix.
result_name
string
default:"ans"
Name for the result in the response.
api_level
string
default:"detailed"
Response verbosity: "lite", "standard", or "detailed".
Example
cURL
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"}'
200
{
  "minimum": 0
}
Returns an array containing the maximum value from each row of a.POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/row-max
a
number[][]
required
The input matrix.
result_name
string
default:"ans"
Name for the result in the response.
api_level
string
default:"detailed"
Response verbosity: "lite", "standard", or "detailed".
Example
cURL
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"}'
200
{
  "row_maximums": [7, 8, 9]
}
Returns an array containing the maximum value from each column of a.POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/col-max
a
number[][]
required
The input matrix.
result_name
string
default:"ans"
Name for the result in the response.
api_level
string
default:"detailed"
Response verbosity: "lite", "standard", or "detailed".
Example
cURL
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"}'
200
{
  "col_maximums": [9, 7, 6, 5]
}
Returns the single largest value across all elements of a.POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/mat-max
a
number[][]
required
The input matrix.
result_name
string
default:"ans"
Name for the result in the response.
api_level
string
default:"detailed"
Response verbosity: "lite", "standard", or "detailed".
Example
cURL
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"}'
200
{
  "maximum": 9
}

Sum and mean

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
a
number[][]
required
The input matrix.
result_name
string
default:"ans"
Name for the result in the response.
api_level
string
default:"detailed"
Response verbosity: "lite", "standard", or "detailed".
decimals
integer | null
default:"null"
Decimal precision for rounding.
Example
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"
  }'
200
{
  "row_totals": [14, 22, 16]
}
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
a
number[][]
required
The input matrix.
result_name
string
default:"ans"
Name for the result in the response.
api_level
string
default:"detailed"
Response verbosity: "lite", "standard", or "detailed".
decimals
integer | null
default:"null"
Decimal precision for rounding.
Example
cURL
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"}'
200
{
  "col_totals": [21, 10, 12, 9]
}
Returns the sum of every element in the matrix.POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/mat-sum
a
number[][]
required
The input matrix.
result_name
string
default:"ans"
Name for the result in the response.
api_level
string
default:"detailed"
Response verbosity: "lite", "standard", or "detailed".
Example
cURL
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"}'
200
{
  "total": 52
}
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
a
number[][]
required
The input matrix.
result_name
string
default:"ans"
Name for the result in the response.
api_level
string
default:"detailed"
Response verbosity: "lite", "standard", or "detailed".
decimals
integer | null
default:"null"
Decimal precision for rounding.
Example
cURL
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}'
200
{
  "row_means": [3.5, 5.5, 4.0]
}
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
a
number[][]
required
The input matrix.
result_name
string
default:"ans"
Name for the result in the response.
api_level
string
default:"detailed"
Response verbosity: "lite", "standard", or "detailed".
decimals
integer | null
default:"null"
Decimal precision for rounding.
Example
cURL
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}'
200
{
  "col_means": [7.0, 3.3333, 4.0, 3.0]
}
Returns the arithmetic mean of all elements in the matrix.POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/mat-mean
a
number[][]
required
The input matrix.
result_name
string
default:"ans"
Name for the result in the response.
api_level
string
default:"detailed"
Response verbosity: "lite", "standard", or "detailed".
decimals
integer | null
default:"null"
Decimal precision for rounding.
Example
cURL
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}'
200
{
  "mean": 4.3333
}

Median

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
a
number[][]
required
The input matrix.
result_name
string
default:"ans"
Name for the result in the response.
api_level
string
default:"detailed"
Response verbosity: "lite", "standard", or "detailed".
decimals
integer | null
default:"null"
Decimal precision for rounding.
Example
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
  }'
200
{
  "row_medians": [3.0, 5.5, 3.5]
}
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.
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
a
number[][]
required
The input matrix.
result_name
string
default:"ans"
Name for the result in the response.
api_level
string
default:"detailed"
Response verbosity: "lite", "standard", or "detailed".
decimals
integer | null
default:"null"
Decimal precision for rounding.
Example
cURL
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"}'
200
{
  "col_medians": [8.0, 3.0, 4.0, 3.0]
}
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
a
number[][]
required
The input matrix.
result_name
string
default:"ans"
Name for the result in the response.
api_level
string
default:"detailed"
Response verbosity: "lite", "standard", or "detailed".
decimals
integer | null
default:"null"
Decimal precision for rounding.
Example
cURL
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"}'
200
{
  "median": 4.0
}

Variance and standard deviation

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
a
number[][]
required
The input matrix.
result_name
string
default:"ans"
Name for the result in the response.
api_level
string
default:"detailed"
Response verbosity: "lite", "standard", or "detailed".
decimals
integer | null
default:"null"
Decimal precision for rounding.
Example
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
  }'
200
{
  "row_variances": [5.25, 3.6875, 10.6875]
}
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
a
number[][]
required
The input matrix.
result_name
string
default:"ans"
Name for the result in the response.
api_level
string
default:"detailed"
Response verbosity: "lite", "standard", or "detailed".
decimals
integer | null
default:"null"
Decimal precision for rounding.
Example
cURL
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}'
200
{
  "col_variances": [4.6667, 8.6667, 2.6667, 2.6667]
}
Returns the variance computed across every element in the matrix.POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/mat-var
a
number[][]
required
The input matrix.
result_name
string
default:"ans"
Name for the result in the response.
api_level
string
default:"detailed"
Response verbosity: "lite", "standard", or "detailed".
decimals
integer | null
default:"null"
Decimal precision for rounding.
Example
cURL
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}'
200
{
  "variance": 6.8056
}
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
a
number[][]
required
The input matrix.
result_name
string
default:"ans"
Name for the result in the response.
api_level
string
default:"detailed"
Response verbosity: "lite", "standard", or "detailed".
decimals
integer | null
default:"null"
Decimal precision for rounding.
Example
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
  }'
200
{
  "row_std_devs": [2.2913, 1.9209, 3.2692]
}
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
a
number[][]
required
The input matrix.
result_name
string
default:"ans"
Name for the result in the response.
api_level
string
default:"detailed"
Response verbosity: "lite", "standard", or "detailed".
decimals
integer | null
default:"null"
Decimal precision for rounding.
Example
cURL
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}'
200
{
  "col_std_devs": [2.1602, 2.9439, 1.6330, 1.6330]
}
Returns the standard deviation computed across every element in the matrix.POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics/mat-std
a
number[][]
required
The input matrix.
result_name
string
default:"ans"
Name for the result in the response.
api_level
string
default:"detailed"
Response verbosity: "lite", "standard", or "detailed".
decimals
integer | null
default:"null"
Decimal precision for rounding.
Example
cURL
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}'
200
{
  "std_dev": 2.6087
}