Carl Love

Carl Love

28035 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@Ronan Yes, I used `&D;` because is already used, and `&D;` prettyprints as (i.e,, italicized like a normal variable). Using local D doesn't give you the italics.

You wrote:

  • Before killing a whole Maple session and potentially losing the last state of a worksheet it can pay off to wait and repeatedly interrupt an operation.

There's no need to wait. You can kill individual kernels from Windows Task Manager. This is effectively the same as getting "Kernel connection has been lost", so you still have a chance to save the worksheet, and it has no effect on the rest of your session. To do it, right click on the mserver.exe shown and select "End Task".

@dharr It took me a long time to figure out why you got 4 solutions, while I got 18. You added a[3] and b[3] as variables and removed a[0] and b[0].

@C_R Using printlevel is difficult because you get a huge amount of irrelvent information.

The following command lists all procedures and modules in the library whose names begin with `simplify`. Since you have often asked how to form complicated operators in prefix form, I'm also showing that.

(`&>`, `&<`):= (rcurry, curry):
Simps:= (select&<type&>{procedure, `module`} @ (cat&<`` @ index&>(..-3))~)(
    select(p-> p[..8]="simplify", index~(LibraryTools:-ShowContents(), 1))
);

In Maple 2023, that's 403 procedures and 5 modules. We can trace them all:

trace(%[]):

@C_R 

simplify is not a black box! The trace and showstat commands work fine on it.

@mmcdara I believe that the second parameter of the Normal distribution in Mathematica is sigma, not sigma^2, just as it is in Maple. If this is true, then you need to replace sqrt(var) with var in your definition of Distrib. The original code caused confusion on this point by using var to represent the not the variance but its square root.

Your first plot is an implicit plot, x vs. C. It is a plot of C = -2*x^3 - 4*x with C being the horizontal axis and x the vertical. So, it doesn't make sense to me in this context.

@segfault I guess that the reason that finding help for your prompt issue was difficult is that you'd likely looked for that help on pages ?DifferentialGeometry and ?DGsetup (which are quite natural places to look), but the help isn't there, because changing the prompt is a more-general operation than that package. Using ?prompt (also quite natural) will take you to the help for interface, and then you can scroll through the alphabetical list of interface settings to get to prompt.

Although it is uncommon for a stock Maple package to change the prompt, some users do it on their own for various worksheet documenting or formatting purposes. I often change the prompt to "" (empty string) to get two extra characters of line width for code, believing that the default character styles are sufficient to distinguish among input code (red-brown boldface monospaced Courier), command output (blue Times New Roman with standard mathematical annotation), and expository text (black Times New Roman). Also, even without the prompts, there are thin brackets shown in the left margin that demarcate the execution groups. So, I personally think that having those "" all over the place is unnecessarily cluttered, and if I leave them in it's only for the benefit of less-experienced worksheet readers who may lose their place eye-tracking without them.

Some users change the prompt to "(**) ". Since that is considered a comment in Maple, stray prompts that may get copied & pasted as plain text along with the code will have no ill effect on the execution if they are subsequently copied & pasted back into Maple.

@paolam I'm guessing that you have an older version of Maple that doesn't allow local in arrow procedures and doesn't allow embedded for loops. 

Usually the best way to create a matrix is to provide a procedure which initializes its entries. The arguments of the procedure are the indices (represented by the parameters i and j in this case). (This method can be generalized to arrays with any number of dimensions.)

M:= Matrix(
    (81,24),
#need explicit dimensions for this method; parentheses are optional
    proc(i,j) local k;
        [seq](indice(C[i][1][k], rorder(orders[j], Sets[k])), k= 1..4)
    end proc
);

Procedures can be coded as proc(i,j) ... end proc or simply (i,j)-> ...; however, allowing local in these arrow expressions is a relatively recent innovation. (Arrow expressions are called lambda expressions in the functional programming community.)

The second method constructs your matrix from a list of lists of lists. The dimensions of the matrix are determined by the sizes of the outer two levels of lists, and specifying them is optional. This method is less efficient because it constructs lists that are ultimately not needed, namely the out two levels. For older Maple, it can be replaced by

M:= Matrix(
    (81,24), #optional line
    [seq](
        [seq]([seq](indice(C[i][1][k], rorder(orders[j], Sets[k])), k= 1..4), j= 1..24),
        i= 1..81
    )
);

The seq command is old command (still perfectly fine though) that's equivalent to a simple embedded for loop, which is a recent innovation. Embedded for loops are extremely flexible and just as efficient as seq, often more efficient.

You initially mentioned "table" as well as "matrix". Tables are a different container structure, and the difference between a table and a matrix is probably too subtle to be worth explaining at this point. In the code in your Question, was an unassigned variable when you first used
    M[i][j]:= ...
This caused to be a table of tables; and using instead M[i,j]:= ... would make it a one-level table. 

Finally, it's extremely inefficient to construct a list in a loop like this:
    L:= [op(L), ...]

Every newbie (including myself many years ago) seems to do this though; the idea is quite natural. The inefficiency is due to an idiosyncracy of Maple's lists known as immutability which makes then very efficient when you don't try to modify them after their initial construction. Sets and sequences are also immutable containers subject to the same inefficiency trap if you try to modify them after their initial construction. Matrices, arrays, and tables are mutable, so there's no problem with changing their entries.

You say "As f1 is 2*Pi periodic", but it isn't: f1(-1) <> f1(-1+2*Pi) 3*Pi - 2.

@nm I suspected that that was the problem when I saw the exp(n*ln(x))^2 in your result. And I also was a bit skeptical yesterday after I wrote "suitable for use in an initialization file". I considered editing that statement, but I didn't get around to it because I'm working on a better solution that is suitable. The problem with expandoff, as you've likely figured out, is that it affects internal/invisible uses of expand as well as those that you directly enter.

Your worksheet, with no modifications, gives the correct results in Maple 2023.2. The last two results are mu[1] - q and mu[1]/p.

@nm The problem with this is that the result is not a true matrix in the mathematical sense, although it is a 1x3 (not 3x3) "Matrix" in the Maple sense.

In the future, please put your questions in the Questions area rather than the Posts area.

@nm Please use your Moderator privilege to convert a Post to a Question before Answering it. If you had done this, it would've been a single item for you to convert. Since you didn't do it, that left 3 items for me to convert. So, it would've been substantially less work all around if you had done it.

First 18 19 20 21 22 23 24 Last Page 20 of 709