8 years, 20 days

## Respect choices...

MaplePrimes

When I began posting replies or answers in Mapleprimes I remember Carl Love explaining me the difference between them.
I was a newbie by then but I think I've grown up and now I know the difference between a reply and a comment.
For reasons of my own, which I will perhaps explain in a post one day, I have decided to sent only comments and no more answers.

Unfortuntely administrators, or maybe a robot, keep turning my comments into answers.
Which in turn forces me to convert these answers into comments, which are then converted back into answers... which may never end and is a complite waste of time.

Is there a way to declare that I want my choices to be respected?

(For the record I've even written in the header of my comment that I didn't want it to be converted into an answer, but the comment was removed and the conversion done !)

## My rant of the day...

MaplePrimes

This is an extremely common situation; either some moderator displaced or deleted the question, or the OP deleted himself (herself).
Whatever the reason, it's always extremely upsetting to be confronted with this situation, which shows how rude, to put it mildly, some people can be.

Initial question (this day, about 2 hours ago)

Comment

## How to efficiently count the number of r...

Maple

Let M a matrix of zeros and ones for instance.

```N := 10^5:  # This is the order of magnitude I have to consider (10^4 may be enough if L is "small")
L := 5:     # L is between 3 and 8 in practice (see context at the end of this post)
M := LinearAlgebra:-RandomMatrix(N, L, generator=0..1):```

Let C a set of colums of M and |C| the number of elements of C.
Let P a list of length |C| of  zeros and ones.

I want to count al the rows in M such that

``and`( seq( M[n, C[k]] = P[k], k = 1.. |C| ) )`

For instance

```pattern := n -> `if`(evalb(`and`(seq(S[n, C[k]]=P[k], k=1..3))), 1, 0):
t0 := time():
time()-t0
12351
0.431  # seconds
```

This code appears to be quite slow when one consider that I have to run it for all the possible choices of C and P (the contect is detailed below).

Do you have any some ideas to improve the efficiency (in terms of computational time) of this counting operation?

The context:
Let A = {1, 2, .., L} and P(A) the power set of A.
I set Q(A) = P(A) \ ( { } union A}.
Let C and C'  two disjoint subsets of Q(A).
Example

```# With L=3

Q(A) = { {1},  {2},  {3},  {1, 2},  {1, 3},  {2, 3} }

# if A chose C =
C = {2}

# Then C' is member of
C' in { {1}, {3}, {1, 3}```

For any couple (C, C')  I want to do this

1. Let |C| (|C'|) cardinal of C (resp C').

2. Let us consider that members of C (resp C') "point to" the corresponding columns of M.
for instance C = {2, 3} refers to columns 2 and 3 of M.
As C and C' are ordered iI will write them indistinctely as lists (for instance C = [2, 3] in example above) when necessary.

3. To a given |C| (|C'|) one may associate 2|C| (resp 2|C'|) sequences of 0 and 1.
For instance,  to C = {2, 3} are associated sequences [0, 0], [0, 1], [1, 0], [1, 1].
Let s(C) (s(C')) the list, or set, of 0-1 sequences associated to C (resp C')..

4. For any couple (C, C') and any of the 2|C|+|C'| combinations (p, p') where p belongs to s(C) and p' belongs to s(C') I want to count the number of occurrences defined by:
`seq( M[n, C[k]] = p[k], k=1..|C|) and seq( M[n, C'[k]] = p'[k], k=1..|C'|) `

For instance, if C={2} and C={1, 3} I want to count the number M rows M such that

```p = [0], p'=[1, 0]
M[n, 2]=0 and M[n, 1]=1 and M[n, 3]=0;

p = [1], p'=[1, 1]
M[n, 2]=1 and M[n, 1]=1 and M[n, 3]=1

... and so on```

The computational time may ne quite large because of the number of possible couples (C, C') when L is large ( there exists  Stirling2(L+1, 3) such couples: already 90 couples for L=5  ... and 28501 for L=10).

## Why doesn't L2 norm sorting work?...

Maple 2015

Why sorting these 4 vectors wrt L(+oo) norm returns a correct result bur sorting them wrt L2 norm doesn't (unless if I evaluate the norms as floats)?

 > restart:
 > kernelopts(version)
 (1)
 > V := [seq(LinearAlgebra:-RandomVector(2, generator=1..10), k=1..4)]; N2   := evalf(norm~(V, 2)); Ninf := norm~(V, +infinity);
 (2)

Sorting wrt L(+oo) norm

 > sort(V, key=(t -> norm(t, +infinity)));  # correct
 (3)

Sorting wrt L(2) norm

 > sort(V, key=(t -> norm(t, 2))); # not correct is(norm(V[4], 2) < norm(V[3], 2));
 (4)
 > sort(V, key=(t -> evalf(norm(t, 2)))); # correct
 (5)
 >

TIA

## How to color an implicitplot3d?...

Maple 2015

I have a surface defined by C(x, y, x) = 0 that I visualize with implicitplot3d.
Using shading=shue does not suits me and I would like to define my own coloring function F(x, y, z).

The first error I got made me think that a coloring function cannot depend on 3 parameters.
But a simpler (and not visually satysfying function) F(x, y) already leads to an error, which makes me wonder if it is possible to use a colorig function with  implicitplot3d?

implicitplot3d_coloring.mw