Carl Love

Carl Love

25000 Reputation

25 Badges

10 years, 171 days
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity

These are replies submitted by Carl Love

@panke The plot3d command that you showed is missing multiplication signs and contains \pi, which is nonsense to Maple, although I understand perfectly well what you mean. It's not possible that this worked for you in some previous version of Maple or Windows.

However, of course, if Maple can't understand what you typed, it should just give you an error message instead of crashing. 

@KIRAN SAJJAN As far as I can see (I'm just reading on my phone at the moment, not looking in Maple), your system doesn't have parameters named HaS, etc. So how could those plots be made for your system?

By the way, I am very familiar with those plots because I wrote the worksheet that created them, and I can see in your Question that you're trying to adapt my worksheet.

@nm The OP is getting that strangely unsimplified result from a context menu, Tutors, rather than straightforward command entry.

I haven't looked at this in Maple yet, just speaking off-the-cuff: While sqrt(9) and 9^(1/2) mean the same thing mathematically, they are distinct Maple commands: sqrt(9) invokes the executable code sqrt (I think it's an appliable module) and returns 3, but 9^(1/2) remains unevaluated. This surely has something to do with the OP's problem, but I don't know whether the user can control this directly when using Tutors.

@tomleslie I just wrote a much-longer explanation as a Reply to my Answer above. The quoted help above is true to an extent, but it lacks any nuance. The last highligthed sentence applies across versions, not within a given session. Maple has gone to great lengths to ensure that re-executing code within one version, but possibly on different operating systems, will produce the same results (well, great lengths within the kernel; I can't say about the GUI). Any deviation is a reportable bug.

It's a bit specious for them to say "unordered sequence". As you say, it needs to be put in order at some point. That this happens the instant the set is created is easy to verify with addressofdisassemble, etc., and it's also mentioned in the Programming Guide.

@mmcdara To give all due respect to Tom and his Answer, let me emphasize that he didn't actually say the thing which I said above is "absolutely false". I merely thought some readers might misinterpret what he wrote as implying that false thing. I agree with him 100% that one shouldn't rely on any particular ordering scheme being used. But one should note that 

  1. The ordering scheme is used the instant the set is initially created, thus giving the set an actual storage order (rather than a just somewhat-abstract ordering scheme).
  2. Once 1 happens the order of that set will not change. Executing the identical code in different sessions, even on different operating systems, should produce identical results, unless the ordering scheme changes between Maple versions.
  3. Given 1 & 2, there's no problem with relying on elements staying in the given order. I believe (although I'm not absolutely certain) that this also applies to any subsets of the given set. In other words, I believe that the ordering scheme always produces a total order that subsets inherit.
  4. Maple provides a code-testing tool so that programmers can check whether their code inadvertently has set-order-scheme dependencies. See option --setsort on help page ?maple.
  5. There was a time long ago (say, pre-Maple 8 (not sure exactly)) where the regime I outlined above didn't apply: Set orders were based on physical memory addresses; chaos ruled moving from 1 session to another. Yet, still, in any given session, the order of an established set cannot change, even for address-based ordering. From my understanding of automatic simplification and the simplication table (see Programming Guide appendices), it'd be impossible for it to change, even if one were intentionally trying to create a bug.
  6. Given 1-5 above, it's a bad idea to be thinking about the ordering scheme while programming. Thus, I don't think there's any benefit to considering the answer to your final question about the weird order of the 2nd set, unless one were working at Maplesoft and reprogramming the kernel at its deepest levels.
  7. All the above applies to elements that are immutable, which includes all algebraic expressions, sequences, lists, and sets themselves; tables, rtables, modules (which include objects), and procedures are mutable and thus must be set-ordered by address. (A quick mental scan tells me that that covers all user-accessible data structures, algebraic being a huge category; though perhaps I missed some.)

@tomleslie The sequence of elements which will become a set are ordered (with duplicate removal) immediately before the set is created as part of the "automatic simplification". This is not a "convenience", nor does it happen at display time. It's fundamental to the efficiency with which Maple handles sets. (For example, element lookups can be done with logarithmic-time binary search rather than linear search (which must be used for lists).)

@acer Acer, in order to keep some record of the cause of these problems (and there seems to have been a great number of them in the last few months), I'd like to know whether the worksheet contained Danish characters.

I see that you added some info while I was writing the paragraph above. I see the ae character (whose name is "ash", like the tree). There are a few alphabets with that character.

@dharr The help page that you quote doesn't explain the order of the angles used with the light option.

@Carl Love Here's an efficiency improvement. The index array can be pre-partitioned into block-sized pieces with each subarray Aliased. Again, this works for any number of blocks of any sizes. 

SizedSetParts:= proc(s::{list,set}, B::list(nonnegint))
local SP:= Iterator:-SetPartitionFixedSize(B), J:= output(SP), p:= 0, A, b;
    J:= [for b in B do A:= ArrayTools:-Alias(J, p, [b]); p+= b; A od];
    {in SP do {seq}(s[[seq](b)], b= J) od}
end proc
SizedSetParts({"a", "b", "c", "d", "e", "f"}, [3,3]);
{{{"a", "b", "c"}, {"d", "e", "f"}}, {{"a", "b", "d"}, {"c", "e", "f"}}, 
{{"a", "b", "e"}, {"c", "d", "f"}}, {{"a", "b", "f"}, {"c", "d", "e"}}, 
{{"a", "c", "d"}, {"b", "e", "f"}}, {{"a", "c", "e"}, {"b", "d", "f"}},
{{"a", "c", "f"}, {"b", "d", "e"}}, {{"a", "d", "e"}, {"b", "c", "f"}}, 
{{"a", "d", "f"}, {"b", "c", "e"}}, {{"a", "e", "f"}, {"b", "c", "d"}}}

For the case of partitioning a 15-set into 5 3-subsets, my code above is over 5 times faster than combinat:-setpartition and over 500 times faster than Kitonum's custom procedure (which, to be fair, was written a long time ago).

@lcz Sorry, I switched P to (for blocks) at the last second, but I missed 2 Ps. I will correct. My code does give 10 solutions for the 3,3 case, as can be seen in the output I posted.

I just corrected the posted code.

@zenterix The information that you're asking about is printed by default after each garbage collection. You can turn it off by

interface(printbytes= false);

The first number, "memory used", is the total amount of memory recovered by garbage collection since the beginning of the session (regardless of restart). Since the same physical memory location can be garbage collected many times, this number may be higher than you expect. The second number, "alloc", is the amount of memory currently allocated to the Maple kernel currently being used. This number can go down. The third number, "time", is the CPU time in seconds for the current kernel (regardless of restart). Multiprocessing done with the Grid package uses different kernels, so you won't see the total CPU time for that. Multiprocessing done with the Threads package will show the total for all processors.

Some help for the Command Line Interface (CLI) can be found on these help pages: ?editing, ?edit_history, ?commandline. There are some setttings of the interface command that are particularly (some exclusively) useful for the CLI. See ?interface.

@vs140580 Here is some code that I wrote for fuzzy C-means clustering in any number of dimensions:  Fuzzy_clusters_(2).mw

I think that I've written some for k-means clustering also, but I haven't found it yet.

@zenterix If it couldn't find a package by that name, it would've returned an error message.

The global variable libname tells it where to look for packages. Show the output of


Show the output of


@sand15 When you refer to "KNN" that I've implemented, is that the same as identifying the "clusters" in a set of points?

Please show the output of the command


4 5 6 7 8 9 10 Last Page 6 of 651