Computer Algebra "factor" function

Hi All,

I’m reading “Computer Algebra Concepts and Techniques” by Lamagna (I’m new to CAS systems, and fairly new to Julia as well). I was curious to see if I could follow along with some of the examples in Julia, rather than Maple/Mathematica.

My specific question: is there a way to do something like the following?

using Symbolics

@variables x y
p = 55*x^2*y - 15*x*y^2 + 44*x*y - 12*y^2
factor(p)

What I’d like to see is something similar to pg 36, where Lamagna uses Maple to do the following:

I see that you can use Primes.jl factor functions for integers and polynomials:

using Primes
 
factor(2^(2^5)+1)
# 641 * 6700417

But I haven’t yet found a method that would work with Symbolic’s variables/expressions.

Thanks for the help,
Cheers,
Max

1 Like

Package Hecke has factor function for polynomial.

using Hecke

R,(x,y)=polynomial_ring(QQ, [:x, :y])
# (Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y])

p = 55*x^2*y - 15*x*y^2 + 44*x*y - 12*y^2
# 55*x^2*y - 15*x*y^2 + 44*x*y - 12*y^2

factor(p)
# 1 * y * (11*x - 3*y) * (5*x + 4)

q=77x^2*y-21x*y^2-22x^2+6x*y
# 77*x^2*y - 22*x^2 - 21*x*y^2 + 6*x*y

gcd(p, q)
# x - 3//11*y
2 Likes

Thanks @shikil ! Works beautifully. Excited to look deeper into this package.

Best,
Max