The matrix arithmetic endpoints let you perform basic arithmetic operations on matrices. There are seven endpoints in this group: a combined endpoint that accepts anDocumentation Index
Fetch the complete documentation index at: https://docsa.stemfard.com/llms.txt
Use this file to discover all available pages before exploring further.
operation parameter, and six individual endpoints — one per operation. All endpoints accept two input matrices a and b (or a and a scalar for element-wise operations) and the full set of common request parameters.
Combined endpoint
Use this endpoint to run any arithmetic operation in a single request by setting theoperation field.
POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-arithmetic
Parameters
The first input matrix, expressed as an array of row arrays. Default:
[[5, 1, 6], [3, 4, 5], [6, 4, 8]].The second input matrix or scalar. For element-wise operations,
b must have the same dimensions as a. For matmul, the number of columns in a must equal the number of rows in b. Default: [[-4, -2, 6], [4, 7, -3], [7, -3, 5]].The arithmetic operation to perform. Accepted values:
"all"— run all operations and return all results"add"— element-wise addition"subtract"— element-wise subtraction"multiply-ew"— element-wise (Hadamard) multiplication"divide-ew"— element-wise division"raise-ew"— element-wise power (each element ofaraised to the corresponding element ofb)"matmul"— standard matrix multiplication
Name assigned to the computed result in the response.
Response verbosity:
"lite", "standard", or "detailed".Include background theory alongside solution steps.
Format for step content:
"html", "latex", or "speech".Decimal precision for rounding the result. Pass
null for full precision.Apply
decimals rounding to intermediate step values.Include normalized request parameters in the response.
Include curated learning resource links in the response.
Include links to related Stemfard endpoints in the response.
Include a description of the result object’s properties.
Example — matrix multiplication via the combined endpoint
200
Individual operation endpoints
Each operation has its own focused endpoint. These endpoints do not accept anoperation field — the operation is determined by the path. All accept a, b, and the common parameters.
POST .../matrix-arithmetic/add — element-wise addition
POST .../matrix-arithmetic/add — element-wise addition
Adds two matrices element by element. Example
a and b must have identical dimensions.POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-arithmetic/addFirst input matrix.
Second input matrix. Must have the same dimensions as
a.Name for the result in the response.
Response verbosity:
"lite", "standard", or "detailed".Decimal precision for the result.
200
POST .../matrix-arithmetic/subtract — element-wise subtraction
POST .../matrix-arithmetic/subtract — element-wise subtraction
Subtracts Example
b from a element by element. Both matrices must have identical dimensions.POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-arithmetic/subtractFirst input matrix (minuend).
Second input matrix (subtrahend). Must have the same dimensions as
a.Name for the result in the response.
Response verbosity:
"lite", "standard", or "detailed".Decimal precision for the result.
200
POST .../matrix-arithmetic/multiply-ew — element-wise multiplication
POST .../matrix-arithmetic/multiply-ew — element-wise multiplication
Computes the Hadamard (element-wise) product of Example
a and b. Each element at position (i, j) in the result equals a[i][j] × b[i][j]. Both matrices must have identical dimensions.POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-arithmetic/multiply-ewFirst input matrix.
Second input matrix. Must have the same dimensions as
a.Name for the result in the response.
Response verbosity:
"lite", "standard", or "detailed".Decimal precision for the result.
200
POST .../matrix-arithmetic/divide-ew — element-wise division
POST .../matrix-arithmetic/divide-ew — element-wise division
Divides each element of Example
a by the corresponding element of b. Both matrices must have identical dimensions. Division by zero in b will produce an error.POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-arithmetic/divide-ewNumerator matrix.
Denominator matrix. Must have the same dimensions as
a. No element may be zero.Name for the result in the response.
Response verbosity:
"lite", "standard", or "detailed".Decimal precision for the result.
200
POST .../matrix-arithmetic/raise-ew — element-wise power
POST .../matrix-arithmetic/raise-ew — element-wise power
Raises each element of Example
a to the power of the corresponding element of b. The result at position (i, j) equals a[i][j] ^ b[i][j]. Both matrices must have identical dimensions.POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-arithmetic/raise-ewBase matrix.
Exponent matrix. Must have the same dimensions as
a.Name for the result in the response.
Response verbosity:
"lite", "standard", or "detailed".Decimal precision for the result.
200
POST .../matrix-arithmetic/matmul — matrix multiplication
POST .../matrix-arithmetic/matmul — matrix multiplication
Performs standard matrix multiplication (dot product). The number of columns in Example
a must equal the number of rows in b. If a is m × k and b is k × n, the result is m × n.POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-arithmetic/matmulLeft-hand matrix. An
m × k matrix.Right-hand matrix. A
k × n matrix. The number of rows must equal the number of columns in a.Name for the result in the response.
Response verbosity:
"lite", "standard", or "detailed".Decimal precision for the result.
200
Matrix multiplication is not commutative —
a × b is not equal to b × a in general. Make sure you pass the matrices in the correct order for your use case.