Stretto

255 Reputation

5 Badges

5 years, 261 days

MaplePrimes Activity


These are replies submitted by Stretto

@Carl Love 

 

Thanks. I did look in to memoization but I felt it wouldn't work well since I imagine it would try to remember everything which might cause major problems with memory(I generally already have memory issues with maple even with 16GB).

 

I've never really gotten in to the deeper aspects of maple since I never needed them before(I use it mainly for light work such as plotting graphs and doing basic algebra and calculus)... but since I've gotten in to some number theory stuff I've been using it for a few more things and finding out, like most things, how insufficient the basics can be sometimes... but I get tired of learning new languages ;/ (always saying the same thing differently) There are some strange nuasies of maple that I haven't learned yet that creep in and are not made explicit by the docs and then there are the few obviously things that are clearly just wrong behavior such as the colon issue.

 

Probably the biggest issue I have with maple is precisely due to the memory usage, performance, and crashing. I litterally have to go write code in another language to do the large computations, which they usually handle in seconds while maple crashes or never completes. I'm sure there are ways around this but I feel it is more systemic with maple.

 

 

 

 

@acer 

I went ahead and did this since I'm in constant need of something similar. Maybe someone can take it further:

P := proc()
    local x, lastSpace := "    ", mainColor := black, lastColor := black, i, q := [];
    for i from 1 to _npassed do
        x := _passed[i]:
        if type(x, string) then
            # Parse strings and handle special modifiers (@color, " #n", etc)
            if x[1] = " " and x[2] = "#" then x := cat(" "$parse(x[3..-1])); lastSpace := x: end:
            if numelems(x) = 0 then x := lastSpace; end:
            x := x[1..-1-SearchText("@", StringTools:-Reverse(x))]:
            lastColor := `if`(numelems(x) < numelems(_passed[i]), _passed[i][numelems(x)+2..-1], lastColor);
            if type(parse(lastColor), integer) then lastColor := ColorTools:-GetColorNames(ColorTools:-GetPalette("HTML"))[parse(lastColor)];   end:
            if numelems(x) = 0 then mainColor := lastColor: continue; end:
            q := [op(q), Typesetting:-mn(x, color=lastColor)];
        else
            q := [op(q), Typesetting:-Typeset(Typesetting:-EV(x))];
        end:
    end:
    Typesetting:-mrow(op(q));
end proc:

 

 

It at least gets the bare bones

 

P("test@Red", " #4", [1,3,4], "",a^2);

 

one thing it doesn't seem to do is print a new line, when used in a sequence.

 

seq(P("x@Red",k, "p@15", "y@Green", " - ", 2*k),k=1..10);

 

Normally if we use print in a sequence it prints each element on a new line, I'd like the same capability(e.g., being able to specify "\n"... which doesn't work). (one can wrap a print but there should be a better way)

 

Also, I cannot seem to set the color for

q := [op(q), Typesetting:-Typeset(Typesetting:-EV(x))];

 

 

I've tried adding color=mainColor in various ways but nothing works.

 

There also does not seem to be any good docs on typesetting?

 

Something that I would love to do but probably won't would be to make things align properly.

 

since P can be nested, if the output could be measured then it wouldn't be too difficult to do.

 

 

 

@Christopher2222 

 

That has nothing to do with what I talking about. By suck I mean peformance.

 

Maple struggles to plot even simple things like 50x50 sized matricies or even 3d plots with a grid of 500x500.

 

I can go in to matlab or use something like python or C and usually plot things several orders of magnitude larger without issue.

 

Hence to create a sophisticated IFS in maple would just be counter productive.

@acer 

 

My point was with the simple name is that it almost achieves what I want but it doesn't. Yes, I could just rename the original function and add a default. But that is still to much work for doing something so basic.

With MacDude's answer I was able to get it to work

 

plots:-setoptions(size=[1200,500]);

but there is no equivalent, best I can tell for 3D plots.

I can still use the function though but I'm back where I started with 3D plots.

 

@Carl Love 

 

One of the mainn problems is that maple's "stop execution" doesn't always work. So I have to manually kill the kernel. This then screws up maple. I cannot save like you can because it doesn't do it. It does tell me to save but no method actually ends up saving anything. I can, though, as I learned recently, copy the worksheet(ctrl-c) and then kill maple and restart.

 

None of this is ideal or even close. It's pretty basic software design issues that most programs no longer have since people have learned.

The stop execution is screwed up because if I do something I may have it red(so I can click) and then if I do the same thing soon after(same code) it will be gray.

 

None of these are desirable and I have had these issues ever since I have used maple over two decades. It is better because maple doesn't crash as much but these issues till exist and they are pretty basic to solve.

 

I've also notice that it seems to always seems to prevent canceling in a group of executions.

 

@Kitonum 

 

That may work but really isn't ideal. Lot's of extra code to do something simple.

Can an operator be used to suppress such a statement?

 

_!(A := x)

 

and _! will supress the output but everything else would work?

 

Or maybe

_!(A,x);

 

makes the assignment quietly.

 

I mean, all this is because maple desides to ignore colons inside blocks.

 

 

 

@Carl Love 

 

Changing printlevel does nothign to solve the problem. I need to be able to print out statements in EXACTLY the same why I am able to do it outside of loops. Why it is different is assinine. Why are colons not suppressing statements inside the loop? What is the justification? Why would maplesoft take a perfectly fine syntax that is very simple (: vs ;) and then break it inside of a loop?

 

printlevel:= 1;
(for i from 1 to 3 do
   i+4;
   i*3;
end);

 

@vv Doesn't work

That prints only the last statement. I need all statements printed EXCEPT the once I use a colon on... NO different than what is normally done. Why for loops change that behavior is beyond me. Changing print level does nothing to fix this issue.

 

printlevel:= 1;
(for i from 1 to 3 do
   i+4;
   i*3;
end);

 

@vv 

 

and so I'm left with the same issues...

@Kitonum 

 

And so what happens if I have a hundred statements? I have to write print out every time just to suppress one or two statements?

@Mac Dude 

thanks.

@acer 

 

Thanks, it seemed to be the interface setting.

"Now let's set the typesetting level to extended (its default in Maple 2019). "

 

I never recalled changing that setting... although it is possible I suppose. In any case I set it in the start file so it shouldn't be a problem.

@Carl Love 

You never asked that:

 

Standard Worksheet Interface, Maple 2019.1, Windows 10, May 21

   2019 Build ID 1399874
                               3
                            standard

 

You said "To answer properly, I need to know exactly how the output of the things that you show appears on the screen. The copy-and-paste mangles it. "

 

Again you said "@Stretto You're right, it's no different. To answer properly, I need to see exactly how it displays on your screen. Can you post an executed worksheet? "

 

Not once anywere did you ever mention anything about getting those interface settings. vv was the one that mentioned them and he said nothing about it.

 

You are very confused.

 

You say you said things and then say you didn't say things and maybe that is the problem?

 

I'm going to quote your responses direclty by copying and pasting them here:

 

 

If you put immediately before an operator, it makes it inert. So, you can do a %/ b * c, and it'll display like you want. The inertness will remain inert until you use the value command.

Unfortunately, you do need to use some special syntax to get things to display as you want.

If an appears in the first column of input, it's a shell escape, equivalent to a system command. See ?system.

 

@Stretto Unfortunately, the operators do not have the same precedence as their regular counterparts. I'll admit that this is bad design on Maple's part. So, you need to use parentheses to clarify:

(3^3) %/ 3

This is different from (3^3)(%/3). This latter expression is probably something that you'd never actually want. And I'll explain what it does, if you'd care to know.

To answer properly, I need to know exactly how the output of the things that you show appears on the screen. The copy-and-paste mangles it.

@Stretto You're right, it's no different. To answer properly, I need to see exactly how it displays on your screen. Can you post an executed worksheet?

If you're using the command-line interface, I don't think that it's going to be possible to get the display that you want.

If you want it to simplify to 9, just use the regular operators, not the inert ones.

@Stretto I understand (and did understand) exactly what you want; no further explanation of that is necessary; I don't need to see (nor did I ask to see) a worksheet of your original problematic output; I know that it puts under c. In order to help you properly, I need to see the output of

interface(version); interface(prettyprint); interface(typesetting);

You make it exasperating for us to help you, and exasperating for yourself, by going off on tangents, such as what happens for expressions with exponents.

 

 

You are making no sense. Nothingn follows from your posts. First you tell me that all I have to use is % in front of the operator.. I do that, it doesn't work. Then you tell me that I need to use parenthesis to "clarify" and then quote something I typed in previous exactly that and the output which clearly shows it does not work. Then you tell me you need to see exactly the output of the worksheet and I give you the "exact output"(visually) by copying and pasting it and then using maple primes buit in "maple" math. You then tell me that that you never asked for a worksheet...

 

None of it makes any sense to me. You are making claims that make no sense and say I'm making it harder. My original post is quite clear. You responded with somethign that was quite clear, it didn't work though. I said it didn't work, you said I needed to do something different but I did what you said already and it was in my response. You then say you need to see exactly what I'm doing and things just go from bad to worse.

 

What I'm asking for is not complicated and I'd expect these things to be quite simple... it is apprarently not.

@Carl Love 

 

Thanks, that is quite interesting!

@Carl Love 

 

I simply do not want maple to rewrite part of the expression and it is.  Maple is reordering the operations. They are abstract so there is no computaton involved. The reordering complicates things

In the latex notation I gave expresses exactly what maple is doing and I do not want that because it is visually ugly.

 

a/b*c;
                              a c
                              ---
                               b

 

That is what maple is doing. That is the worksheet. I do not want that! I want:

 

                              a
                              ---*c
                               b

 

I am copying and pasting the output. It of course exapnds it for ASCII but they are the same. The point is not the specific output notation but that it is writing b under c. Since c is a complex expression and b is not, it causes a about 40% of the room that could be used to display c to be used up for absolutely no purpose. Ok. it really doesn't squash anything but it takes up extra room to write that fraction. I could just cut off the a/b part and get what I want but then it woul be missing the leading coefficient of a/b.

This should be very easy for maple to handle, it just has to not rewrite the operations.

a/b*c

I used maple math and typed in a/b*c and the above is the output, and that is how it looks in my maple. I do not want that. Here is using %:

You have entered an invalid Maple expression

 

So if % is working for you then it is probably something on your end that makes it work. It doens't seem to be part of standard maple.

 

a/b`*`c should be interpreted as something like what I want, where the multiplication if not rewriten. Of course this doesn't work. I still want a/b and c to be treated as normal expressions.

Your idea of %* is the same... but that too doesnt' work.

 

The examples I gave with real numbers were just examples.I simply do not want maple to rewrite the multiplication by reordering the division a/b*c = a*c/b = (a*c)/b. They are all the same mathematically and maple displays them all the exact same way, yet there are three 3 ways to display them(in fact, an infinite. We could have a/(b/c), 1/(b/(a/c)), etc).

 

In latex it is the difference between something like

 

\frac{1}{2} \sum k^2

 

and

 

\frac{\sum k^2}{2}

 

The first case is far better because we end up with a very visually unappealing expression in the second. It is not balanced. We have a single 2 underneath the entire sum. It doesn't look good at all, yet that is what maple is doing for no apparent good reason.

 

 

 

 

 

2 3 4 5 6 7 Page 4 of 7