Given the degrees in numerator and denominator I would like to represent a
Padé polynomial à la
```
P(x) = (a[0] + a[1]*x + a[2]*x**2 + ...) / (1 + b[1]*x + b[2]*x**2 + ...)
```
in sympy and let it do the heavy lifting, e.g., computation of derivatives.
Operations that I'll need to do:
* Replace a[] and b[] with actual numerical values (in both P and P')
* Evaluate those P_{a,b} and P'_{a, b} for many x.
The first idea was to go
```
import numpy
import sympy
a = sympy.MatrixSymbol('a', 2, 1)
b = sympy.MatrixSymbol('b', 3, 1)
x = sympy.Symbol('x')
P = (a[0] + a[1]*x) / (1 + b[0]*x + b[1]*x**2 + b[2]*x**3)
val_a = numpy.random.rand(2)
P_a = P.evalf(subs={a: val_a})
```
The last line however doesn't seem to do anything at all. Second attempt:
```
Pa = sympy.lambdify(a, P)(val_a)
```
This gives
```
IndexError: too many indices for array
```
Hm. Any hints of how to proceed here? Perhaps `MatrixSymbol` isn't what I'm
looking for.
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/2a8a79dd-c6d4-4724-a76c-8c40d005bb2b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.