Cody

# Problem 44260. Multivariate polynomials - convert monomial form to array

Solution 1251935

Submitted on 16 Aug 2017 by Alfonso Nieto-Castanon
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass

2   Pass
exponents = 0; coefficients = randi(1000); cA = coefficients; assert(isequal(coeffArray(exponents,coefficients),cA))

3   Pass
coefficients = randi(1000,[10 1]); exponents = (9:-1:0)'; cA = coefficients; assert(isequal(coeffArray(exponents,coefficients),cA))

4   Pass
a = randi(1000); b = randi(1000); exponents = [2 0; 0 1]; coefficients = [a; b]; cA = [0 a; 0 0; b 0]; assert(isequal(coeffArray(exponents,coefficients),cA))

5   Pass
a = randi(1000); b = randi(1000); c = randi(1000); d = randi(1000); exponents = [2 0 0; 0 2 0; 0 0 2; 0 0 0]; coefficients = [a; b; c; d]; cA = zeros([3 3 3]); cA(1,3,3) = a; cA(3,1,3) = b; cA(3,3,1) = c; cA(3,3,3) = d; assert(isequal(coeffArray(exponents,coefficients),cA))

6   Pass
coefficients = randi(1000); nVars = randi(20)+1; exponents = ones(1,nVars); cA = zeros(2*ones(1,nVars)); cA(1) = coefficients; assert(isequal(coeffArray(exponents,coefficients),cA))