diff options
Diffstat (limited to '')
-rw-r--r-- | README.md | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -15,7 +15,7 @@ Some aspects of the library: * multiple polynomial expressions are combined using functions like * [`polymatrix.v_stack`](https://gitlab.nccr-automation.ch/michael.schneeberger/polymatrix/-/blob/main/polymatrix/__init__.py) * [`polymatrix.block_diag`](https://gitlab.nccr-automation.ch/michael.schneeberger/polymatrix/-/blob/main/polymatrix/__init__.py). -* polynomial expressions are manipulated using bounded functions like +* polynomial expressions are manipulated using methods like * [`diff`](https://gitlab.nccr-automation.ch/michael.schneeberger/polymatrix/-/blob/main/polymatrix/expression/mixins/expressionmixin.py), * [`reshape`](https://gitlab.nccr-automation.ch/michael.schneeberger/polymatrix/-/blob/main/polymatrix/expression/mixins/expressionmixin.py) * [`substitute`](https://gitlab.nccr-automation.ch/michael.schneeberger/polymatrix/-/blob/main/polymatrix/expression/mixins/expressionmixin.py) @@ -27,13 +27,13 @@ Some aspects of the library: In this example, two polynomial expressions are defined using sympy expressions -$f_1(x_1, x_2) = x_1 + x_2$ +$\quad f_1(x_1, x_2) = x_1 + x_2$ -$f_2(x_1, x_2) = x_1 + x_1 x_2$ +$\quad f_2(x_1, x_2) = x_1 + x_1 x_2$ -Then, the two expression are combined using the `__add__` (or equivalently `+`) function +Then, the two expression are combined using the [`__add__`](https://gitlab.nccr-automation.ch/michael.schneeberger/polymatrix/-/blob/main/polymatrix/expression/mixins/expressionmixin.py) (or equivalently `+`) function -$f_3(x_1, x_2) = f_1(x_1, x_2) + f_2(x_1, x_2) = 2 x_1 + x_2 + x_1 x_2$ +$\quad f_3(x_1, x_2) = f_1(x_1, x_2) + f_2(x_1, x_2) = 2 x_1 + x_2 + x_1 x_2$ Finally, different representations of the polynomial are printed. @@ -66,6 +66,6 @@ state, matrix_repr = polymatrix.to_matrix_repr((f3,), x).apply(state) # prints the numpy matrix representations of the polynomial matrix # array([[2., 1.]]) # array([[0. , 0.5, 0.5, 0. ]]) -print(matrix_repr.data[0][1]) -print(matrix_repr.data[0][2].toarray()) +print(matrix_repr.data[0][1]) # numpy array +print(matrix_repr.data[0][2].toarray()) # sparse scipy array ``` |