Processing math: 100%
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

asked 7 years ago

descudero gravatar image

Is there a way to get the homogeneous part of certain degree of a (multivariate) polynomial?

Every multivariate polynomial fF[x1,,xn] of degree d can be written as f=f0+f1++fd, where fi is a homogeneous polynomial of degree i. Is there a direct way to get each fi given f in SageMath? For a specific application I have where I only need fd I am homogenizing and then setting h=0, and based on this I wrote an ugly script that recursively finds fi.

Is there a cleaner (and more efficient) way to do this?

Thanks for the help!

Is there a way to get the homogeneous part of certain degree of a (multivariate) polynomial?

Every multivariate polynomial fF[x1,,xn] of degree d can be written as f=f0+f1++fd, where fi is a homogeneous polynomial of degree i. Is there a direct way to get each fi given f in SageMath? For a specific application I have where I only need fd I am homogenizing and then setting h=0, and based on this I wrote an ugly script that recursively finds fi.

Is there a cleaner (and more efficient) way to do this?

Thanks for the help!

EDIT:

This is the code I'm using to obtain fd from f

fd = R( f.homogenize()(h=0) )

where R is the multivariate polynomial ring (parent of f). If I want fd1 for example, I can define g as ffd and apply the line to g. This recursive definition is not satisfactory since to get fi I need to have all fi+1,,fd first, which is inefficient. Also, that trick of homogenizing, evaluating h=0 and coercing the result back to the original polynomial ring is not very neat.