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 Stemfard API gives you a complete set of matrix operation endpoints under the /api/v1/mathematics/linear-algebra/matrix-operations path. This guide walks through every available category — arithmetic, element-wise operations, dimension queries, and statistics — and shows you concrete request and response examples so you can integrate them into your application quickly.
All endpoints accept an api_level parameter ("lite", "standard", or "detailed") that controls how much solution detail the API returns alongside your result. See API levels for a full breakdown.

Matrix arithmetic

Use the arithmetic endpoints to add, subtract, or multiply matrices. You can call the unified endpoint with an operation field, or use a dedicated sub-path for clarity. Supported operation values: "add", "subtract", "multiply-ew", "divide-ew", "raise-ew", "matmul", "all"

Addition

curl --request POST \
  --url https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-arithmetic/add \
  --header 'Authorization: Bearer <your-api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
    "a": [[1, 2], [3, 4]],
    "b": [[5, 6], [7, 8]],
    "api_level": "lite",
    "result_name": "sum"
  }'
Sample response
{
  "result_name": "sum",
  "result": [[6, 8], [10, 12]],
  "steps": null
}

Subtraction

curl --request POST \
  --url https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-arithmetic/subtract \
  --header 'Authorization: Bearer <your-api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
    "a": [[9, 8], [7, 6]],
    "b": [[1, 2], [3, 4]],
    "api_level": "lite",
    "result_name": "diff"
  }'
Sample response
{
  "result_name": "diff",
  "result": [[8, 6], [4, 2]],
  "steps": null
}

Matrix multiplication (matmul)

Matrix multiplication (dot product) requires the column count of a to equal the row count of b.
curl --request POST \
  --url https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-arithmetic/matmul \
  --header 'Authorization: Bearer <your-api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
    "a": [[1, 2], [3, 4]],
    "b": [[5, 6], [7, 8]],
    "api_level": "lite",
    "result_name": "product"
  }'
Sample response
{
  "result_name": "product",
  "result": [[19, 22], [43, 50]],
  "steps": null
}

Element-wise operations

Element-wise operations apply a function independently to each corresponding pair of elements across two matrices of the same shape. The matrices must have identical dimensions; no broadcasting is applied.
Endpoint suffixOperationDescription
/multiply-ewa[i][j] * b[i][j]Multiply each element by its counterpart
/divide-ewa[i][j] / b[i][j]Divide each element by its counterpart
/raise-ewa[i][j] ^ b[i][j]Raise each element to the power of its counterpart
curl --request POST \
  --url https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-arithmetic/multiply-ew \
  --header 'Authorization: Bearer <your-api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
    "a": [[1, 2], [3, 4]],
    "b": [[2, 3], [4, 5]],
    "api_level": "lite",
    "result_name": "ew_product"
  }'
Sample response (multiply-ew)
{
  "result_name": "ew_product",
  "result": [[2, 6], [12, 20]],
  "steps": null
}

Matrix dimensions

The dimension endpoints let you inspect the shape of any matrix without performing a computation. This is useful for validating input before passing matrices to arithmetic or statistics endpoints.
curl --request POST \
  --url https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-dimensions/shape \
  --header 'Authorization: Bearer <your-api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
    "a": [[1, 2, 3], [4, 5, 6]],
    "api_level": "lite"
  }'
Sample responses
// shape
{ "result": [2, 3] }

// nrows
{ "result": 2 }

// ncols
{ "result": 3 }

Matrix statistics

The statistics endpoints compute descriptive statistics across rows, columns, or the entire matrix. You can call the unified /matrix-statistics endpoint, or use a dedicated path for the specific statistic you need. Available statistics: 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

Row mean

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": [[2, 4, 6], [1, 3, 5]],
    "api_level": "lite",
    "result_name": "row_means",
    "decimals": 4
  }'
Sample response
{
  "result_name": "row_means",
  "result": [4.0, 3.0],
  "steps": null
}

Matrix sum

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": [[1, 2], [3, 4], [5, 6]],
    "api_level": "lite",
    "result_name": "total"
  }'
Sample response
{
  "result_name": "total",
  "result": 21,
  "steps": null
}

Column standard deviation

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": [[2, 4], [4, 8], [6, 12]],
    "api_level": "lite",
    "result_name": "col_stds",
    "decimals": 4
  }'
Sample response
{
  "result_name": "col_stds",
  "result": [1.6330, 3.2660],
  "steps": null
}