Ask Your Question
0

Type of variable is changed after using factor() function

asked 2024-03-27 07:34:22 +0100

lijr07 gravatar image

I defined a polynomial using polynomial ring. In my program, I need to simplify expressions using factor(). But the type of variable is changed and it becomes "None". For example,

Ra=PolynomialRing(QQ,'a',6)
Fa=Ra.fraction_field()
a=Ra.gens()
r1=(a[1]^2+a[2])/(a[3]+2*a[4])
r1.subs( { a[1]:2, a[4]:2*a[2]+a[3] } )
r2=r1.factor()
print(type(r1)), print(type(r2))
print(simplify(r2))

How to use factor() inside the ring Ra=PolynomialRing(QQ,'a',6)? Thank you very much.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2024-03-27 13:22:48 +0100

Max Alekseyev gravatar image

updated 2024-03-27 13:29:25 +0100

factor() is defined for polynomials.

None results from using simplify() function on fraction of polynomials. It is a function, which works with symbolic expressions not polynomials or their fractions. Besides, there is nothing to "simplify" in polynomials or their fractions (the latter is always stored in reduced form).

Said that,, you can enforce using simplify() by first converting its argument to symbolic expression, although it seems pointless:

print(simplify(SR(r2)))
edit flag offensive delete link more

Comments

Should factor throw an error when the input is not in SR?

grhkm gravatar imagegrhkm ( 2024-04-03 03:46:59 +0100 )edit

No, factor works fine for polynomials as well. Issue is not in factor but in simplify.

Max Alekseyev gravatar imageMax Alekseyev ( 2024-04-03 04:31:56 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2024-03-27 07:34:22 +0100

Seen: 163 times

Last updated: Mar 27