diff --git a/sympyextensions.py b/sympyextensions.py index 489849ca7ebfe17a88e14cbf85c09ee31925f568..c580680be791e871b0b7aae25c9ecf73902273b5 100644 --- a/sympyextensions.py +++ b/sympyextensions.py @@ -20,6 +20,11 @@ def scalarProduct(a, b): return sum(a_i * b_i for a_i, b_i in zip(a, b)) +def equationsToMatrix(equations, degreesOfFreedom): + return sp.Matrix(len(equations), len(degreesOfFreedom), + lambda row, col: equations[row].coeff(degreesOfFreedom[col])) + + def normalizeProduct(product): """ Expects a sympy expression that can be interpreted as a product and