mmcdara

7891 Reputation

22 Badges

9 years, 58 days

MaplePrimes Activity


These are replies submitted by mmcdara

@Carl Love 

By the way, what is the risk to write simultaneously omega and omega[0]?
Can't that fool Maple?

Hi,
Here is a lengthy method to obtain the result by hand.
I don't say a more astute solution could not be found
 

restart:

expr_1 := 512*b^9 + (2303*a + 2304)*b^8 + (4616*a^2 + 9216*a + 4608)*b^7 + (5348*a^3 + 16128*a^2 + 16128*a + 5376)*b^6

 + (4088*a^4 + 16128*a^3 + 24192*a^2 + 16128*a + 4032)*b^5 + (1946*a^5 + 10080*a^4 + 20160*a^3 + 20160*a^2

+ 10080*a + 2016)*b^4 + (728*a^6 + 4032*a^5 + 10080*a^4 + 13440*a^3 + 10080*a^2 + 4032*a + 672)*b^3

+ (116*a^7 + 1008*a^6 + 3024*a^5 + 5040*a^4 + 5040*a^3 + 3024*a^2 + 1008*a + 144)*b^2

+ (26*a^8 + 144*a^7 + 504*a^6 + 1008*a^5 + 1260*a^4 + 1008*a^3 + 504*a^2 + 144*a + 18)*b + 9*a^8

+ 36*a^7 + 84*a^6 + 126*a^5 + 126*a^4 + 84*a^3 + 36*a^2 + 9*a + 1

 

512*b^9+(2303*a+2304)*b^8+(4616*a^2+9216*a+4608)*b^7+(5348*a^3+16128*a^2+16128*a+5376)*b^6+(4088*a^4+16128*a^3+24192*a^2+16128*a+4032)*b^5+(1946*a^5+10080*a^4+20160*a^3+20160*a^2+10080*a+2016)*b^4+(728*a^6+4032*a^5+10080*a^4+13440*a^3+10080*a^2+4032*a+672)*b^3+(116*a^7+1008*a^6+3024*a^5+5040*a^4+5040*a^3+3024*a^2+1008*a+144)*b^2+(26*a^8+144*a^7+504*a^6+1008*a^5+1260*a^4+1008*a^3+504*a^2+144*a+18)*b+9*a^8+36*a^7+84*a^6+126*a^5+126*a^4+84*a^3+36*a^2+9*a+1

(1)

# to found :

expr_0 := (a+2*b+1)^9 - a*(a-b)^8   

(a+2*b+1)^9-a*(a-b)^8

(2)

# just to check

simplify(expand(expr_0)-expand(expr_1));

0

(3)

# first visual observation

c_0 := coeff(expr_1, b, 0);
expand((a+1)^9);

# thus
# c_0 := (a+1)^9 - a^9 :

# check

expand(c_0 - ((a+1)^9 - a^9) );

c_0 := (a+1)^9 - a^9;

9*a^8+36*a^7+84*a^6+126*a^5+126*a^4+84*a^3+36*a^2+9*a+1

 

a^9+9*a^8+36*a^7+84*a^6+126*a^5+126*a^4+84*a^3+36*a^2+9*a+1

 

0

 

(a+1)^9-a^9

(4)

# could it be that coeff(expr_1, b, 1) is of a comparable form?

c_1  := coeff(expr_1, b, 1);
test := expand((a+1)^8);

for n from 0 to 8 do
   coeff(c_1, a, n) / coeff(test, a, n)
end do;

26*a^8+144*a^7+504*a^6+1008*a^5+1260*a^4+1008*a^3+504*a^2+144*a+18

 

a^8+8*a^7+28*a^6+56*a^5+70*a^4+56*a^3+28*a^2+8*a+1

 

18

 

18

 

18

 

18

 

18

 

18

 

18

 

18

 

26

(5)

# thus :
# c_1 := 18*(a+1)^8 + (26-18)*a^8:

# check

expand(c_1 - (18*(a+1)^8 + (26-18)*a^8) );

c_1 := 18*(a+1)^8 + (26-18)*a^8;

0

 

18*(a+1)^8+8*a^8

(6)

# coeff(expr_1, b, 2)

c_2  := coeff(expr_1, b, 2);
test := expand((a+1)^7);

for n from 0 to 7 do
   coeff(c_2, a, n) / coeff(test, a, n)
end do;

116*a^7+1008*a^6+3024*a^5+5040*a^4+5040*a^3+3024*a^2+1008*a+144

 

a^7+7*a^6+21*a^5+35*a^4+35*a^3+21*a^2+7*a+1

 

144

 

144

 

144

 

144

 

144

 

144

 

144

 

116

(7)

# thus :
# c_2 := 144*(a+1)^7 + (116-144)*a^7:

# check

expand(c_2 - (144*(a+1)^7 + (116-144)*a^7) );

c_2 := 144*(a+1)^7 + (116-144)*a^7;

0

 

144*(a+1)^7-28*a^7

(8)

# coeff(expr_1, b, 3)

c_3  := coeff(expr_1, b, 3);
test := expand((a+1)^6);

for n from 0 to 6 do
   coeff(c_3, a, n) / coeff(test, a, n)
end do;

# thus :
# c_3 := 672*(a+1)^6 + (728-672)*a^6:

# check

expand(c_3 - (672*(a+1)^6 + (728-672)*a^6) );

c_3 := 672*(a+1)^6 + (728-672)*a^6;

728*a^6+4032*a^5+10080*a^4+13440*a^3+10080*a^2+4032*a+672

 

a^6+6*a^5+15*a^4+20*a^3+15*a^2+6*a+1

 

672

 

672

 

672

 

672

 

672

 

672

 

728

 

0

 

672*(a+1)^6+56*a^6

(9)

# coeff(expr_1, b, 4)

c_4  := coeff(expr_1, b, 4);
test := expand((a+1)^5);

for n from 0 to 5 do
   coeff(c_4, a, n) / coeff(test, a, n)
end do;

# thus :
# c_4 := 2016*(a+1)^5 + (1946-2016)*a^5:

# check

expand(c_4 - (2016*(a+1)^5 + (1946-2016)*a^5) );

c_4 := 2016*(a+1)^5 + (1946-2016)*a^5;

1946*a^5+10080*a^4+20160*a^3+20160*a^2+10080*a+2016

 

a^5+5*a^4+10*a^3+10*a^2+5*a+1

 

2016

 

2016

 

2016

 

2016

 

2016

 

1946

 

0

 

2016*(a+1)^5-70*a^5

(10)

# coeff(expr_1, b, 5)

c_5  := coeff(expr_1, b, 5);
test := expand((a+1)^4);

for n from 0 to 4 do
   coeff(c_5, a, n) / coeff(test, a, n)
end do;

# thus :
# c_5 := 4032*(a+1)^4 + (4088-4032)*a^4:

# check

expand(c_5 - (4032*(a+1)^4 + (4088-4032)*a^4) );

c_5 := 4032*(a+1)^4 + (4088-4032)*a^4;

4088*a^4+16128*a^3+24192*a^2+16128*a+4032

 

a^4+4*a^3+6*a^2+4*a+1

 

4032

 

4032

 

4032

 

4032

 

4088

 

0

 

4032*(a+1)^4+56*a^4

(11)

# coeff(expr_1, b, 6)

c_6  := coeff(expr_1, b, 6);
test := expand((a+1)^3);

for n from 0 to 3 do
   coeff(c_6, a, n) / coeff(test, a, n)
end do;

# thus :
# c_6 := 5376*(a+1)^3 + (5348-5376)*a^3:

# check

expand(c_6 - (5376*(a+1)^3 + (5348-5376)*a^3) );

c_6 := 5376*(a+1)^3 + (5348-5376)*a^3;

5348*a^3+16128*a^2+16128*a+5376

 

a^3+3*a^2+3*a+1

 

5376

 

5376

 

5376

 

5348

 

0

 

5376*(a+1)^3-28*a^3

(12)

# coeff(expr_1, b, 7)

c_7  := coeff(expr_1, b, 7);
test := expand((a+1)^2);

for n from 0 to 2 do
   coeff(c_7, a, n) / coeff(test, a, n)
end do;

# thus :
# c_7 := 4608*(a+1)^2 + (4616-4608)*a^2:

# check

expand(c_7 - (4608*(a+1)^2 + (4616-4608)*a^2) );

c_7 := 4608*(a+1)^2 + (4616-4608)*a^2;

4616*a^2+9216*a+4608

 

a^2+2*a+1

 

4608

 

4608

 

4616

 

0

 

4608*(a+1)^2+8*a^2

(13)

# coeff(expr_1, b, 8)

c_8  := coeff(expr_1, b, 8);
test := expand((a+1));

for n from 0 to 1 do
   coeff(c_8, a, n) / coeff(test, a, n)
end do;

# thus :
# c_8 := 2304*(a+1) + (2303-2304)*a:

# check

expand(c_8 - (2304*(a+1) + (2303-2304)*a) );

c_8 := 2304*(a+1) + (2303-2304)*a;

2303*a+2304

 

a+1

 

2304

 

2303

 

0

 

2303*a+2304

(14)

# résumé
# Remark c_8 is of the form 2304*(a-1) - 1

seq(print(c_||k), k=0..9);

(a+1)^9-a^9

 

18*(a+1)^8+8*a^8

 

144*(a+1)^7-28*a^7

 

672*(a+1)^6+56*a^6

 

2016*(a+1)^5-70*a^5

 

4032*(a+1)^4+56*a^4

 

5376*(a+1)^3-28*a^3

 

4608*(a+1)^2+8*a^2

 

2303*a+2304

 

c_9

(15)

# Observe the coefficietnts of the second term :

C := [ -1, 8, -28, 56, -70, 56, -28, 8, -1 ]

[-1, 8, -28, 56, -70, 56, -28, 8, -1]

(16)

# these are the coefficients of the powers of a in -(a-1)^8:

expand(-(a-1)^8);
seq(coeff(expand(-(a-1)^8), a, k), k=0..8)

-a^8+8*a^7-28*a^6+56*a^5-70*a^4+56*a^3-28*a^2+8*a-1

 

-1, 8, -28, 56, -70, 56, -28, 8, -1

(17)

# Thus the sequence of all the op(2, c_k) are the terms of

expand(-a*(a-1)^8);

-a^9+8*a^8-28*a^7+56*a^6-70*a^5+56*a^4-28*a^3+8*a^2-a

(18)

# Then expr_0 is of the form
#
# 512*b^9 + add(c_||k*b^k, k=0..8) = 512*b^9 + add(op(1, c_||k)*b^k, k=0..8) + add(op(2, c_||k)*b^k, k=0..8)
#                                  = 512*b^9 + add(op(1, c_||k)*b^k, k=0..8) + add(coeff(T, a, 9-k)a^(9-k)*b^k, k=0..8)
#                                  = 512*b^9 + add(op(1, c_||k)*b^k, k=0..8) - a*(a-b)^8

T1 := - a*(a-b)^8

-a*(a-b)^8

(19)

T2 := simplify( expr_0 - T1);

(a+2*b+1)^9

(20)

simplify(expr_0 - (T1+T2))

0

(21)

 


 

Download game.mw

 

@chandrashekhar 

I did again a copy-paste of your initial expression and of its manual simplification of yours.
I used, as you suggested, simplify(s1-yourexpression,size): this doesn't give 0.
Two possibilities:

  1. the copy paste did not work well (but I have serious doubt about that)
  2. you played me when writting that simplification(s1-yourexpression,size) gives 0!
    First of all, simplification IS NOT A MAPLE COMMAND ... but maybe it was a typo ???

I really not like this kind of dishonesty.

 

restart:

S0 := 4*beta*c*lambda^2*mu^2+2*beta*c*lambda*mu^3+2*beta*c*lambda*mu^2*nu+beta*c*mu^3*nu-4*c*lambda^2*mu^2*sigma-2*c*lambda*mu^3*sigma-2*c*lambda*mu^2*nu*sigma-c*mu^3*nu*sigma+4*beta*lambda^3*sigma+4*beta*lambda^2*mu*sigma+2*beta*lambda^2*nu*sigma+2*beta*lambda*mu^2*sigma+2*beta*lambda*mu*nu*sigma+beta*mu^3*sigma+beta*mu^2*nu*sigma+4*lambda^2*mu^2*sigma+2*lambda*mu^3*sigma+2*lambda*mu^2*nu*sigma+mu^3*nu*sigma

4*beta*c*lambda^2*mu^2+2*beta*c*lambda*mu^3+2*beta*c*lambda*mu^2*nu+beta*c*mu^3*nu-4*c*lambda^2*mu^2*sigma-2*c*lambda*mu^3*sigma-2*c*lambda*mu^2*nu*sigma-c*mu^3*nu*sigma+4*beta*lambda^3*sigma+4*beta*lambda^2*mu*sigma+2*beta*lambda^2*nu*sigma+2*beta*lambda*mu^2*sigma+2*beta*lambda*mu*nu*sigma+beta*mu^3*sigma+beta*mu^2*nu*sigma+4*lambda^2*mu^2*sigma+2*lambda*mu^3*sigma+2*lambda*mu^2*nu*sigma+mu^3*nu*sigma

(1)

S1 := simplify(S0, size);

(((-2*c+2)*lambda+beta+(-c+1)*nu)*sigma+c*beta*(nu+2*lambda))*mu^3+2*(((-c+1)*lambda+(1/2)*beta)*sigma+c*beta*lambda)*(nu+2*lambda)*mu^2+2*beta*sigma*lambda*(nu+2*lambda)*mu+2*beta*sigma*lambda^2*(nu+2*lambda)

(2)

YourExpression := beta*mu^3+(2*lambda+nu)*(beta*mu^2+2*beta*lambda*mu+2*beta*lambda^2+(1-c)*(2*lambda+mu)*mu^2)

beta*mu^3+(nu+2*lambda)*(beta*mu^2+2*beta*lambda*mu+2*beta*lambda^2+(-c+1)*(2*lambda+mu)*mu^2)

(3)

simplify(S1-YourExpression, size)

((2*c*beta-2*(sigma-1)*(c-1))*lambda+(c*nu+sigma-1)*beta-nu*(sigma-1)*(c-1))*mu^3+2*((c*beta-(sigma-1)*(c-1))*lambda+(1/2)*beta*(sigma-1))*(nu+2*lambda)*mu^2+2*beta*lambda*(sigma-1)*(nu+2*lambda)*mu+2*beta*lambda^2*(sigma-1)*(nu+2*lambda)

(4)

# simplification IS NORT A MAPLE COMMAND

simplification(S1-YourExpression, size)

simplification((((-2*c+2)*lambda+beta+(-c+1)*nu)*sigma+c*beta*(nu+2*lambda))*mu^3+2*(((-c+1)*lambda+(1/2)*beta)*sigma+c*beta*lambda)*(nu+2*lambda)*mu^2+2*beta*sigma*lambda*(nu+2*lambda)*mu+2*beta*sigma*lambda^2*(nu+2*lambda)-beta*mu^3-(nu+2*lambda)*(beta*mu^2+2*beta*lambda*mu+2*beta*lambda^2+(-c+1)*(2*lambda+mu)*mu^2), size)

(5)

vars := indets(S0, name);

{beta, c, lambda, mu, nu, sigma}

(6)

M := Matrix(numelems(vars), 3):
k := 0:
for v in vars do
   k       := k+1:
   M[k, 1] := degree(collect(S0, v), v);
   M[k, 2] := degree(collect(S1, v), v);
   M[k, 3] := degree(collect(YourExpression, v), v);
end do:

"Higher degree in each indet for S0, S1 and your manual simplification";
<
  Vector[column](numelems(vars)+1, ["indet", vars[]])
  |
  <
    Vector[row](3, ["Initial expression", "Maple simplified", "Manually simplified"]),
    M
  >
>;

"Higher degree in each indet for S0, S1 and your manual simplification"

 

Matrix([["indet", "Initial expression", "Maple simplified", "Manually simplified"], [beta, 1, 1, 1], [c, 1, 1, 1], [lambda, 3, 3, 3], [mu, 3, 3, 3], [nu, 1, 1, 1], [sigma, 1, 1, 0]])

(7)

 

 


 

Download simplified.mw

 

@acer 

I just copied-pasted myself (maybe I missed something to) but I found that the Maple simplification of the original expression XWAS NOT equivalent to the manually simplified one:

 

restart:

S0 := 4*beta*c*lambda^2*mu^2+2*beta*c*lambda*mu^3+2*beta*c*lambda*mu^2*nu+beta*c*mu^3*nu-4*c*lambda^2*mu^2*sigma-2*c*lambda*mu^3*sigma-2*c*lambda*mu^2*nu*sigma-c*mu^3*nu*sigma+4*beta*lambda^3*sigma+4*beta*lambda^2*mu*sigma+2*beta*lambda^2*nu*sigma+2*beta*lambda*mu^2*sigma+2*beta*lambda*mu*nu*sigma+beta*mu^3*sigma+beta*mu^2*nu*sigma+4*lambda^2*mu^2*sigma+2*lambda*mu^3*sigma+2*lambda*mu^2*nu*sigma+mu^3*nu*sigma

4*beta*c*lambda^2*mu^2+2*beta*c*lambda*mu^3+2*beta*c*lambda*mu^2*nu+beta*c*mu^3*nu-4*c*lambda^2*mu^2*sigma-2*c*lambda*mu^3*sigma-2*c*lambda*mu^2*nu*sigma-c*mu^3*nu*sigma+4*beta*lambda^3*sigma+4*beta*lambda^2*mu*sigma+2*beta*lambda^2*nu*sigma+2*beta*lambda*mu^2*sigma+2*beta*lambda*mu*nu*sigma+beta*mu^3*sigma+beta*mu^2*nu*sigma+4*lambda^2*mu^2*sigma+2*lambda*mu^3*sigma+2*lambda*mu^2*nu*sigma+mu^3*nu*sigma

(1)

S1 := simplify(S0, size);

(((-2*c+2)*lambda+beta+(-c+1)*nu)*sigma+c*beta*(nu+2*lambda))*mu^3+2*(((-c+1)*lambda+(1/2)*beta)*sigma+c*beta*lambda)*(nu+2*lambda)*mu^2+2*beta*sigma*lambda*(nu+2*lambda)*mu+2*beta*sigma*lambda^2*(nu+2*lambda)

(2)

YourExpression := beta*mu^3+(2*lambda+nu)*(beta*mu^2+2*beta*lambda*mu+2*beta*lambda^2+(1-c)*(2*lambda+mu)*mu^2)

beta*mu^3+(nu+2*lambda)*(beta*mu^2+2*beta*lambda*mu+2*beta*lambda^2+(-c+1)*(2*lambda+mu)*mu^2)

(3)

simplify(S1-YourExpression)

4*beta*c*lambda^2*mu^2+2*beta*c*lambda*mu^3+2*beta*c*lambda*mu^2*nu+beta*c*mu^3*nu-4*c*lambda^2*mu^2*sigma-2*c*lambda*mu^3*sigma-2*c*lambda*mu^2*nu*sigma-c*mu^3*nu*sigma+4*beta*lambda^3*sigma+4*beta*lambda^2*mu*sigma+2*beta*lambda^2*nu*sigma+2*beta*lambda*mu^2*sigma+2*beta*lambda*mu*nu*sigma+beta*mu^3*sigma+beta*mu^2*nu*sigma+4*c*lambda^2*mu^2+2*c*lambda*mu^3+2*c*lambda*mu^2*nu+c*mu^3*nu+4*lambda^2*mu^2*sigma+2*lambda*mu^3*sigma+2*lambda*mu^2*nu*sigma+mu^3*nu*sigma-4*beta*lambda^3-4*beta*lambda^2*mu-2*beta*lambda^2*nu-2*beta*lambda*mu^2-2*beta*lambda*mu*nu-beta*mu^3-beta*mu^2*nu-4*lambda^2*mu^2-2*lambda*mu^3-2*lambda*mu^2*nu-mu^3*nu

(4)

 


 

Download simplified.mw

@tomleslie 

Thanks fot the check.
I forget this problem and consider it as closed.

@tomleslie 

I sincerely thank you for this very thorough analysis, which probably took you some time.
Does that enlighten me? I don't know, but it makes me feel a little more comfortable because I was sincerely beginning to wonder if I hadn't done something so stupid and I couldn't see it.
 

I guess if no one on the development team takes care of this problem, it will remain a quirk.

Just one question, being currently on holiday, I can only use Maple 2015: do you observe the same phenomenon with a more recent version, for example Maple 2018 or 2019?
If this were the case, I think it would be worthwhile to open a new thread on this "toto"; otherwise, we could consider that bygones are bygones


And last, "The anomaly is much too subtle for me to work out WTF is going on - sorry:-(", don't be sorry, you really did a fine job

@tomleslie 

Thanks for your help.
After verifications I have no such .bak files in the directory where I try to save the worksheet.
Going deeply  I observed that 

  • dodgy0 can be saved without any problems after having been executed
    dodgy0.mw
    Curious thing : there is no ouput returned after the 3 dsolve commands... there is something here that doesn't sound normal
     
  • dodgy1 can be saved without any problems ONLY if it has not been executed (!!! icon)
    dodgy1.mw
    If you load  and execute it, you will see that each dsolve command nof return the classical proc(...) ...end proc output
    But once executed I'm not able to save it (cmd+s, on Mac OS)
     
  • dodgy2 can be saved without any problems after having been executed
    dodgy2.mw
    Its only difference with dodgy1: dsolve(..., method=rosenbrock) has been removed
     
  • dodgy3 can be saved without any problems ONLY if it has not been executed (!!! icon)
    dodgy3.mw
    Clearly dsolve(..., method=rosenbrock), the only dsolve present in this worksheet, seems to be the cause.

    PS: if the ODE has real coefficients instead of complex ones, there is no problem at all

 

If you can't reproduce those behaviours, maybe they come from some conflict between Maple 2015.2 and  Mac OS Mojave 10.14.3 ?

Hi, 

I obviously don't know what your system looks like, so my reply can be useless.
In some cases an IVP problem with complex terms, and thus a potentially complex solution, can be separated in two coupled IVP problems with real terms.
In such a case you can use events.
Here is an illustration with a simple problem. Maybe yours fits this pattern and can be separable?

Please: don't worry about this recurring error that I receive every time I try to download the content of a file, it is reproduced here to remind development staff that this problem is still unresolved​​​​​​​
Maple Worksheet - Error
Failed to load the worksheet /maplenet/convert/events.mw .

 

Download events.mw

Here are a few Maple command that you could try to use by yourself

set

intersect

union

minus

@Kitonum 

Never tried to do this, it seemd so weird!
Thanks for the precision ....  but I will keep doing it as I did it before

@Carl Love 

Hi,
I always wonder what is the interest of the ProbabilityTable distribution?
It is equivalent to EmpiricalDistribution iif the outcomes are integers from 1 to some value N, but is useless for any other finite sequence of outcomes.

By the way, I observed that sampling, with common seeds, a ProbabilityTable distribution and an Empirical distribution does not return the same sequences...
 

restart:
with(RandomTools[MersenneTwister]):
SetState( state=1234567 );
X:= Statistics:-RandomVariable( ProbabilityTable([0.2, 0.25, 0.35, 0.2]) ):
Statistics:-Sample(X, 10) - Vector[row](10, 2)

Vector[row](10, {(1) = 1., (2) = 2., (3) = -1., (4) = 2., (5) = 0., (6) = 2., (7) = -1., (8) = 1., (9) = 1., (10) = -1.})

(1)

restart:
with(RandomTools[MersenneTwister]):
SetState( state=1234567 );
Y:= Statistics:-RandomVariable( EmpiricalDistribution([-1, 0, 1, 2], probabilities=[0.2, 0.25, 0.35, 0.2]) ):
Statistics:-Sample(Y, 10)

Vector[row]([0., -1., -1., 0., -1., -1., 0., -1., 1., -1.])

(2)

 


 

Download sampling.mw

@brian bovril 

Right, thanks for the precision

@becejac 

Here it is, same name but slightly different contents

sets.mw

@Carl Love 

Funny ...
I was writting a worksheet on the same point and the time I finalize it and post it, you made this reply which meets a part of the work I did.
In my reply the text out of the worksheet is thus partly incorrect (thing is: your 6/1001 is the same than my "strategy 2")


In general I am always annoyed by these intersecting answers which (personally I don't care) can create conflicts, everyone claiming responsibility for the answer 

@Carl Love 

 

Absolutely, I discovered this thread some hours after many contributions had already been done, and particularly your answer concerning implicit differentiation.
Hope I did not interfere too much.

First 125 126 127 128 129 130 131 Last Page 127 of 154