Carl Love

Carl Love

28055 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

I changed the title of your Question so that it doesn't look like spam. If my new title misrepresents your intent, feel free to edit it again.

By the way, as far as the input commands are concerned, output is just output; the fact that it's 2D output makes no difference. Indeed, any output can be displayed in 1D form by

lprint(%);

@nhmacuk Sorry, I misunderstood the Question. You mean to expand it algebraically. By "expand 2D output", I thought that you meant that you wanted it to appear wider on the screen by using explicit *s for multiplication signs.

 

@nm Do you put the restart in its own execution group? Sometimes that makes a difference (although I think that that's unlikely in this case). Nonetheless, you should get in the habit of always putting restart in its own execution group, if you're not already.

@nm Whether to ignore or to error is up to the programmer. They can make it error by making $ the last parameter. Most modern library code uses this if it's appropriate; most older library code does not. 

Note that ignoring them can be useful if they're going to be passed on (via _rest) to some other command. I usually do this with procedures that call plotting commands.

@nm Sorry, I misread "does" as "doesn't". My fault.

So what about the memory usage?

The mserver to kill is the one that has a consistent non-zero value in the CPU% column.

@nm I guess that by "it worked" you simply mean that there was no error. It's simply ignoring it, just as if you'd used foo= [boo] as the last argument.

Yes, mserver.exe is the same thing as the kernel.

You say that when you press "interupt the current operation", it doesn't work. (Yes, I've experienced that many times.) So, how are you able the enter a restart command?

While it is hanging, if you go to Windows Task Manager, what is the percentage reported on the column header for memory? In other words, what percent of your total memory is in use?

If the hanging computation is within the kernel (as opposed to being due to the GUI's inability to display complex or lengthy output), then you do not need to close the entire Maple session in order to start a new kernel. All that you need to do is kill the kernel from Windows Task Manager, save the worksheet, and reopen the worksheet (dismissing the dialogs about the dead kernel). I find this to be much faster, and also you lose nothing from your worksheet(s).

@Ali Hassani I amended the example above to include a Grid:-Wait(1) command. This is needed to make the code totally safe. However, it's unlikely to make any difference when there's such trivial code in the preceding Run command.

@vv Sorry, I corrected my definition of "lexicographically earlier". The last clause should be "for all k < n, A(k) = B(k)". Now do you agree that it's total and lexicographic?

You wrote:

  • x[n] seems to be the least positive interger not in { x[1],...,x[n-1] } which satisfies ...

Yes, exactly. 

It is the sequences themselves that are ordered, not the concatentions of the digits of their (finite) initial segments.

@Ali Hassani No worries.

It can be done like this:

restart:
Grid:-Run(0, "a:= 2; Grid:-Send(1, a);");
Grid:-Run(1, "a:= Grid:-Receive(0);");
Grid:-Wait(1);
Grid:-Get(1, a);
                               2

This is just an example to promote your understanding. It's not meant to show a good way of doing this in practice.

@vv The OP is using the following ordering of infinite sequences A and B of positive integers: A is "lexicographically earlier" than B iff there exists an n such that A(n) < B(n) and for all k < n, A(k) = B(k).

@Ali Hassani I am using the term "master node" loosely to refer to the the process with which you are directly interacting (typing into). This node should not be considered to be part of the "grid". The master node is not the same as node 0, which is part of the grid. Unfortunately, if you inquire Grid:-MyNode() before any other Grid computation happens, it'll say 0. Perhaps this should be considered a bug. If you use Grid:-MyNode() from the master node after doing an actual Grid computation, it'll return -1:

restart:
printf("My node is %d.\n", Grid:-MyNode());
Grid:-Run(0, "a:= 2; a;"):
printf("My node is %d.\n", Grid:-MyNode()); 
My node is 0.
My node is -1.


I don't think that it's ever useful to issue a Grid:-Receive command from the master node. When Grid:-Receive(n) is issued from any node, that node waits until a message is sent to it (using Grid:-Send) from node n. So, your Grid:-Receive command from the master node is simply waiting for a message that'll never come.

To send the value of a from node 0 to node 1 (and name it a in node 1), do

restart:
Grid:-Run(0, "a:= 2;");
Grid:-Set(1, 'a' = Grid:-Get(0, a));
Grid:-Get(1, a);
                               2

So, this doesn't use Send or Receive at all.


Please read the help page ?ProgrammingGuide,Chapter15. It is an entire book chapter (in a Maple worksheet) on the packages Threads and Grid.

@mmcdara Since traperror has been deprecated and replaced by try ... catch ... end try (so long ago that I can't recall ever using traperror), I would assume that the errors handled by try are a superset of those handled by traperror, but I'm not 100% sure of that.

As of Maple 2019 (I think), try ... end try can be used inside (1D-input) expressions like traperror can, so I don't see any reason to ever use traperror.

@Ali Hassani You'll get a quicker Answer if you tell me your version. This particular Question is not difficult, but I don't want to waste time posting examples that won't work with your version.

First 173 174 175 176 177 178 179 Last Page 175 of 709