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 dimensions endpoints let you programmatically inspect the size of a matrix. There are four endpoints in this group: a combined endpoint that accepts a type parameter to select the specific query, and three individual endpoints — nrows, ncols, and shape. All endpoints accept a single input matrix a and the full set of common request parameters. Consider the following sample matrix used throughout the examples on this page:
A = [[3, 1, 4, 1],
     [5, 9, 2, 6],
     [5, 3, 5, 8]]
This is a 3 × 4 matrix: 3 rows and 4 columns.

Combined endpoint

Use this endpoint to query any dimension property by setting the type field. POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-dimensions

Parameters

a
number[][]
required
The input matrix, expressed as an array of row arrays.
type
string
required
The dimension property to compute. Accepted values:
  • "all" — compute and return all dimension properties
  • "nrows" — number of rows
  • "ncols" — number of columns
  • "shape" — both dimensions as a (rows, cols) tuple
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. 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 — query all dimension properties

curl --request POST \
  --url https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-dimensions \
  --header 'Authorization: Bearer <your-api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
    "a": [[3, 1, 4, 1], [5, 9, 2, 6], [5, 3, 5, 8]],
    "type": "all",
    "result_name": "dims",
    "api_level": "standard"
  }'
200
{
  "dims": {
    "nrows": 3,
    "ncols": 4,
    "shape": [3, 4]
  }
}

Individual dimension endpoints

Each dimension query has its own focused endpoint. These do not accept a type field — the query is determined by the path.
Returns the number of rows in the input matrix.POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-dimensions/nrows
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-dimensions/nrows \
  --header 'Authorization: Bearer <your-api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
    "a": [[3, 1, 4, 1], [5, 9, 2, 6], [5, 3, 5, 8]],
    "result_name": "row_count",
    "api_level": "lite"
  }'
200
{
  "row_count": 3
}
Returns the number of columns in the input matrix.POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-dimensions/ncols
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-dimensions/ncols \
  --header 'Authorization: Bearer <your-api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
    "a": [[3, 1, 4, 1], [5, 9, 2, 6], [5, 3, 5, 8]],
    "result_name": "col_count",
    "api_level": "lite"
  }'
200
{
  "col_count": 4
}
Returns both dimensions as a (rows, cols) tuple. This is equivalent to querying nrows and ncols in a single request.POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-dimensions/shape
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-dimensions/shape \
  --header 'Authorization: Bearer <your-api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
    "a": [[3, 1, 4, 1], [5, 9, 2, 6], [5, 3, 5, 8]],
    "result_name": "matrix_shape",
    "api_level": "standard"
  }'
200
{
  "matrix_shape": [3, 4]
}
The response value is an array where the first element is the number of rows and the second element is the number of columns.