sursumCorda

1219 Reputation

15 Badges

2 years, 135 days

MaplePrimes Activity


These are questions asked by sursumCorda

OEIS A034828 and OEIS A000292 (which give the Wiener index for the cycle graph and the path graph respectively) mention that 

the Wiener index of the cycle of length 19 is 855 and 
the Wiener index of the path with 19 edges is 1330

However, 

GraphTheory:-WienerIndex(GraphTheory:-CycleGraph(19));
 = 
                               38

GraphTheory:-WienerIndex(GraphTheory:-PathGraph(20));
 = 
                               38

So what happened here? 

Consider the following exact algebraic number expr
 

restart;

kernelopts('version'):

Physics:-Version():

expr := Physics:-`*`(2-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2), sqrt(1-(1-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2))^2))+Physics:-`*`(Physics:-`*`(3+Physics:-`*`(4, 1-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2)), 1/12), sqrt(3-Physics:-`*`(4, (1-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2))^2)))+Physics:-`*`(Physics:-`*`(2, Physics:-`*`(2-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2), 1/3)), sqrt(Physics:-`*`(Physics:-`*`(2, 2-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2)), 1-Physics:-`*`(2, 1-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2)))))+Physics:-`*`(Physics:-`*`(1+Physics:-`*`(2, 1-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2)), 1/6), sqrt(Physics:-`*`(2, (1/4)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2)^2-Physics:-`*`(3, (1-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2))^2)))):

CodeTools:-Usage(PolynomialTools:-MinimalPolynomial(expr));

memory used=0.97MiB, alloc change=12.00KiB, cpu time=31.00ms, real time=27.00ms, gc time=0ns

 

27*_X^2+70*_X-433

(1)

evalf[30](eval(27*_X^2+70*_X-433, _X = expr));

0.262508598220109180966e-6

(2)

"evalf((mp:=CodeTools:-Usage(evala(':-Minpoly'(expr,_X)))));"

memory used=70.25GiB, alloc change=48.00MiB, cpu time=23.63m, real time=21.81m, gc time=3.18m

 

-422.3889573*_X+2208.949800*_X^4-225.8139518*_X^3-230.2173498*_X^2+59.33811620+_X^10-19.92850932*_X^9+166.6440365*_X^8-755.9985571*_X^7+1997.484781*_X^6-3014.379082*_X^5

(3)

type(mp, polynom(rational, _X))

false

(4)


 

Download wrong_minpoly.mw 
I would like to find its minimal polynomial (without a priori knowledge). 

According to the documentation, 

if is an exact algebraic number, and and are not given, then PolynomialTools:-MinimalPolynomial(expr) will call  to compute an exact minimal polynomial of . If a name is not specified for the variable , then  will be used.

Regretfully, it is easy to see that the minimal polynomial of expr cannot be the returned 27*_X^2 + 70*_X - 433. And when I invoke  directly, the result is still not correct (and this evaluation takes a rather long time). 
Another help page mentions that 

the call mp := evala(Minpoly(expr, _X)) computes the monic minimal polynomial of  in the variable  over the field of rational numbers (or multivariate rational functions); the resulting polynomial will not contain any algebraic numbers or functions.

However, as type(mp, polynom(rational, _X)) gives , we know that cannot be the desired minimal polynomial of expr either. 
So, what is the proper way to compute the minimal polynomial of expr in Maple? 

Code: 

use alpha=1-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345,index=2)-1/2)**2) in 
	expr:=(1+alpha)*sqrt(1-alpha**2)+(3+4*alpha)/12*sqrt(3-4*alpha**2)+2*(1+alpha)/3*sqrt(2*(1+alpha)*(1-2*alpha))+(1+2*alpha)/6*sqrt(2*((1-alpha)**2-3*alpha**2)) 
end:
CodeTools:-Usage(PolynomialTools:-MinimalPolynomial(expr));

Of note, the minimal polynomial of an algebraic number zeta is the unique irreducible monic polynomial of smallest degree p(x) with rational coefficients such that p(zeta)=0 and whose leading coefficient is 1

As the following worksheet shows, 
 

restart

kernelopts('version');

Physics:-Version();

`Maple 2024.0, X86 64 WINDOWS, Mar 01 2024, Build ID 1794891`

`The "Physics Updates" version in the MapleCloud is 1732 and is the same as the version installed in this computer, created 2024, April 12, 17:58 hours Pacific Time.`

with(RealDomain):

eval(MTM:-det(<
   a, b/2, d/2 |
   b/2, c, e/2 |
   d/2, e/2, f
  >), PDETools:-Solve(MTM:-det(<
     x**2 + y**2, x1**2 + y1**2, x2**2 + y2**2, x3**2 + y3**2 |
     x, x1, x2, x3 |
     y, y1, y2, y3 |
     1, 1, 1, 1
    >) = inner([a, b, c, d, e, f], [x**2, x*y, y**2, x, y, 1]),
   {f, e, d, c, b, a}, 'independentof' = {y, x}))/MTM:-det(<
  x1, x2, x3 |
  y1, y2, y3 |
  1, 1, 1
 >): simplify(`%`);

-(1/4)*(x1^2-2*x1*x2+x2^2+(y1-y2)^2)*(x2^2-2*x2*x3+x3^2+(y2-y3)^2)*(x1^2-2*x1*x3+x3^2+(y1-y3)^2)

eval(MTM:-det(<
   a, b/2, d/2 |
   b/2, c, e/2 |
   d/2, e/2, f
  >), PDETools:-Solve(MTM:-det(<
     x**2 - y**2, x1**2 - y1**2, x2**2 - y2**2, x3**2 - y3**2, x4**2 - y4**2 |
     x*y, x1*y1, x2*y2, x3*y3, x4*y4 |
     x, x1, x2, x3, x4 |
     y, y1, y2, y3, y4 |
     1, 1, 1, 1, 1
    >) = inner([a, b, c, d, e, f], [x**2, x*y, y**2, x, y, 1]),
   {f, e, d, c, b, a}, 'independentof' = {y, x}))/(MTM:-det(<
   x2, x3, x4 | 
   y2, y3, y4 | 
   1, 1, 1
  >)*MTM:-det(<
   x3, x4, x1 | 
   y3, y4, y1 | 
   1, 1, 1
  >)*MTM:-det(<
   x4, x1, x2 | 
   y4, y1, y2 | 
   1, 1, 1
  >)*MTM:-det(<
   x1, x2, x3 | 
   y1, y2, y3 | 
   1, 1, 1
  >)): simplify(`%`);

(1/4)*((x2-x3)*x1-x2*x4+x3*x4+(y2-y3)*(y1-y4))*((x3-x4)*x1+(x4-x3)*x2+(y3-y4)*(y1-y2))*((x2-x4)*x1-x2*x3+x3*x4+(y2-y4)*(y1-y3))


 

Download Why_not_consider_subexpressions?.mw

the underlined part is evidently not the simplest. (For instance, shouldn't RealDomain:-simplify(x2^2 - 2*x2*x3 + x3^2 + (y2 - y3)^2, 'size') and RealDomain:-simplify((x2-x3)*x1-x2*x4+x3*x4+(y2-y3)*(y1-y4), 'size') be converted into RealDomain:-simplify((x2 - x3)^2 + (y2 - y3)^2, 'size') and RealDomain:-simplify((x2 - x3)*(x1 - x4) + (y2 - y3)*(y1 - y4), 'size')?) 
If I understand correctly, , by default, should try combining every part of an expression with every other to apply a vast range of potential transformations to look at many different forms of it and make progress in picking out the simplest possible one. So, why is simplify unable to touch certain sub-expressions when they are encountered at intermediate stages in a computation? 

In my view, <x || (1 .. 2); y || (1 .. 2); 1 $ 2> should return a Matrix without any error messages; however, 

<x || (1 .. 2); y || (1 .. 2); 1 $ 2>; # Arguments are shielded??? 
Error, (in Matrix) this entry is too wide or too narrow: 1

If I understand right, each argument of a function is evaluated in turn (unless the modifier is used). 
So why is it not equivalent to <x1, x2; y1, y2; 1, 1>

 

I am trying to get Maple to simplify the following trigonometric expressions (for "generic" parameters) as much as possible

sineExpr(3) := (
   sin(a[2] - b[1])*sin(a[3] - b[1]))/(
   sin(b[2] - b[1])*sin(b[3] - b[1]))*sin(a[1] - b[1]) + (
   sin(a[3] - b[2])*sin(a[1] - b[2]))/(
   sin(b[3] - b[2])*sin(b[1] - b[2]))*sin(a[2] - b[2]) + (
   sin(a[1] - b[3])*sin(a[2] - b[3]))/(
   sin(b[1] - b[3])*sin(b[2] - b[3]))*sin(a[3] - b[3]);
 = 
   (('RealDomain:-sin'(a[2]-b[1])*'RealDomain:-sin'(a[3]-b[1]))/('RealDomain:-sin'(b[2]-b[1])*'RealDomain:-sin'(b[3]-b[1])))&*'RealDomain:-sin'(a[1]-b[1])+(('RealDomain:-sin'(a[3]-b[2])*'RealDomain:-sin'(a[1]-b[2]))/('RealDomain:-sin'(b[3]-b[2])*'RealDomain:-sin'(b[1]-b[2])))&*'RealDomain:-sin'(a[2]-b[2])+(('RealDomain:-sin'(a[1]-b[3])*'RealDomain:-sin'(a[2]-b[3]))/('RealDomain:-sin'(b[1]-b[3])*'RealDomain:-sin'(b[2]-b[3])))&*'RealDomain:-sin'(a[3]-b[3])


sineExpr(4) := (
   sin(a[2] - b[1])*sin(a[3] - b[1])*sin(a[4] - b[1]))/(
   sin(b[2] - b[1])*sin(b[3] - b[1])*sin(b[4] - b[1]))*
   sin(a[1] - b[1]) + (
   sin(a[3] - b[2])*sin(a[4] - b[2])*sin(a[1] - b[2]))/(
   sin(b[3] - b[2])*sin(b[4] - b[2])*sin(b[1] - b[2]))*
   sin(a[2] - b[2]) + (
   sin(a[4] - b[3])*sin(a[1] - b[3])*sin(a[2] - b[3]))/(
   sin(b[4] - b[3])*sin(b[1] - b[3])*sin(b[2] - b[3]))*
   sin(a[3] - b[3]) + (
   sin(a[1] - b[4])*sin(a[2] - b[4])*sin(a[3] - b[4]))/(
   sin(b[1] - b[4])*sin(b[2] - b[4])*sin(b[3] - b[4]))*
   sin(a[4] - b[4]);
 = 
(('RealDomain:-sin'(a[2]-b[1])*'RealDomain:-sin'(a[3]-b[1])*'RealDomain:-sin'(a[4]-b[1]))/('RealDomain:-sin'(b[2]-b[1])*'RealDomain:-sin'(b[3]-b[1])*'RealDomain:-sin'(b[4]-b[1])))&*'RealDomain:-sin'(a[1]-b[1])+(('RealDomain:-sin'(a[3]-b[2])*'RealDomain:-sin'(a[4]-b[2])*'RealDomain:-sin'(a[1]-b[2]))/('RealDomain:-sin'(b[3]-b[2])*'RealDomain:-sin'(b[4]-b[2])*'RealDomain:-sin'(b[1]-b[2])))&*'RealDomain:-sin'(a[2]-b[2])+(('RealDomain:-sin'(a[4]-b[3])*'RealDomain:-sin'(a[1]-b[3])*'RealDomain:-sin'(a[2]-b[3]))/('RealDomain:-sin'(b[4]-b[3])*'RealDomain:-sin'(b[1]-b[3])*'RealDomain:-sin'(b[2]-b[3])))&*'RealDomain:-sin'(a[3]-b[3])+(('RealDomain:-sin'(a[1]-b[4])*'RealDomain:-sin'(a[2]-b[4])*'RealDomain:-sin'(a[3]-b[4]))/('RealDomain:-sin'(b[1]-b[4])*'RealDomain:-sin'(b[2]-b[4])*'RealDomain:-sin'(b[3]-b[4])))&*'RealDomain:-sin'(a[4]-b[4])

So far, all of my attempts have failed: 
 

restart:

kernelopts('version');

Physics:-Version();

`Maple 2024.0, X86 64 WINDOWS, Mar 01 2024, Build ID 1794891`

 

`The "Physics Updates" version in the MapleCloud is 1701 and is the same as the version installed in this computer, created 2024, March 17, 17:24 hours Pacific Time.`

(1)

sineExpr := proc (m::posint) options operator, arrow; add(mul(ifelse(j <> t, (':-sin')(a[j]-b[t])/(':-sin')(b[j]-b[t]), (':-sin')(a[t]-b[t])), j = 1 .. m), t = 1 .. m) end proc

Warning, (in sineExpr) `t` is implicitly declared local

 

Warning, (in sineExpr) `j` is implicitly declared local

 

Warning, (in sineExpr) `t` is implicitly declared local

 

Warning, (in sineExpr) `j` is implicitly declared local

 

combine(simplify(normal(sineExpr(1), expanded), trig), trig);

sin(a[1]-b[1])

(2)

combine(simplify(normal(sineExpr(2), expanded), trig), trig); # which can be transformed into sin((a[1]+a[2])-(b[1]+b[2])) only in certain legacy versions!

-(1/2)*(cos(-2*b[2]+a[1]+a[2])-cos(-2*b[1]+a[1]+a[2]))/sin(b[1]-b[2])

(3)

combine(simplify(normal(sineExpr(3), expanded), trig), trig);

(1/2)*(cos(-b[1]-3*b[2]+b[3]+a[2]+a[3]+a[1])-cos(b[1]-3*b[2]-b[3]+a[2]+a[3]+a[1])-cos(-b[1]-3*b[3]+a[2]+a[3]+a[1]+b[2])+cos(b[1]-3*b[3]-b[2]+a[2]+a[3]+a[1])+cos(-3*b[1]+a[2]+a[3]+a[1]+b[2]-b[3])-cos(-3*b[1]+a[2]+a[3]+a[1]-b[2]+b[3]))/(sin(-2*b[2]+2*b[1])-sin(-2*b[3]+2*b[1])+sin(2*b[2]-2*b[3]))

(4)

CodeTools:-Usage(combine(simplify(normal(sineExpr(4), expanded), trig), trig));

memory used=244.67MiB, alloc change=0 bytes, cpu time=6.17s, real time=5.49s, gc time=1000.00ms

 

(1/2)*(sin(-2*a[3]+4*a[4]+2*a[2]-b[3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b[4]+b[2]+b[1]+2*a[1]))/(cos(a[1]-a[2]-3*a[3]+3*a[4])-cos(a[1]-a[2]+3*a[3]-3*a[4])+cos(-3*a[2]-a[3]+a[4]+3*a[1])-cos(-3*a[2]+a[3]-a[4]+3*a[1])-cos(a[1]+3*a[2]-3*a[3]-a[4])+cos(a[3]-3*a[4]-a[2]+3*a[1])-cos(-a[3]-3*a[4]+a[2]+3*a[1])+cos(-3*a[3]-a[4]+a[2]+3*a[1])-cos(-3*a[3]+a[4]-a[2]+3*a[1])+cos(a[1]-3*a[2]+3*a[3]-a[4])-cos(a[1]-3*a[2]-a[3]+3*a[4])+cos(a[1]+3*a[2]-a[3]-3*a[4]))

(5)

CodeTools:-Usage(combine(simplify(normal(sineExpr(5), expanded), trig), trig)): # rather lengthy

memory used=4.23GiB, alloc change=-32.00MiB, cpu time=2.66m, real time=2.29m, gc time=29.98s

 

Can sineExpr(3), sineExpr(4), and sineExpr(5) be reduced to sin(a[1]+a[2]+a[3]-b[1]-b[2]-b[3]), sin(a[1]+a[2]+a[3]+a[4]-b[1]-b[2]-b[3]-b[4]), and sin(a[1]+a[2]+a[3]+a[4]+a[5]-b[1]-b[2]-b[3]-b[4]-b[5]) respectively by Maple itself (that is, with as little user-intervention as possible) if one is not aware of such reductions in advance?


 

Download sinIdentity.mw

Note that because zero testing is frequently considerably easier, combine always succeeds in showing that the difference between the simplest possible and the original version is zero. 

combine(sin((a[1]+a[2]+a[3])-(b[1]+b[2]+b[3]))-sineExpr(3));
 = 
                               0

combine(sin((a[1]+a[2]+a[3]+a[4])-(b[1]+b[2]+b[3]+b[4]))-sineExpr(4));
 = 
                               0

However, I wonder if Maple can thoroughly simplify them without knowing those known “simplest possible” form beforehand
I also tried some other functions like rationalize, radnormal, and `convert/trig`, yet Maple appears to have not been capable of completely simplifying even the sub-simplest case 𝑚=2. Is there any workaround? 

Of note, it can be demonstrated inductively that m∈ℕ 

 

where none of the denominators is 0. Nevertheless, as mentioned above, is it possible to transform  and  (as well as , if possible) into potentially more elegant forms (Ideally,  is rewritten into ,  is rewritten into , and  is rewritten into .) without any such a priori knowledge
In Mma, these may be done using TrigReduce directly (cf. ); unfortunately, I cannot found a Maple equivalent to such functionality. 

2 3 4 5 6 7 8 Last Page 4 of 23