Carl Love

Carl Love

28035 Reputation

25 Badges

12 years, 321 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

@vv Oh my, I see that most of the new syntax features added for Maple 2019 are likewise not supported in 2-D input. I foresee this being a nuisance for those of us who answer questions here.

@ms0439883 

For easy reference, here is the line of code that I'm explaining:

[seq(1 +~ `+`(seq([0$(k-p), 1$p], p= P)), P= combinat:-partition(n-k, min(n-k, k)))]

Maple's combinat:-partition(n,k) returns a list of the partitions of n whose maximal elements are at most k. I need to conjugate those partitions whose maximal elements are equal to k, so I start with partitions of n-k whose maximal elements are at most k with the plan to compensate for exactly one missing k element later. The syntax of partition(n,k) won't allow k > n, so partition(n-k, k) would give an error for k > n/2, so I use partition(n-k, min(n-k, k)).

Now I have a list of partitions to process. The command [seq(f(x), x= L)] iterates over a list L, assigning each element to x in succession, passing it to f, and forming a list of the results. Hence my outer seq command is [seq(C(P), P= ...)] where is some as-yet-unexplained operation that will both conjugate P and compensate for the missing k. You must now remember that uppercase is always an individual partition of n-k expressed as a list of integers; P is neither a list of partitions nor an individual integer in a partition.

To conjugate a partition, I essentially use a Ferrers diagram. I'll assume that you either know what that is, or you can look it up (see, for example, this Wikipedia article). Instead of dots, I use 1s. For syntax reasons, I need lists of the same length, so I use lists of 1s padded on the left with 0s with each list having length k. The elementwise sum of these lists is the conjugate.

The Maple command X$N, where is a nonnegative integer, produces a sequence of copies of X. Thus [0$(k-p), 1$p] produces a length-list of p 1s padded on the left with 0s, exactly as described in the previous paragraph. Thus, seq([0$(k-p), 1$p], p= P) produces (as a sequence of lists) the entire Ferrers diagram of P. Note that lowercase p iterates over the integers in P.

Most of Maple's binary infix operators can be used in functional form (i.e., coming before their arguments) by enclosing them in backquotes. Thus `+`(5, 3, 7) is the same as 5+3+7. If the arguments are lists of the same length (as in the Ferrers diagram), then they are added elementwise. 

Most of Maple's binary infix operators can also be used in an infix elementwise form by appending tilde to the operator. Thus 1 +~ [x,y] is the same as [1+x, 1+y]. The purpose of this in my code is to compensate for the missing k by adding 1 to each element of each conjugated partition.

Please let me know if you understand all this or if you have further questions.

@Kalithiel The flag at the top of your Question says that you're using Maple 2019. The local syntax that I used will work in Maple 2019, but not in any earlier version. So, I think that you're using an earlier Maple. But, no matter, the old syntax (as shown by VV) will work in both new and old versions.

@nm If an item has Replies, then the Replies must be deleted first before the item itself can be deleted. By the way, you are a moderator.

I don't see why your Answer or any Answer should be deleted simply because it's not the most-complete or most-general answer possible. That would be a very high bar in many cases, and some things would get no Answers. Perhaps the OP does indeed only need the size-2 case.

@nm Of course, that only works when the size is 2. But I suspect that it could be applied recursively.

@brian bovril It seems that you don't understand those words that I underlined in red above. The probability is 1/1001 for a probability question related to this situation, but that question is irrelevant ! The answer to the relevant probability question is 6/1001. Whenever a situation seems unlikely, causing you to suspect a nonrandom selection process, measuring its unlikeliness involves consideration of those words underlined in red.

The 2018 code is functionally the same as the 2019. The latter has coding features that make things clearer, such as placing local declarations close to where they are used. I also extensively elaborated the comments.

@tomleslie Another alternative is to use the options adaptive= false, numpoints= 200 for each plot. But, to me, there's no good reason to pack the matrices into a single matrix anyway.

@vv I think that this Question may be pursuant to finding a solution to the OP's previous Question, for which there's been no satisfactory solution. That problem was finding the zeros of the gradient of a degree-4 polynomial in 4 variables with coefficients that were rational functions of 3 parameters. I think that a satisfactory solution without numeric values for the parameters may be impossible. With numeric values of the parameters, solve quickly returns a very large RootOf solution that can be reduced to numeric solutions.

@Kitonum The OP's underlying question is whether the results were achieved by a random selection. This is a claim that can be tested by standard hypothesis testing. The p-value of the test is the probability of achieving any team split at least as extreme as the observed split. If the split was numerically the same but to differently colored teams, that would be a split as extreme as the observed one. The observed case is numerically the most extreme possible, so we don't need to consider any even-more-extreme cases. The computation I gave gives the p-value. It equals 6/1001.

@Carl Love However, my computatIon will not help you solve your problem. Rather, its purpose is to show that the symbolic solution to your problem would be much too large to be comprehended by the human mind, so maybe you should seek a numeric solution instead. The actual symbolic solution to your problem would be many, many times larger than the solution to the toy problem that I created from your problem.

@asma khan Use a seq command inside the angle brackets, like this:

<seq(x[i], i= 1..N)>

 

@mmcdara You show a potentially useful way of duplicating this variable-in-subscript-is-constant partial derivative notation that I was previously unfamiliar with but which is well established in thermodynamics. However, like Tom, you've missed that this is a problem requiring implicit differentiation.

[The paragraph above only applies to an earlier version of your Reply above which did not give the implicit derivatives.]

My question in the Reply immediately above was rhetorical, and the OP indicated (in a misplaced Reply to the main Question) that they understood how to modify my Answer to get the first implicit partial derivatives instead of the mixed second implicit partial derivatives that I originally coded. Unfortunately, the MaplePrimes timestamps are not precise enough to reveal this logical order. The StackExchange software is so much better than MaplePrimes for a Q&A site--like a hundred times better.

@dharr It is very likely that this "variation of iteration" algorithm could be implemented in Maple, so it's well within the scope of MaplePrimes. The best way to proceed would be to post a link to a reference to the algorithm.

@reza gugheri I will post that, but it'll be several hours before I get to my computer to do it. I'm posting from my phone now.

@reza gugheri You have a system of 4 polynomials that each are degree 3 in the 4 decision variables and have coefficients that are lengthy rational functions. I made a much-simplified version of the system by replacing each rational function coefficient with a small random integer. Maple 2019 can solve this new system in under a minute, but each solution (other than the trivial solution) is about 14 million bytes long, and some coefficients in the solutions are integers with about 9000 digits.

First 273 274 275 276 277 278 279 Last Page 275 of 708