Harry Garst

239 Reputation

5 Badges

18 years, 327 days

MaplePrimes Activity


These are questions asked by Harry Garst

I could not find a command that splits a polynomial in parts based on leading integer coefficients, so I wrote a procedure. It works well, but I still wonder if there is no simpler way of doing this?
My aim is to investigate whether there is some way of factoring this and other polynomials.
 

kind regards,
Harry Garst
 

``

restart; with(ListTools); with(LinearAlgebra)

p := 2*x^3*y+2*x^3*z+4*x^2*y^2+24*x^2*y*z+4*x^2*z^2+2*x*y^3+24*x*y^2*z+24*x*y*z^2+2*x*z^3+2*y^3*z+4*y^2*z^2+2*y*z^3-40*x^2*y-40*x^2*z-40*x*y^2-40*x*z^2-40*y^2*z-40*y*z^2+108*x*y+108*x*z+108*y*z-9*x-9*y-9*z+36

2*x^3*y+2*x^3*z+4*x^2*y^2+24*x^2*y*z+4*x^2*z^2+2*x*y^3+24*x*y^2*z+24*x*y*z^2+2*x*z^3+2*y^3*z+4*y^2*z^2+2*y*z^3-40*x^2*y-40*x^2*z-40*x*y^2-40*x*z^2-40*y^2*z-40*y*z^2+108*x*y+108*x*z+108*y*z-9*x-9*y-9*z+36

(1)

p1 := 2*x^3*y+2*x^3*z+2*x*y^3+2*x*z^3+2*y^3*z+2*y*z^3

2*x^3*y+2*x^3*z+2*x*y^3+2*x*z^3+2*y^3*z+2*y*z^3

(2)

p2 := 24*x^2*y*z+24*x*y^2*z+24*x*y*z^2

24*x^2*y*z+24*x*y^2*z+24*x*y*z^2

(3)

p3 := 4*x^2*y^2+4*x^2*z^2+4*y^2*z^2

4*x^2*y^2+4*x^2*z^2+4*y^2*z^2

(4)

p4 := -40*x^2*y-40*x^2*z-40*x*y^2-40*x*z^2-40*y^2*z-40*y*z^2

-40*x^2*y-40*x^2*z-40*x*y^2-40*x*z^2-40*y^2*z-40*y*z^2

(5)

p5 := 108*x*y+108*x*z+108*y*z

108*x*y+108*x*z+108*y*z

(6)

p6 := -9*x-9*y-9*z

-9*x-9*y-9*z

(7)

p7 := 36

36

(8)

simplify(p-p1-p2-p3-p4-p5-p6-p7)

0

(9)

Knip := proc (p) local g, h, i, j, N, X, Q; g := sort(ListTools:-MakeUnique([seq(lcoeff([op(p)][j]), j = 1 .. nops([op(p)]))])); h := 0; N := Matrix(nops([op(p)]), 1); X := Matrix(nops([op(g)]), 1); Q := convert([op(p)], Matrix); for j in g do h := h+1; N[h, 1] := convert([seq(ifelse(has(lcoeff([op(p)][i]), j), 1, 0), i = 1 .. nops([op(p)]))], Matrix); X[h, 1] := LinearAlgebra:-Trace(Q.N[h, 1]^%T) end do; return X end proc

proc (p) local g, h, i, j, N, X, Q; g := sort(ListTools:-MakeUnique([seq(lcoeff([op(p)][j]), j = 1 .. nops([op(p)]))])); h := 0; N := Matrix(nops([op(p)]), 1); X := Matrix(nops([op(g)]), 1); Q := convert([op(p)], Matrix); for j in g do h := h+1; N[h, 1] := convert([seq(ifelse(has(lcoeff([op(p)][i]), j), 1, 0), i = 1 .. nops([op(p)]))], Matrix); X[h, 1] := LinearAlgebra:-Trace(Typesetting:-delayDotProduct(Q, N[h, 1]^%T)) end do; return X end proc

(10)

Knip(p)

Matrix(%id = 18446747088530918086)

(11)

simplify(p-Trace(Matrix(1, 7, 1).Knip(p)))

0

(12)

``


 

Download knip.mw

 

Is het possible to use the circletimes symbol  ⊗ from Maple's Operators palette as an alias for KroneckerProduct(A,B)?

Instead of KroneckerProduct(A,B) :  A ⊗ B

An abbriviation would be convenient for the following expression:

A ⊗ B ⊗ C ⊗ D ⊗ E ⊗ F ⊗ G

 

I tried alias, macro, applyrule but was not successfull.

Is is possible or should I add it to the Maple 2019 wishlist?

Harry

 

factor_problem.mw

I want to factor the following polynomial:

Teller := 2*i1^4*i2*i3+2*i1^4*i2*i4+2*i1^4*i2*i5+2*i1^4*i3*i4+2*i1^4*i3*i5+2*i1^4*i4*i5+4*i1^3*i2^2*i3+4*i1^3*i2^2*i4+4*i1^3*i2^2*i5+4*i1^3*i2*i3^2+6*i1^3*i2*i3*i4+6*i1^3*i2*i3*i5+4*i1^3*i2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i5+8*i2^2*i4*i5^2+4*i2*i3^3*i4+4*i2*i3^3*i5+8*i2*i3^2*i4^2+12*i2*i3^2*i4*i5+8*i2*i3^2*i5^2+4*i2*i3*i4^3+12*i2*i3*i4^2*i5+12*i2*i3*i4*i5^2+4*i2*i3*i5^3+4*i2*i4^3*i5+8*i2*i4^2*i5^2+4*i2*i4*i5^3+4*i3^3*i4*i5+8*i3^2*i4^2*i5+8*i3^2*i4*i5^2+4*i3*i4^3*i5+8*i3*i4^2*i5^2+4*i3*i4*i5^3+i1^4+3*i1^3*i2+3*i1^3*i3+3*i1^3*i4+3*i1^3*i5+3*i1^2*i2^2+6*i1^2*i2*i3+6*i1^2*i2*i4+6*i1^2*i2*i5+3*i1^2*i3^2+6*i1^2*i3*i4+6*i1^2*i3*i5+3*i1^2*i4^2+6*i1^2*i4*i5+3*i1^2*i5^2+i1*i2^3+3*i1*i2^2*i3+3*i1*i2^2*i4+3*i1*i2^2*i5+3*i1*i2*i3^2+10*i1*i2*i3*i4+10*i1*i2*i3*i5+3*i1*i2*i4^2+10*i1*i2*i4*i5+3*i1*i2*i5^2+i1*i3^3+3*i1*i3^2*i4+3*i1*i3^2*i5+3*i1*i3*i4^2+10*i1*i3*i4*i5+3*i1*i3*i5^2+i1*i4^3+3*i1*i4^2*i5+3*i1*i4*i5^2+i1*i5^3+4*i2^2*i3*i4+4*i2^2*i3*i5+4*i2^2*i4*i5+4*i2*i3^2*i4+4*i2*i3^2*i5+4*i2*i3*i4^2+4*i2*i3*i5^2+4*i2*i4^2*i5+4*i2*i4*i5^2+4*i3^2*i4*i5+4*i3*i4^2*i5+4*i3*i4*i5^2

What is the best strategy using Maple(latest version)? In a previous, less complicated example, the polynomial could be not be factored in a single expression, but I was succesfull to factor it in multiple factors.

kind regards,

Harry Garst


 

NULL

restart; with(LinearAlgebra)

kernelopts(version); interface(version)

`Maple 2017.3, X86 64 WINDOWS, Sep 27 2017, Build ID 1265877`

 

`Standard Worksheet Interface, Maple 2017.3, Windows 10, September 27 2017 Build ID 1265877`

(1)



The following equation contains so many regularities, that it is tantalizing to find a compact matrix formulation.
I found a matrix expression, but it seems unnecessairy complex. Is there a Maple procedure that can help me to find a more concise matrix formulation?

eq1 := i2*i3*i4*(i2+i3+i4)+i1*i3*i4*(i1+i3+i4)+i1*i2*i4*(i1+i2+i4)+i1*i2*i3*(i1+i2+i3)

i2*i3*i4*(i2+i3+i4)+i1*i3*i4*(i1+i3+i4)+i1*i2*i4*(i1+i2+i4)+i1*i2*i3*(i1+i2+i3)

(2)

expand(eq1)

i1^2*i2*i3+i1^2*i2*i4+i1^2*i3*i4+i1*i2^2*i3+i1*i2^2*i4+i1*i2*i3^2+i1*i2*i4^2+i1*i3^2*i4+i1*i3*i4^2+i2^2*i3*i4+i2*i3^2*i4+i2*i3*i4^2

(3)

V := Matrix(4, 1, [i1, i2, i3, i4])

Matrix(%id = 18446745919887783806)

(4)

one := Matrix(4, 1, 1)

Matrix(%id = 18446745919887784886)

(5)

This matrix expression works, but seems overly complex. Using Maple, is there a way to simplify it?

Trace(MatrixScalarMultiply(one^%T.(V.one^%T-DiagonalMatrix(Diagonal(V.one^%T))).convert(Diagonal(Adjoint(V.one^%T-DiagonalMatrix(Diagonal(V.one^%T)))), Matrix), 1/2))-eq1

0

(6)

Alternatively, but also not very simple:

Trace(DiagonalMatrix(Diagonal(MatrixScalarMultiply(1/(V.one^%T-DiagonalMatrix(Diagonal(V.one^%T))), (1/2)*Determinant(V.one^%T-DiagonalMatrix(Diagonal(V.one^%T)))))).(KroneckerProduct(V^%T.one, IdentityMatrix(4))-DiagonalMatrix(V)))-eq1

0

(7)

Obviously, this does not help:

A, B := LinearAlgebra:-GenerateMatrix([eq1], [x])

Matrix(%id = 18446745919887762006), Vector[column](%id = 18446745919887761886)

(8)

NULL


 

Download Matrix_formulation.mw

Dear maple experts,

as far as I know premultiplication of matrix A with matrix B is only possible if the number of columns of A is equal to the number of rows of B (matrices are conformable). Not so in Maple: strange.mw

I expected an error message, so I would receive feedback that I made an error.

what's going on?

kind regards,

Harry Garst

2 3 4 5 6 7 8 Page 4 of 10