linear - Solve Linear Equations

Prev Next

Function Names

linear

Description

This function solves a linear equation system A • x = B

Call as: function

Restrictions

Indirect parameter passing is disabled

Parameter count

2

Parameters

No.TypeDescription
1
input
matrix of numerals Matrix A

2-dimensional matrix

2
input
matrix of numerals
set of numerals
Vector B

Following represenations of the 1-D vector are allowed: As vector:{1,2,3}, 1-row matrix: {{1,2,3}}, 1-column matrix: {{1},{2},{3}}

Return value

TypeDescription
set of numerals Solution vector x

Exceptions

Division: Matrix is not a square (number of rows and columns differ)

Examples

               echo( linear( {{1,2},{3,4}}, {5,6} ) ); // returns {-4,4.5}

Output

{-4,4.5}
Try it yourself: Open LIB_Function_linear.b4p in B4P_Examples.zip. Decompress before use.