mmcdara

6279 Reputation

17 Badges

7 years, 325 days

MaplePrimes Activity


These are replies submitted by mmcdara

@brian bovril 

For instance in the 16 players case.
Do you mean that all the players are rankedn fir instance A > B > ... > P and that in order to balance the tems A and P are temmates, B and O are teammates and so on?
Or do you have something else in mind?

@Carl Love 

Thanks for your intervention.

@Prakash J 

I've just seen your reply.
I edited my answer accordingly and checked I was able to download my own code from it.

Sorry for the inconvenience.

 

  • Is it possible to solve this set of equations using solve?
    NO, the equations are far too complex.
     
  • So how can we?
    One solution is to use fsolve instead.
    Another one is to minimize some functional of the equations.
     
  • How can I use fsolve?
    In solve you declared 12 unknowns 
    unk := {a1, a2, a3, a4, n1, n2, n3, n4, s1, s2, s3, s4}
    But your system of equations contains 16 names. To use fsolve you will need to give numerical values to the 4 remaining names b, q, r, theta:
    unk := {a1, a2, a3, a4, n1, n2, n3, n4, s1, s2, s3, s4}; 
        {a1, a2, a3, a4, b, n1, n2, n3, n4, q, r, s1, s2, s3, s4, theta}
    ind := indets(eqn, name);
               {a1, a2, a3, a4, n1, n2, n3, n4, s1, s2, s3, s4}
    par := convert(ind minus unk, list);
                            [b, q, r, theta]
    
    For instance:
    ru   := rand(0. .. 1.):
    rpar := [seq(p = ru(), p in par)];
        [b = 0.8953600369, q = 0.2617341097, r = 0.7780122500, theta = 0.06587642124]
    reqn := eval(eqn, rpar):
    
    Then use fsolve(reqn) to get, if possible, a unique solution for the choice rpar of the parameters.
     
  • So I'm off the hook?
    NO, because you then have 12 unknowns but only 11 reqn equations.
    Note that this problem also existed with solve.


Conclusions:

  • Using solve is a dead end.
     
  • Using fsolve (or the minimization of some functional) requires defining correctly the problem:
    • What are the equations?
    • What are the unknowns (whose number must equal to that of the equations)?
    • What are the possible values the remaining parameters can take?

 

By the way; I'm still fascinated by people who ask questions containing (kind of) hand-written equations of extreme complexity. When I see this, I can't help thinking that if we knew the starting point of these equations, we might have some idea of an efficient way to simplify their expressions or to re-parameterize them judiciously, and thus hope to be able to solve them more simply.

@sija 

What doesn't work for you?

restart;

build:= proc(j)

  local k;

  global L;

  L:=[]:

 

  for k from 2 to j do

    L:= [op(L), v[k]];

  end do;

 

  RETURN(L);

end proc:

N := 6:

L:=[]:

for j from 2 to N-1 do

  for i from 2 to j do

   if nops(L) = 0

    then

      print('j' = j, 'i' = i, 'nops(L)' = nops(L)); # Debug only

      # I need this here, but how to do ?

      # nops(L);

    end if;

    

    build(i);

    

    if nops(L) > 0

    then

      for s from 1 to nops(L) do

        print('j' = j, 'i' = i, 's' = s, 'nops(L)' = nops(L), 'L(s)' = L[s]); # Debug only

        # I need this here, but how to do ?

        # L[s];

      end do;

    end if;

  end do;

end do;

 

j = 2, i = 2, nops(L) = 0

 

j = 2, i = 2, s = 1, nops(L) = 1, L(s) = v[2]

 

j = 3, i = 2, s = 1, nops(L) = 1, L(s) = v[2]

 

j = 3, i = 3, s = 1, nops(L) = 2, L(s) = v[2]

 

j = 3, i = 3, s = 2, nops(L) = 2, L(s) = v[3]

 

j = 4, i = 2, s = 1, nops(L) = 1, L(s) = v[2]

 

j = 4, i = 3, s = 1, nops(L) = 2, L(s) = v[2]

 

j = 4, i = 3, s = 2, nops(L) = 2, L(s) = v[3]

 

j = 4, i = 4, s = 1, nops(L) = 3, L(s) = v[2]

 

j = 4, i = 4, s = 2, nops(L) = 3, L(s) = v[3]

 

j = 4, i = 4, s = 3, nops(L) = 3, L(s) = v[4]

 

j = 5, i = 2, s = 1, nops(L) = 1, L(s) = v[2]

 

j = 5, i = 3, s = 1, nops(L) = 2, L(s) = v[2]

 

j = 5, i = 3, s = 2, nops(L) = 2, L(s) = v[3]

 

j = 5, i = 4, s = 1, nops(L) = 3, L(s) = v[2]

 

j = 5, i = 4, s = 2, nops(L) = 3, L(s) = v[3]

 

j = 5, i = 4, s = 3, nops(L) = 3, L(s) = v[4]

 

j = 5, i = 5, s = 1, nops(L) = 4, L(s) = v[2]

 

j = 5, i = 5, s = 2, nops(L) = 4, L(s) = v[3]

 

j = 5, i = 5, s = 3, nops(L) = 4, L(s) = v[4]

 

j = 5, i = 5, s = 4, nops(L) = 4, L(s) = v[5]

(1)

L

[v[2], v[3], v[4], v[5]]

(2)

# Your code seems a little bit too complex to do this:

L := [seq(v[k], k=2..N-1)]

[v[2], v[3], v[4], v[5]]

(3)

 


 

Download That_seems_complex.mw

@Kitonum 

As I use Maple 2015 at home I cannot confirm what I'm going to say.
If I'm not mistaken Maple 2021 (and likely newer versions) "has" a 3D earth globe (see MathApps > WorldMapProjections, Projection=Globe) that you might use (maybe not ?) instead of your sphere to be closer to what the OP asked.

@Kitonum 
 

 

The OP got

A__inf_wo_assumptions = signum(sigma__d^3*sigma__e^2*sigma__v^4*(-sigma__d*sigma__e^2+sqrt(sigma__d^2*sigma__e^4))/(sigma__e^4+2*sigma__e^2*sigma__v^2+sigma__v^4))*infinity

As you pointed out the "problem" comes from the sign of sigma__d*sigma__e^2.

Nevertheless I feel that an output of the form below would be less disturbing (a kind of what the option parametricleads to in solve):

piecewise(sigma__d*sigma__e^2 >= 0, 0, +/- infinity)


(
Note that sigma__e^2being positive the condition in piecewise could even be sigma__d > 0.
Nevertheless Maple seems to have a condition about sigma__e, which could be simply sigma__e::real:

A__inf_with_assumptions := limit(A, gamma = infinity) assuming 0 < sigma__d, sigma__e::real;
                                      0

)

Whatever, which is really boring with the generic Maple solution is that it does not provide the correct result (Maple 2015) when you evaluate the output of limit with the ad hoc assumptions:

hyp := 0 < sigma__e, 0 < sigma__v, 0 < sigma__d;
            0 < sigma__e, 0 < sigma__v, 0 < sigma__d
A__inf_with_assumptions := limit(A, gamma = infinity) assuming hyp;
                               0
A__inf_wo_assumptions := limit(A, gamma = infinity):
eval(%) assuming hyp;
                           undefined
# this last result is logic as it A__inf_wo_assumptions is then the undeterminate form 0*(+infinity)

So I understand the OP's perplexity.
 

@MaPal93 

I use maple 2015 and this does not appear: No_problem_MaPal_Maple2015.mw
(Note that there is absolutlly no reason for the expressions to contain fractions.)

The fact you get some can come from the way simplify proceeds with your own Maple version.
But as I have only Maple 2015 I can't help you more on this point (look to the simplify help page).

@MaPal93 

As you seem surprised by the capability of Maple to get these results that simply, let me tell you there is no magic behind and this and that you can get them by hand in a very simple way.

The only difficulty is that the process is very tedious and require a lot of attention in writting the successive equations.

To illustrate this look to the attached file where I simulated with Maple what we would do to compute Cov(A, B) without having any computer algebra system at our disposal Example.mw

You will see that the equations are extremely complex but that the process to get to the solution is indeed extremely simple.
Note that at no moment I use the Statistics not the Student:-statistics packages.

@acer 

Thanks your perfect reply.

@acer 

I remember asking a question many years ago about what you call the "Maple of 20 years ago".
Unfortunately, I lost the (your?) answer and was unable to find it for a long time.
Thank you for suggesting an option in your reply.

I have a question about gamma (or any other predefined constant).
In this recent answer I posted, my first idea was to declare gamma as local just after restart.
But when I evaluated as floats the expresssion which contains gamma I was surprised to see that gamma had been replaced by 0.577215...
Just as if local gamma hadn't forgotten what gamma was. 

I naively thought that declaring gamma as local would make Maple forget what gamma was.
(note the same thing holds with unprotect):

restart
local gamma;
evalf(gamma);
                         0.5772156649

The scope of local gamma is not clear to me and I don't understand the outputs above

restart
local gamma;

# here gamma is treated as a symbol
f := gamma^2; diff(f, gamma);
                                  2
                             gamma 
                            2 gamma
# but here it is treated as a number
f := 5*gamma^2;
diff(evalf(f), gamma);
                                   2
                            5 gamma 
                               0

So, assuming you have an expression (let's say written on a piece of paper) which contains a variable named gamma and that you want to translate it in Maple.
Giving that you are going to do some operations on this Maple expression, what is the safer way to proceed:

  • Declare gamma as local?
  • Or change the name gamma by something else in the Maple code?
     

Let me know if you think it would be more appropriate for me to open a new thread for this question.

Thanks in advance for your reply

@vv 

I didn't catch what you mean.

When you say that "have ommited useassumptions" you are right for I did not it in my code, but in the body of my answer I wrote "SOL_gt := solve(expr > 0, useassumptions=true) assuming hyp returns a wrong result (Maple 2015)".

What does "So, solve has another task: a single inequality instead of a system" mean?
 


The code is now much simpler.
About the interpretation of something like "X=X" in a  solution: it means literally "there is no restriction on X" or "foe each value of X".



Sorry for the inconvenience.

@acer 

I feel it could be more efficient as it avoids using Explode (?)

restart
A := {12, 17, 24, 28}:
B := {358, 568}:
TA:=table([map(a -> a=convert(a, base, 10), A)[]]):
TB:=table([map(b -> b=convert(b, base, 10), B)[]]):

{seq(seq(`if`(ormap(member,TA[a],TB[b]),
              NULL,parse(cat(a,b))),b=B),a=A)};

           {12358, 12568, 17358, 17568, 24358, 24568}

@pallav 

expr1 := 4*(theta - 1/4)*gamma1^2:
# The representation you required:
#                     2
# (4 theta - 1) gamma1 
simplify(expr1)
                                         2
                     (4 theta - 1) gamma1 



expr2 := (alpha + gamma1)^2*epsilon^2 + 2*(alpha + gamma1)*(beta + gamma1)*epsilon - 4*alpha*gamma1*theta + beta^2 + 2*beta*gamma1 - 4*(theta - 1/4)*gamma1^2:
# The representation you required:
#                                           2
# (beta + (alpha + gamma1) epsilon + gamma1)  - 4 gamma1 theta (alpha + gamma1)
Student:-Precalculus:-CompleteSquare(expr2, beta):
op(1, %) + factor(simplify(%-op(1, %)));
                                                    2
          (beta + (alpha + gamma1) epsilon + gamma1)   - 4 gamma1 theta (alpha + gamma1)

solutions.mw

1 2 3 4 5 6 7 Last Page 3 of 127