Heyy, I want to strech polynomes into vectors. E.g.: Example 1. (A + B)^2 = A^2 + 2AB + B^2 -> c(A^2, 2AB, C^2) Example 2. (A + B + c)^2 = A^2 + 2AB + B^2 + 2AC + C^2 + 2BC -> c(A^2 + 2AB, B^2, 2AC, C^2, 2BC) Generalised: (A + B + C + ... etc)^n = ... -> c(..,..,...etc)
So what the function should do is streching out these expressions and sore each element into a cell of a vector. It can be done by for cycle, but its needed for a fast optimisation, so a vectorized form would be needed. So the mentioned A, B, C ... are parameters.
I tried searching for a built in function, but there were't any, perhaps in a package.
I tried using the polym function, but it messed up the calculations, probably because it gave an orthogonised form.