nimble.calculate.solve

nimble.calculate.solve(aObj, bObj)

Solves the linear equation set A x = b for the unknown vector x.

Parameters:
  • aObj ((M, M) nimble Base object.) – Square object.

  • bObj – Right-hand side nimble Base object in A x = b.

Returns:

xObj ((M) nimble Base object.) – Solution to the system A x = b. Shape of xObj matches bObj.

Raises:

Examples

>>> aData = [[3,2,0],[1,-1,0],[0,5,1]]
>>> aObj = nimble.data(aData)
>>> bData = [2,4,-1]
>>> bObj = nimble.data(bData)
>>> aObj
<Matrix 3pt x 3ft
     0  1   2
   ┌─────────
 0 │ 3   2  0
 1 │ 1  -1  0
 2 │ 0   5  1
>
>>> bObj
<Matrix 1pt x 3ft
     0  1  2
   ┌─────────
 0 │ 2  4  -1
>
>>> xObj = solve(aObj, bObj)
>>> xObj
<Matrix 1pt x 3ft
       0      1       2
   ┌─────────────────────
 0 │ 2.000  -2.000  9.000
>