mmcdara

7364 Reputation

20 Badges

8 years, 293 days

MaplePrimes Activity


These are replies submitted by mmcdara

@brian bovril 

I didn't know about this sitouts/byes stuff before your initial question and I don't think I correctly understand it.
I feel this is something which can be quite common in some american league (perhaps?) but there doesn't seem to me there is something equivalent in some other countries, for instance in France where I live.

So I don't want to bother you any longer with this, but what is done in the attached seems to be fair... nevertheless I feel it is not what you are looking for?
Is_that_unfair.mw

@brian bovril 

You speak about optimal or perfect solution but you never define what those terms mean.

Let's take another problem: soccer championships in any european country.

You have , let's say 10 teams, each of one must play twice against any other (once at home and once at its opponent's home).
A round consists in 5 games (for instance [1, 2],[3, 4], [5, 6], ..., [9, 10]). Not all the games are necessarily played the same  day and some game may be delayed, for instance played later during the same week.
As each team plays 2*9=18 games it takes 18 rounds to complete the championship.
The championship is fair in the sense that all teams play the same number of games and meet twice any competitors in two different places.
Optimality could occur to minimize the global cost of displacements this championship requires, or to minimize the sum of the travels from game to game to spare the tiredness of the the teammates, and so on.

In your tournament you don't seem to care about fairness, do you?

Assuming only one game is delayed each round and delayed up to the end of the 18th round.
0ne might say that each week there are two byes.
To maintain the fairness of this chamionship those 18 pairs should contain exactly two occurrences of each team and, to go even further, if one pair is [A, B} (meaning B plays at home), there must be the 
pait [B, A] too.
So, in some sense one might say there are 18 weeks where only 4 games are played and three special weeks where 5 games will take place... plus an extra one with only three games.

This would be quite a complex championship to organize as it lasts 22 weeks instead of 18 (maybe it reduces the whole tiredness of the teammates and could be claimed optimal)

@vv 

Without loss of generality one can assume b >= a.
I demonstrated this result by hand, proving that (a+1)*(a+2)*...*(a*b) was divisible by c^a for any c is in {1, ..., b}. Then I used a pigeon hole principle to prove that (a+1)*(a+2)*...*(a*b) was divisible by (2^a)*(3^a)*...*(b^a) ... but it is a very cumbersome proof.

What a great idea to use the Legendre's formula.

Thanks.

This is only a comment to complete (maybe?) @Ronan's answer, so please: do not convert it into an answer.

Let P any of the 3 canonical planes. 
The radius of the circle which figures the intersection of the sphere S and P only depends on the radius R of S and on the distance of S center to plane P.
The coordinates of the center of the intersecting circle are even trivial to find.

For instance, if P=(0, x, y), then the radius of the intersecting plane depends on R and on the z coordinate of S center.
Using Pythagore's theorem this radius is sqrt(5^2 - 4^2) = 3.
The coordinates of the intersecting circle are those of S center where the ramaining corrdinate (z) is set to 0, so (3, 7, 0).

Of course one can use package geom3d to adress the problem and get rid of any reasoning, but it looks like a sledgehammer do kill a fly.
So, what were uou expecting for while asking such a trivial question?

@paulmcquad

Here is a variant of my previous worksheet where the intervals x belongs to are displayed in the usual mathematical form (for instance [2, 3) ).

Note that you can easily change what procedure rel returns (last line before end proc) to get exactly what you asked for in your question.

Enhanced_convert_2.mw

Examples :

@salim-barzani 

I'm probably slow on the uptake and maybe a bit obtuse. 
So I don't think I can help you any longer, and suggest you wait for someone else to help you more efficiently.

Good luck

I don't really understand the connection between the text in your question and the code you deliver.

Whatever, at the very end your code ends with 

odetest(W2, F2);        
                          0

A result which would satisfy a lot of people as it means that solution W2 satisfies ode F2.

What seems to worry you is that the guess function in W2 is equal to the  constant e[0]. Isn'it ?
So, if the result you get doesn't suit you I believe you face a methodology issue.

I feel it is up to you to fix this before coming back to us

G-factoring_mmcdara_1.mw

Without more details it will be impossible to help you.
Can you give the expression of the sequence you use?

@salim-barzani 

I have absolutely no idea what you are talking about or what you want to achieve in your problem_99.mw worksheet.
problem99_mmcdara.mw

@brian bovril 

Using permutation and brute force proves itself to be simpler and most reliable than trying to randomize everything.

 

restart
 

N := 10:
L := [$1..N];

[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

(1)

Lex      := [ L[], L[1] ]:
sits_out := [ seq([Lex[i], Lex[i+1]], i=1..N) ]:
Lremain  := [ seq(subsop(sits_out[i][1] = NULL, sits_out[i][2] = NULL, L), i=1..N) ]:

tt := proc(S, M)
  local T, t, m:
  T := combinat:-randperm(S)[1]:
  for m from 2 to M do
    t := combinat:-randperm( remove(has, S, op~([T])) )[1]:
    T := T, t
  end do:
  return {T}
end proc:

found := false:

while not found do
  S        := { seq(seq([Lremain[1][i], Lremain[1][i+j]], j=1..N-2-i), i=1..N-3) };
  Round[1] := tt(S, (N-2)/2);
  perm     := L =~ ListTools:-Rotate(L, 1);

  for k from 2 to N do
    Round[k] := eval(Round[k-1], perm)
  end do:

  if numelems(`union`(seq(convert~(Round[k], set), k=1..N))) = N*(N-2)/2 then
    found := true:
  end if:
end do:

Matrix(N, 2, (i, j) -> `if`(j=1, Round[i], sits_out[i]));

Matrix([[{[3, 4], [5, 8], [6, 10], [7, 9]}, [1, 2]], [{[4, 5], [6, 9], [7, 1], [8, 10]}, [2, 3]], [{[5, 6], [7, 10], [8, 2], [9, 1]}, [3, 4]], [{[6, 7], [8, 1], [9, 3], [10, 2]}, [4, 5]], [{[1, 3], [7, 8], [9, 2], [10, 4]}, [5, 6]], [{[1, 5], [2, 4], [8, 9], [10, 3]}, [6, 7]], [{[1, 4], [2, 6], [3, 5], [9, 10]}, [7, 8]], [{[2, 5], [3, 7], [4, 6], [10, 1]}, [8, 9]], [{[1, 2], [3, 6], [4, 8], [5, 7]}, [9, 10]], [{[2, 3], [4, 7], [5, 9], [6, 8]}, [10, 1]]])

(2)

# Check each game appears only once

numelems(`union`(seq(convert~(Round[k], set), k=1..N))) ,  N*(N-2)/2

40, 40

(3)

for n from 1 to N do
  printf("Round %d\n", n):
  printf("  byes %a\n", sits_out[n]):
  for j from 1 to (N-2)/2 do
    printf("  game %d vs %d\n", op(Round[n][j])):
  end do:
  print():
end do:

Round 1

  byes [1, 2]
  game 3 vs 4
  game 5 vs 8
  game 6 vs 10
  game 7 vs 9

 

 

Round 2
  byes [2, 3]
  game 4 vs 5
  game 6 vs 9
  game 7 vs 1
  game 8 vs 10

 

 

Round 3
  byes [3, 4]
  game 5 vs 6
  game 7 vs 10
  game 8 vs 2
  game 9 vs 1

 

 

Round 4
  byes [4, 5]
  game 6 vs 7
  game 8 vs 1
  game 9 vs 3
  game 10 vs 2

 

 

Round 5
  byes [5, 6]
  game 1 vs 3
  game 7 vs 8
  game 9 vs 2
  game 10 vs 4

 

 

Round 6
  byes [6, 7]
  game 1 vs 5
  game 2 vs 4
  game 8 vs 9
  game 10 vs 3

 

 

Round 7
  byes [7, 8]
  game 1 vs 4
  game 2 vs 6
  game 3 vs 5
  game 9 vs 10

 

 

Round 8
  byes [8, 9]
  game 2 vs 5
  game 3 vs 7
  game 4 vs 6
  game 10 vs 1

 

 

Round 9
  byes [9, 10]
  game 1 vs 2
  game 3 vs 6
  game 4 vs 8
  game 5 vs 7

 

 

Round 10
  byes [10, 1]
  game 2 vs 3
  game 4 vs 7
  game 5 vs 9
  game 6 vs 8

 

(4)

 


 

Download Round_Robin_mmcdara.mw

 

@segfault 

Just to be clear, the "list of arguments" are the independent routines to be calculated in parallel right ?

Not at all.

Explanation:
when I run all the simulations on a single node I use a procedure SIMULER_OneProc whose call is basically this one

res := SIMULER_OneProc(Ver_plan_exp, Drag_sol, tps_decollement, Ver_piecewise_va, mur, tps_max):

Next, for obvious computational reasons, I want to distribute the same simulations over multiple nodes.
The idea is to split the matrix Ver_plan_exp which defines the simulation conditions into several blocks that are indepently ran in parallel on several nodes, and to repeat this operation until all the simulation conditions are used.

To do this I built a new procedure SIMULER_MP from  procedure  SIMULER_OneProc.
Procedure SIMULER_MP has exactly the same body of commands than SIMULER_OneProc,  except for one thing: for the reasons I explained previously I decided to save the simulation results in a file instead of return the corresponding matrix.

Then these two procedures end this way:

SIMULER_OneProc := proc(....)
.
.
# loop over the simulation conditions (build some matrix RESULT)
.
.
return RESULT
end proc



SIMULER_MP := proc(....)
.
.
# loop over the simulation conditions (build some matrix RESULT)
.
.
save RESULT Some_m_File
end proc

So  SIMULER_MP must have extra arguments, comparer to  SIMULER_OneProc's) to manage the name of the file where the partial results are saved.
Those two arguments are:

  • the number num_bloc of the Ver_plan_exp block currently simulated,
  • the absolute path ICI of the folder where the file is saved.

Then a direct call of SIMULER_MP is

SIMULER_MP(num_bloc, plan_bloc, [1], eval(Drag_sol), tps_decollement, [Ver_piecewise_va], 
           mur, tps_max, ICI)   

Compare the command above to this one:

Grid:-Run(
      noeud,              
      SIMULER_MP,            
      [                        
        num_bloc,              
        plan_bloc,            
        [1],                  
        eval(Drag_sol),       
        tps_decollement,      
        [Ver_piecewise_va],   
        mur,                  
        tps_max               
        ICI                   
      ]                       
    ):

You see that I do not write (which could seem more natural) this

Grid:-Run(
      noeud,              
      SIMULER_MP(num_bloc, plan_bloc, [1], eval(Drag_sol), tps_decollement, [Ver_piecewise_va],
                 mur, tps_max, ICI     
    ):

Using Grid:-Run imposes using three arguments: 

  1. the node on which execute the task,
  2. the name of the procedure to execute,
  3. the list of its parameters (thus the sequence of the names its definition contents...that is what is called parameterSequence in help(procedure) ).

What is arround Grid:-Run is nothing but a double loop over all the  Ver_plan_exp blocks: indeed you may observe that the second argument of SIMULER_MP is  not  Ver_plan_exp but plan_bloc which is nothing but the block to simulate. 

So what I do here is 
asking several nodes to run exactly the same process (task) with different data 
NOT
asking several nodes to run each a different process included in a single task.



(sorry I don't have Maple right now)

The pentagon is concave equilateral pentagon... hard to cop with.
The classical trick is to used its convex counterpart: define point B'  as the symetric of point B wrt line AC.
Then AB'CDE is a convex equilateral pentagon.
Solving it is quite easy by considering the three isoceles triangles AB'E, EB'D and DB'C.
The method can found here

To get the angles of the original concave pentagon observe that angle <A, B', C> = 2*Pi-b, and that the 4 angles on the figure below are equal

@salim-barzani 

I'm honestly a very far cry from that.

@salim-barzani 

restart

Error,

restart

 

with(PDEtools):

with(LinearAlgebra):

with(SolveTools):

undeclare(prime)

`There is no more prime differentiation variable; all derivatives will be displayed as indexed functions`

(1)

PDEtools:-declare(Omega(x, t)); 1; PDEtools:-declare(U(xi)); 1; PDEtools:-declare(u(x, y, z, t)); 1; PDEtools:-declare(Q(xi))

Omega(x, t)*`will now be displayed as`*Omega

 

U(xi)*`will now be displayed as`*U

 

u(x, y, z, t)*`will now be displayed as`*u

 

Q(xi)*`will now be displayed as`*Q

(2)

tr := {t = tau, x = (-ZETA*c[3]-tau*c[4]-`&Upsilon;`*c[2]+xi)/c[1], y = `&Upsilon;`, z = ZETA, u(x, y, z, t) = U(xi)}:

pde1 := diff(u(x, y, z, t), `$`(x, 3), z)-4*(diff(u(x, y, z, t), x, t))+4*(diff(u(x, y, z, t), x))*(diff(u(x, y, z, t), x, z))+2*(diff(u(x, y, z, t), `$`(x, 2)))*(diff(u(x, y, z, t), z))+3*(diff(u(x, y, z, t), `$`(y, 2))) = 0:

``

L1 := PDEtools:-dchange(tr, pde1, [xi, `&Upsilon;`, ZETA, tau, U]):

map(int, L1, xi):

ode := %:

F := sum(a[i]*(m+1/(diff(G(xi), xi)))^i, i = -1 .. 1):

D1 := diff(F, xi):

S := diff(G(xi), `$`(xi, 2)) = -(2*m*mu+lambda)*(diff(G(xi), xi))-mu:

E1 := subs(S, D1):

D2 := diff(E1, xi):

E2 := subs(S, D2):

D3 := diff(E2, xi):

E3 := subs(S, D3):

NULL

K := U(xi) = F:

K1 := diff(U(xi), xi) = E1:

K2 := diff(U(xi), `$`(xi, 2)) = E2:

K3 := diff(U(xi), `$`(xi, 3)) = E3:

NULL

L := eval(ode, {K, K1, K2, K3}):

# rewritting rule

RR := isolate(m+1/(diff(G(xi), xi))=Phi, diff(G(xi), xi));

diff(G(xi), xi) = 1/(Phi-m)

(3)

# Apply RR and collect wrt Phi

subs(RR, L):
normal(%):
PhiN := collect(numer(lhs(%)), Phi):
PhiD := denom(lhs(%%));

Phi^4

(4)



with(LargeExpressions):

LLE := collect(PhiN, Phi, Veil[phi] ):
LLE / PhiD = 0;

(3*Phi^8*phi[1]+6*Phi^7*phi[2]+Phi^6*phi[3]+Phi^5*phi[4]-Phi^4*phi[5]-Phi^3*phi[6]+Phi^2*phi[7]-6*Phi*phi[8]+3*phi[9])/Phi^4 = 0

(5)

# phi[i] coefficients


phis := [ seq( phi[i] = simplify(Unveil[phi](phi[i]), size), i=1..LastUsed[phi] ) ]:

print~( phis ):

phi[1] = mu^2*a[1]*c[1]^2*c[3]*(2*mu*c[1]+a[1])

 

phi[2] = lambda*mu*a[1]*c[1]^2*c[3]*(2*mu*c[1]+a[1])

 

phi[3] = -8*(mu*c[3]*(m^2*mu^2+m*mu*lambda-(7/8)*lambda^2)*c[1]^3+(3/4)*c[3]*((m^2*a[1]+a[-1])*mu^2+m*mu*lambda*a[1]-(1/2)*lambda^2*a[1])*c[1]^2+(1/2)*mu*c[1]*c[4]-(3/8)*mu*c[2]^2)*a[1]

 

phi[4] = -8*(c[3]*(m^2*mu^2+m*mu*lambda-(1/8)*lambda^2)*c[1]^3+(3/4)*c[3]*(m*lambda*a[1]+mu*(m^2*a[1]+2*a[-1]))*c[1]^2+(1/2)*c[1]*c[4]-(3/8)*c[2]^2)*lambda*a[1]

 

phi[5] = -2*(m^2*mu^2+m*mu*lambda-(1/2)*lambda^2)*c[3]*((m^2*a[1]+a[-1])*mu+m*lambda*a[1])*c[1]^3-3*c[3]*((m^4*a[1]^2+4*m^2*a[-1]*a[1]+a[-1]^2)*mu^2+2*m*lambda*a[1]*(m^2*a[1]+2*a[-1])*mu+lambda^2*a[1]*(m^2*a[1]-2*a[-1]))*c[1]^2-4*((m^2*a[1]+a[-1])*mu+m*lambda*a[1])*c[4]*c[1]+3*((m^2*a[1]+a[-1])*mu+m*lambda*a[1])*c[2]^2

 

phi[6] = -8*a[-1]*lambda*(c[3]*(m^2*mu^2+m*mu*lambda-(1/8)*lambda^2)*c[1]^3+(3/2)*c[3]*(m*lambda*a[1]+mu*(m^2*a[1]+(1/2)*a[-1]))*c[1]^2+(1/2)*c[1]*c[4]-(3/8)*c[2]^2)

 

phi[7] = -8*a[-1]*(mu^2*c[1]^2*c[3]*(mu*c[1]+(3/4)*a[1])*m^4+2*c[3]*mu*c[1]^2*(mu*c[1]+(3/4)*a[1])*lambda*m^3+((1/8)*mu*c[3]*c[1]^3*lambda^2+(3/4)*c[3]*(lambda^2*a[1]+mu^2*a[-1])*c[1]^2+(1/2)*mu*c[1]*c[4]-(3/8)*mu*c[2]^2)*m^2+(3/4)*(-(7/6)*c[1]^3*c[3]*lambda^2+mu*a[-1]*c[1]^2*c[3]+(2/3)*c[1]*c[4]-(1/2)*c[2]^2)*lambda*m-(3/8)*lambda^2*a[-1]*c[1]^2*c[3])

 

phi[8] = (m*mu+lambda)*a[-1]*c[3]*(2*m^2*mu*c[1]+2*lambda*m*c[1]+a[-1])*m*lambda*c[1]^2

 

phi[9] = (m*mu+lambda)^2*a[-1]*c[3]*(2*m^2*mu*c[1]+2*lambda*m*c[1]+a[-1])*m^2*c[1]^2

(6)

# WATCHOUT: you have 9 coefficients and so its desirable to have the same number of unknowns

unknowns := indets(rhs~(phis), name);

COEFFS := solve(rhs~(phis), unknowns)

{lambda, m, mu, a[-1], a[1], c[1], c[2], c[3], c[4]}

 

{lambda = 0, m = 0, mu = mu, a[-1] = a[-1], a[1] = 0, c[1] = c[1], c[2] = c[2], c[3] = c[3], c[4] = -(3/4)*(mu*a[-1]*c[1]^2*c[3]-c[2]^2)/c[1]}, {lambda = 0, m = m, mu = 0, a[-1] = a[-1], a[1] = a[1], c[1] = c[1], c[2] = c[2], c[3] = c[3], c[4] = c[4]}, {lambda = 0, m = m, mu = mu, a[-1] = a[-1], a[1] = a[1], c[1] = c[1], c[2] = c[2], c[3] = 0, c[4] = (3/4)*c[2]^2/c[1]}, {lambda = 0, m = m, mu = mu, a[-1] = -2*m^2*mu*c[1], a[1] = -2*mu*c[1], c[1] = c[1], c[2] = c[2], c[3] = c[3], c[4] = (1/4)*(16*m^2*mu^2*c[1]^3*c[3]+3*c[2]^2)/c[1]}, {lambda = lambda, m = m, mu = 0, a[-1] = a[-1], a[1] = a[1], c[1] = c[1], c[2] = c[2], c[3] = 0, c[4] = (3/4)*c[2]^2/c[1]}, {lambda = lambda, m = m, mu = mu, a[-1] = 0, a[1] = 0, c[1] = c[1], c[2] = c[2], c[3] = c[3], c[4] = c[4]}, {lambda = lambda, m = m, mu = mu, a[-1] = 0, a[1] = a[1], c[1] = c[1], c[2] = c[2], c[3] = 0, c[4] = (3/4)*c[2]^2/c[1]}, {lambda = lambda, m = m, mu = mu, a[-1] = 0, a[1] = -2*mu*c[1], c[1] = c[1], c[2] = c[2], c[3] = c[3], c[4] = (1/4)*(4*m^2*mu^2*c[1]^3*c[3]+4*lambda*m*mu*c[1]^3*c[3]+lambda^2*c[1]^3*c[3]+3*c[2]^2)/c[1]}, {lambda = lambda, m = m, mu = mu, a[-1] = a[-1], a[1] = a[1], c[1] = (3/4)*c[2]^2/c[4], c[2] = c[2], c[3] = 0, c[4] = c[4]}, {lambda = lambda, m = m, mu = mu, a[-1] = a[-1], a[1] = a[1], c[1] = c[1], c[2] = 0, c[3] = 0, c[4] = 0}, {lambda = lambda, m = m, mu = mu, a[-1] = -2*m^2*mu*c[1]-2*lambda*m*c[1], a[1] = 0, c[1] = c[1], c[2] = c[2], c[3] = c[3], c[4] = (1/4)*(4*m^2*mu^2*c[1]^3*c[3]+4*lambda*m*mu*c[1]^3*c[3]+lambda^2*c[1]^3*c[3]+3*c[2]^2)/c[1]}, {lambda = lambda, m = m, mu = mu, a[-1] = a[-1], a[1] = a[1], c[1] = 0, c[2] = 0, c[3] = c[3], c[4] = c[4]}

(7)
 

 

Download factoring_mmcdara_2.mw

@acer 

Thank you for these clarifications, they give me a picture of the situation that I didn't imagine.  
Hard to find out who's the good guy and who's the bad guy in this story, above all when the good maybe isn't that good and the bad maybe isn't that bad... which is not my concern for I'm not a vigilante.
I can understand your last comment

3 4 5 6 7 8 9 Last Page 5 of 148