1
$\begingroup$

I am trying to transform a generated polynomial terms into a vector, I used the command 'MonomialList',

X = x - (2 x^3/a^2) + (x^4/a^3);
Y = y - (2 y^3/b^2) + (y^4/b^3);
u = (y^2 - b*y)*(2*x - a);
v = (x^2 - a*x)*(2*y - b);
w = X*Y;
L= MonomialList[u]
M= MonomialList[v]
N= MonomialList[w]

the result of such code was :

{a b y, -a y^2, -2 b x y, 2 x y^2}
{a b x, -2 a x y, -b x^2, 2 x^2 y}
{(x^4 y^4)/(a^3 b^3), -((2 x^4 y^3)/(a^3 b^2)), (
 x^4 y)/a^3, -((2 x^3 y^4)/(a^2 b^3)), (4 x^3 y^3)/(
 a^2 b^2), -((2 x^3 y)/a^2), (x y^4)/b^3, -((2 x y^3)/b^2), x y}

The results are so far so good, the problem is arisen when I try to treat (L,M,or N) as vectors

Transpose [L]

I receive such result :

Transpose[{a b y, -a y^2, -2 b x y, 2 x y^2}]

with error message :

Transpose: The first two levels of {a b y,-a y^2,-2 b x y,2 x y^2} cannot be transposed.

I tried to use next code to over come this problem :

 L = {MonomialList[u]}  
 

whose result was

{{2. x y^2, -0.6 x y, -0.5 y^2, 0.15 y}}

when I tried to get the transpose[L] :

{{2. x y^2}, {-0.6 x y}, {-0.5 y^2}, {0.15 y}}

The problem is solved

$\endgroup$
3
  • 2
    $\begingroup$ N is a reserved word. You should avoid uppercase variables, as they collide with Mathematica reserved words. You should have got the error "Set::wrsym Symbol N is protected". Try `l=Transpose[{MonomialList[u]}]. $\endgroup$
    – rhermans
    Commented May 24, 2022 at 8:34
  • 6
    $\begingroup$ Does this answer your question? How to take transpose of a one dimensional vector? Mathematica has no concept of row vectors and column vectors. $\endgroup$
    – Roman
    Commented May 24, 2022 at 8:40
  • 1
    $\begingroup$ Welcome to the Mathematica Stack Exchange. Please stay responsive to the comments as you receive them and provide feedback so that you can be assisted further. $\endgroup$
    – Syed
    Commented May 24, 2022 at 10:17

1 Answer 1

1
$\begingroup$

I tried to use the next code to overcome this problem :

 L = {MonomialList[u]}  
 

whose result was

{{2. x y^2, -0.6 x y, -0.5 y^2, 0.15 y}}

when I tried to get the Transpose[L] :

{{2. x y^2}, {-0.6 x y}, {-0.5 y^2}, {0.15 y}}

The problem is solved

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.