Problem 44263. Multivariate polynomials - emulate symbolic form
In Problem 44262 I asked you to create a class mPoly with overloaded multiplication, so a product of two polynomials can be expressed in the form p = p1*p2. However, the method of constructing these polynomials is still somewhat unintuitive. In the Symbolic Math Toolbox, one can simply define some variables,
syms x y z
and then create a polynomial:
p = 2*x*y + 3*x^5*z;
We would like to do something like that here. As a start, create a class mPolySym with properties exponents and coefficients, and varnames, where the first two properties are the same as in previous problems and varnames is a string array. The constructor should accept a numeric, char or string input, e.g.,
x = mPolySym('x')
x =
mPolySym with properties:
varnames: "x" exponents: 1 coefficients: 1
r = mPolySym(pi)
r =
mPolySym with properties:
varnames: [0×0 string] exponents: 1 coefficients: 3.1416
Also modify the method mtimes from the previous problem so it can multiply polynomials with different variable names.
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers7
Suggested Problems
-
Find relatively common elements in matrix rows
2090 Solvers
-
What is the distance from point P(x,y) to the line Ax + By + C = 0?
543 Solvers
-
9598 Solvers
-
Getting the absolute index from a matrix
248 Solvers
-
Given a matrix, swap the 2nd & 3rd columns
1150 Solvers
More from this Author9
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!