TransWikia.com

How to remove global constants in front of polynomial expressions?

Mathematica Asked on September 27, 2021

I have a list of polynomials, many of them are equals up to some constants. For instance I have:

-(1/4) (nn[2] + nn[8]) (mm[101] - 2 nn[107]) 

 1/4 (nn[2] + nn[8]) (mm[101] - 2 nn[107])

Where nn[ ] and mm[ ] are the variables.
I would like to have only independent polynomials in my list. To do so, I thought to remove global constants in front of each polynomial in the list and then to use DeleteDuplicates.
But I cannot achieve the first step of removing the constants.
Do you have any ideas on how to do so?

One Answer

I would use CoefficientRules because it allows to specify the polynomial ordering as a third parameter. In the simplest form you can write:

p1=-(1/4) (nn[2] + nn[8]) (mm[101] - 2 nn[107]);
CoefficientRules[p1]//First//Last 
(*-1/4*)

Answered by yarchik on September 27, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP