P_a = P.subs(dict(zip(a, val_a)))
returns
(0.450033195586719*x + 0.829322314411828)/(x**3*b[2, 0] + x**2*b[1, 0] + x*b
[0, 0] + 1)
You need to substitute individual MatrixElement objects like a[0], not the
MatrixSymbol itself (which isn't even present in the expression P).
--
You received
Also, the conversion to dict was unnecessary, subs can take an iterator of
tuples.
P_a = P.subs(zip(a, val_a))
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to s
I see!
I also noticed that I can use `DeferredVector`s instead of `MatrixSymbol`s
to get avoid those dict shenanigans. This
```
import numpy
import sympy
a = sympy.DeferredVector('a')
b = sympy.DeferredVector('b')
x = sympy.Symbol('x')
P = (a[0] + a[1]*x) / (1 + b[0]*x + b[1]*x**2 + b[2]*x**3)
lambdify should not be needed to work with or create SymPy
expressions. Its purpose is to make a SymPy expression usable by other
libraries.
As I wrote, "dict shenanigans" were not needed. A MatrixSymbol is an
iterable. `zip(MatrixSymbol, array_of_values)` creates an iterator of
tuples, indicating
Alright, thanks for the explanation.
On Mon, Mar 19, 2018 at 11:49 PM Leonid Kovalev
wrote:
> lambdify should not be needed to work with or create SymPy
> expressions. Its purpose is to make a SymPy expression usable by other
> libraries.
>
> As I wrote, "dict shenanigans" were not needed. A Mat