In Problem 44259 I asked you to multiply two multidimensional polynomials that were represented by an array that is a generalization of the way MATLAB handles one-variable polynomials. However, that representation has at least two problems:
Here, we will represent a polynomial as a sum of monomials. For example, the polynomial p(x,y) = 2*x^5*y + 3*x*y^5 is the sum of two monomials in x and y. We will represent this by exponents, a matrix of integers with each row representing the exponents of one monomial (including zeros); and a column vector coefficients for the coefficient of each monomial. For p(x,y), these are
exponents = [5 1; 1 5]; coefficients = [2; 3];
Let's hedge our bets, though, and create a function that converts this form to the array form. Your task is to create a function
function c = coeffArray(exponents,coefficients)
that inputs the exponents and coefficients and returns an array as defined in Problem 44259.
What is the matrix form for, say, A*x^2+B*x*y+C*y^2+D*x+E*y+F?
Tim, it is
exponents = [2 0; 1 1; 0 2; 1 0; 0 1; 0 0];
coefficients = [A B C D E F]';
What I meant to ask was, what is the correct output from coeffArray for that case?
@Tim The correct output from coeffArray for A*x^2+B*x*y+C*y^2+D*x+E*y+F should be [0 0 A;0 B D;C E F]
Project Euler: Problem 6, Natural numbers, squares and sums.
1128 Solvers
94 Solvers
Find third Side of a right triangle given hypotenuse and a side. No * - or other functions allowed
163 Solvers
Given a matrix, return the last eigen value
155 Solvers
205 Solvers