145 Reputation

5 Badges

1 years, 69 days

MaplePrimes Activity

These are replies submitted by Stretto

@Joe Riel 

Thanks, so


P := Iterator:-Permute([a,b,c,d,e]):
for p in P do printf("%{}a\n",p); end do:


is the answer?


for p in Iterator:-Permute(5) do 
    printf("%a\n", [10,J,Q,K,A][[seq(p)]]) 


I couldn't/didn't follow the discussion about efficiency. Is there any difference between the two or not? They essentially seem like the exact same.




see my other post.

@Carl Love see my other post.



all these plots of you guys completely obscure what the surface really is.


The grid lines are projections of a rectangular grid on to the surface and have nothing to do with the intrinsic topology of the surface.

The surfaces are not in opposition as your colors suggest, you colored it to suggest they are. You can color the surface how you please but most will be meaningless mathematically.


None of these posts address my original question about color the grid lines properly and dealing with transparency. They are all just different ways to plot the complex function sqrt(z).


The Riemann surface sqrt(z) is a surface generated by sqrt(z), or sqrt(abs(z))*exp(i*ang(z)/2)

That is, it is a surface that involves a "rotation" of the sqrt(x) in complex space. Hence the reason I drew the gridlines the way they were.


All those grid lines are sqrt(z) functions You can see the obvious parabola, the inverse of sqrt, but every other one also is a "parabola", but they are also related to other functions such as cubics, quartics, etc. (the surface can also be seen to be generated by a parabola)


In the image the "grid lines" are all the same color(the purple/magenta) and I do not want that. I want to color them based on their position and values.


The coloring is somewhat arbitrary here but ultimately I was tryign to color it based on a feature of the curve, rather than "opposition" of the two surfaces. That is, we have color to show another dimension, no need to waste it. Since this is the real part it is nice to use the color to show the imaginary value or the magnitude, or whatever. It's not just about displaying a surface but packing in as much relevant information as possible in a nice way.




1. I do not want the same color for all the lines. I want the colors to depend on the surface in some way(but contrasting to the surface color enough, such as having them darker).

2.  It would be nice if there was some type of visual depth cue...  that is, more distant point are darker and thinnner.


Mable really fails at doing this stuff ;/ I feel like I'm going to have to switch to a program that really excells at graphing both visually and speed wise. (I do use some programming libraries in programming languages but they tend to be more work to do simple plots. I like maple for it's general feature set but plotting quality and interaction and performance are a major drawback for me ;/)


I use matlab sometimes but I just like maples symbolic side...  but any time I get beyond simple plotting I really get discouraged from using it ;/ Is there any way to speed it up and to make the plots better? I could potentially write an external library if I have to if it would not be a huge amount of work and could be done.




mayavi seems to be the absolute best I've seen as far as speed and quality(well, not best but good)

What would be cool is if I could use maple and somehow interface with some library like this(well, what would be better is if maple itself was faster and prettier).




While this works one thing I'm finding is I'm constantly having to add extra parentheses. is there any way to change the precedence?


@Carl Love 


As I said.


1. With an "empty" maple.ini file(Something has to be in it or maple gives an error. I put in with(plots):) maple gives a blank like in a new worksheet without retart: ever being used. I.e., there are no print statements, no other statements. Even if just the statement x := 3: in maple.ini the same thing happens.

2. It doesn't matter about restart: I always put it at the top so I can easily clear stuff if need be but it is ultimately irrelevant to the problem. The problem is that maple is adding an additional line for some reason and I have no clue why. It may not have anything to do with maple.ini but I'd have to delete the file to check, well, I guess I'll try:


Error, unable to read `C:\Docs\Math\maple.ini`


The extra lines produced are the >


That was from deleting maple ini and that is in a new worksheet.

I'd then have to go add the ini file for the settings and see if that would stop it or is producing it somehow.



@Carl Love 


Thanks, maybe I'll start using it. Those caches are what are also called circular buffers. I was using this

global _Hist
_Hist := [N, op(_Hist[1..-2])];


In a similar way. I'll try to start getting in the habit using maple caching.


What you say about option remember, system; Generally how often? Every time memory or numbers change? They change all the time when I do any computation, this may be a bit excessive if it is constantly collecting.


Generally what I'd like is to be able to use a computation and have it optimized for the length of the computation(such as in a plot) and not be garbage collected while the overall computation is going on... unless there are memory issues.

@Mac Dude 


It may very well be due to algebric representation. I never declare float. I also have that issue where it sometimes tries to compute certian things symbolically and craps out(e.g., if I change a variable name and forget to change it in the code then maple will try to compute the universe).

There is the other thread where I talk about plotting using matrixplot and it becomes impossibe after a small number. Also when I use grid.

QQ := Matrix(150,150,(i,j)->evalf(cos(i*j^cos(i)))):
matrixplot(QQ, heights=histogram);

that too 3GB. I had to use evalf for some reason(never had to before but I guess it has to do with the functon).


If I do a few of these types of plots I run out of memory. Mind you though I usually have firefox runing and that takes a few GB because it is a monster hog too. If I end up doing another thing that uses a few gigs I hit the upper limit quite quick. Maple doesn't seem to manage memory all that well. Once I do a lot the memory seems to be in use... even though surely most of the memory is not needed to be consumed.


@Carl Love 


yes, but it happens before any line because it's comming from the maple.ini. So even with a new worksheet in and nothing in it. If I put anything in the maple.ini file it happens. To be clear, I do use restart:

Now, before I started to use maple.ini I don't remember seeing this and so I think it has to do with the maple.ini file. Probably not fixable.

@Carl Love 


Thanks, that worked. I still get a single output line though, and it seems to do it no matter what is in the ini file ;/ That is, if I just put with(plots) in the ini file then I get a blank output line.

@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.






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)];
            q := [op(q), Typesetting:-Typeset(Typesetting:-EV(x))];
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.






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.



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



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.


1 2 3 4 5 6 Page 2 of 6