Page 1 sur 1

poly2symb command for multivariable polynomial (list)

Publié : ven. déc. 27, 2019 4:21 pm
par compsystems
Hello, an idea =), add in the poly2symb command, an array as a list representation of a multivariable polynomial

univariable polynomials
symb2poly( x^2 + 2*x^1 + 3*x^0, x ) [↵] returns poly1[ 1, 2, 3 ]
poly2symb( poly1[ 1, 2, 3 ], x ) [↵] returns x^2 + 2*x + 3

multivariable polynomial
symb2poly( 10*x^3*y^1 + 12*x^2*y^2, [x, y ] ) [↵] returns %%%{ 10, [ 3, 1 ]%%%}+%%%{ 12 ,[ 2 ,2 ]%%%}
convert( symb2poly( 10*x^3*y^1 + 12*x^2*y^2, [x, y ] ), list ) [↵] returns [ [10, [ 3, 1 ] ], [ 12, [ 2, 2 ]] ]

poly2symb( [ [10, [ 3, 1 ] ], [ 12, [ 2, 2 ]] ], [ x, y ] ) -> 10*x^3*y + 12*x^2*y^2

Reason: it is easier and faster to type a polynomial in its list form or list of lists than the algebraic expression, then the list is converted to symbolic expression with poly2symb cmd

Thanks

Re: poly2symb command for multivariable polynomial (list)

Publié : sam. déc. 28, 2019 7:47 pm
par parisse
This already exists in recursive representation, like this symb2poly( 10*x^3*y^1 + 12*x^2*y^2, x, y )