I want to use power series to approximate some PDEs. The first step I need to generate symbolic multivariate polynomials, given a numpy ndarray.
Consider the polynomial below:
I want to take a m
dimensional ndarray
of D=[d1,...,dm]
where dj
s are non-negative integers, and generate a symbolic multivariate polynomial in the form of symbolic expression. The symbolic expression consists of monomials of the form:
Fo example if D=[2,3]
the output should be
For this specific case I could nest two for loops
and add the expressions. But I don't know what to do for D
s with arbitrary length. If I could generate the D
dimensional ndarrays of A
and X
without using for loops, then I could use np.sum(np.multiply(A,X))
as Frobenius inner product to get what I need.