acer

32385 Reputation

29 Badges

19 years, 339 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@PatrickT Please do follow the link in the Comment by pagan. It shares themes with that fast-complex-argument-images Post -- the fastest way to assemble high quality, high density images of mathematical functions in Maple is to act inplace upon hardware datatype rtable with the Compiler.

Other techniques for computing fractal images used in some Application Center uploads (`option hfloat`, or Threads or Grid -- often submitted to use some method that was in vogue) are alone not nearly as fast or efficient.

It may be possible to combine Threads/Task and compiled routines. But since it's not obvious that the Compiler's external-call runtime is thread-safe, it might be necessary to use a Poor Man's Compiler [here & here]. Different techniques are needed for two cases: when the user has already pre-Compiled the mathematical function which must then be used to populate the rtable (eg. for regular plot creation), and when the function and rtable-populating are combined into one single procedure (eg. fractal image creation).

I'd like to finish and submit a posting on the first of those two: fast generation of high density plots/images using a pre-Compiled procedure.

One day this may all be automatic... and people reading these esoteric methods may feel a strange sensation similar to what we can now get re-reading old books on specialized non-digital exposed-film-camera techiques.

None of this relates directly to your projection problem. I asked about curves-vs-surfaces because I was immediately worried about the overlay. I haven't thought of an effective solution to that issue.

acer

@PatrickT Are you asking why that `cast` doesn't work the same whether or not you put it into a call to typeset(), in a plot caption? I think it just needs some tweaking and correcting, to satisfy some pickier and less forgiving parser.

Consider, in a Worksheet in Maple 15 and outside of any typeset() environment for plot captions, etc. With the original `cast` above,

seq(cast(i*Pi/4),i=1..4);

Typesetting:-Typeset('%');

So now let's edit it a bit.

cast:=proc(r)
local n,d,t,top;
  n,d:=numer(r),denom(r);
  if type(n,`*`) then
    top:=cat(`mrow(`,cat(`mn("`,convert(op(1,n),string),`")`),
             seq(cat(`,mn(`,convert(op(t,n),string),`)`),t=2..nops(n)));
  else
    top:=cat(`mrow(`,cat(`mn("`,convert(n,string),`")`));
  end if;
  if d<>1 then
    cat(`#mfrac(`,top,`),`,cat(`mn("`,convert(d,string),`")`),`)`);
  else
    cat(`#`,top,`)`);
  end if;
end proc:

seq(cast(i*Pi/4),i=1..4);

Typesetting:-Typeset('%');

Anyway, you could give it a go.

@PatrickT The help-page for topic `value` appears to already have a help-alias for `ditto`.

In Maple 15 with the Standard GUI, if I enter ?% in a worksheet (or if I search for & in an open Help window) then the Help system opens to the `ditto` help-page, sure. But that Help browser's "search" tab on the left shows two matches. One match is for topic `ditto`, and the other match is for topic `value`. So this aspect is already working.

And only one topic can be the default, which actually gets opened automatically. It's understandable that it's the page of the more commonly used ditto functionality.

Maybe the GUI could learn from Wikipedia here: when an ambiguous query is submitted then a default page is shown, but at the top of that page there is a brief note and link to a disambiguation page for that query. The same could be done with Help aliases: if there is more than one match then a brief line and disambiguation link could be inserted on-the-fly into the displayed help content. Not everyone looks at the search/match results, when there is a page opened automatically in the larger right display pane.

@PatrickT The help-page for topic `value` appears to already have a help-alias for `ditto`.

In Maple 15 with the Standard GUI, if I enter ?% in a worksheet (or if I search for & in an open Help window) then the Help system opens to the `ditto` help-page, sure. But that Help browser's "search" tab on the left shows two matches. One match is for topic `ditto`, and the other match is for topic `value`. So this aspect is already working.

And only one topic can be the default, which actually gets opened automatically. It's understandable that it's the page of the more commonly used ditto functionality.

Maybe the GUI could learn from Wikipedia here: when an ambiguous query is submitted then a default page is shown, but at the top of that page there is a brief note and link to a disambiguation page for that query. The same could be done with Help aliases: if there is more than one match then a brief line and disambiguation link could be inserted on-the-fly into the displayed help content. Not everyone looks at the search/match results, when there is a page opened automatically in the larger right display pane.

@PatrickT ...you wouldn't have to call eta(r,u,a,A,d,r,s). You could call it as either,

  eta(r, u, subs(Parameters1,s));

or, after assigning pars:=subs(Parameters1,s) at the top of your worksheet (using `op` if the expression sequence inside some list/set if needed), just calling it as,

  eta(r, u, pars);

Sorry if it seemed like nit-picking, but the idea was that you might not want to call eval of a proc template each and every time you have actually to call the proc, if it must be done many times.

Joe's suggestion, using globals, also seemed relatively straightforward and simple. I don't know that there's a best way.

@PatrickT ...you wouldn't have to call eta(r,u,a,A,d,r,s). You could call it as either,

  eta(r, u, subs(Parameters1,s));

or, after assigning pars:=subs(Parameters1,s) at the top of your worksheet (using `op` if the expression sequence inside some list/set if needed), just calling it as,

  eta(r, u, pars);

Sorry if it seemed like nit-picking, but the idea was that you might not want to call eval of a proc template each and every time you have actually to call the proc, if it must be done many times.

Joe's suggestion, using globals, also seemed relatively straightforward and simple. I don't know that there's a best way.

The details for doing this might be quite different for a tight-knit group of 3D spacecurves (all varying in solid colors, say) than for a 3D surface. Writing a general purpose routine to do this well would be more work than if it only had to handle one of those two types of 3D plot.

Would it be possible for you to upload a file (plaintext or Worksheet, but not Document, please) in which an example 3D plot with axes showing, at one particular orientation, has been lprinted? Stating the orientation as a side note would also be make it easier.

Do you really need Postscript, or would a high quality gif/bmp be adequate?

Just so there's no misunderstandings: what aspects of the 3D plots are so bad that you are so desperate to avoid them? (It wouldn't be much good, if the flaws were reproduced during the projection!)

acer

@PatrickT I wasn't so much asking about whether you'd installed MSVC++ on your machine, as much as I was asking whether the Maple command Compiler:-Compile is confirmed as functioning in your installed 32bit Maple 15.

That would entail that the examples on the ?Compiler help-page would run properly. Whether that functions, or not, was what I was wondering since you'd mentioned timings for this Maple code running on your Intel i7 on Windows.

The 32bit Maple for Windows returns "IBM INTEL NT" when the command kernelopts('system') is issued in Maple. Typically, the external C compiler that the Maple Compiler:-Compile command uses (internally) for that version is the Watcom compiler that is bundled with Maple part of Maple's own installation process.

I understand, that you have not yet installed 64bit Maple 15 on your Windows 7 and configured it to use the "free" MSVC++ & 64bit SDK for that platform, which is what is needed to get Compiler:-Compile to function in that version. That'll be another topic, for another day, sure.

Now, to answer your questions, as best as I know:

1) No, this technique does not relate to usual plots in any immediate way that I know of. It was just a technique for generating image of 'plots' that involve showing a value for (almost) every location in the field.

If one is only plotting a spacecurve, then it doesn't seem to apply. Except maybe in one way. Some plots don't look smooth enough. Just try plot(sin(x),x=-10..10) for example. One can see that the displayed curve does not look nice and smooth. Raising the number of computed points very high does not help, as that just makes the curve show as being very jagged at a very small grained level. I'm not sure whether this is a problem fixable in the display or export drivers, or whether the adaptive plot data generation or methodology needs adjusting. What I know is that it looks clunky to the naked eye. Now, possibly a "replacement" gif creation utility might be able to produce a smoother curve in an image. But what an effort, to duplicate all that `plot` does! Really, this is so very basic, and important, that it ought to be fixed in the normal plotting mechanisms.

2) Not in any direct way, that I can see. I suppose it could be done, but the code for doing so would have to be new, and wouldn't be a direct application of what I've coded here. Also, I've never studied hard the code that lies behind the usual plottools:-project command.

These are interesting questions (and high quality plotting in general is important) but they don't seem directly related to the application above.

 

Hi Patrick. I understand what you're after, and I'll think about and let you know if I come up with anything.

ps. this post is all about the Classic GUI, only. So, no offense, but it's not related to interactions between two other interfaces (commandline and Standard) in any way that I can think of -- except in the sense that they are all "interfaces".

acer

@Christopher2222 If you are entering it as 2D Math in Maple 12, then yes that error will occur due to an old (and now fixed) parser bug. You could use this line instead,

a := subs('i < 50' = 'i < 30', eval(a))

@Christopher2222 If you are entering it as 2D Math in Maple 12, then yes that error will occur due to an old (and now fixed) parser bug. You could use this line instead,

a := subs('i < 50' = 'i < 30', eval(a))

@PatrickT I'm glad if you found it worthwhile.

Forgive me, please, if I belabor a few points. The speedup of the approach was (to me) an incidental benefit. what I was originally striving for was a way to get very high resolution (high pixel count and fidelity of the image therein) without consuming vast memory resources. Or, in short, to get what might otherwise be unattainable in practice using `plot` and plot-export drivers.

It can be important to carefully watch the MS-Windows Task Manager's report of total memory in use by both Maple kernel and GUI. I have found that 3D plotting and gif export can cause the GUI to consume huge amounts of memory that go unreported by `kernelopts`. And it can be difficult to get the resolution and quality as good by plotting as by these techniques of constructing the image directly.

I believe you'd find that, even if you timings are not quite matching my own as posted, the speed and memory performance to attain comparable quality images would still far outstrip the best possible by plotting and exporting.

I tried to include some examples where the expression was Compile'able, and some which may be evalhf'able or not. That's why some examples are much faster than others.

Out of curiosity, may I ask, is the Compiler package functional and tested on your described 32bit Maple 15? if not, then the posted code should hopefully fall back to the evalhf interpreter.

Be sure to install (some version number, but certainly the 64bit version of) the free MSVC++ for 64bit Windows when you decide to install 64bit Maple 15 on your Windows 7 system. It'll be a PITA to configure, but worth it. (When and if you have problems getting the Maple Compiler package functioning for that installation,be sure to Post to this site.)

@goli Just for interest's sake, here is what you can get for that data.

Note the I used s3[1..-5]  which is all of s3 except the last 4 points. Those 4 points are shown as lying on the ellipse that fits the green (middle, s2) set. So if the full s3 is used to fit an ellipse it would get distorted by those 4 points. I don't know what you code is doing, so I have no idea whether those points are correct.

K1:=Statistics:-Fit(a*(x-x0)^2-b*(x-x0)*(y-y0)+c*(y-y0)^2-1,
                   Matrix(s1), Vector(nops(s1)),[x,y],
                   initialvalues=[a=0,b=0,c=0,x0=0.26,y0=0.0]):

ellK1:=plots:-implicitplot(K1,x=0.21..0.32,y=-0.025..0.02):
#plots:-display(s11,ellK1);

K2:=Statistics:-Fit(a*(x-x0)^2-b*(x-x0)*(y-y0)+c*(y-y0)^2-1,
                   Matrix(s2), Vector(nops(s2)),[x,y],
                   initialvalues=[a=0,b=0,c=0,x0=0.26,y0=0.0]):

ellK2:=plots:-implicitplot(K2,x=0.21..0.32,y=-0.025..0.02):
#plots:-display(s22,ellK2);

K3:=Statistics:-Fit(a*(x-x0)^2-b*(x-x0)*(y-y0)+c*(y-y0)^2-1,
                   Matrix(s3[1..-5]), Vector(nops(s3[1..-5])),[x,y],
                   initialvalues=[a=0,b=0,c=0,x0=0.26,y0=0.0]):

ellK3:=plots:-implicitplot(K3,x=0.21..0.32,y=-0.025..0.02):
#plots:-display(s33,ellK3);

plots:-display(s11,s22,s33,ellK1,ellK2,ellK3);

Anyway, this was just an experiment. Perhaps you really do want three hulls, with s3 being treated in full for that.

@goli Just for interest's sake, here is what you can get for that data.

Note the I used s3[1..-5]  which is all of s3 except the last 4 points. Those 4 points are shown as lying on the ellipse that fits the green (middle, s2) set. So if the full s3 is used to fit an ellipse it would get distorted by those 4 points. I don't know what you code is doing, so I have no idea whether those points are correct.

K1:=Statistics:-Fit(a*(x-x0)^2-b*(x-x0)*(y-y0)+c*(y-y0)^2-1,
                   Matrix(s1), Vector(nops(s1)),[x,y],
                   initialvalues=[a=0,b=0,c=0,x0=0.26,y0=0.0]):

ellK1:=plots:-implicitplot(K1,x=0.21..0.32,y=-0.025..0.02):
#plots:-display(s11,ellK1);

K2:=Statistics:-Fit(a*(x-x0)^2-b*(x-x0)*(y-y0)+c*(y-y0)^2-1,
                   Matrix(s2), Vector(nops(s2)),[x,y],
                   initialvalues=[a=0,b=0,c=0,x0=0.26,y0=0.0]):

ellK2:=plots:-implicitplot(K2,x=0.21..0.32,y=-0.025..0.02):
#plots:-display(s22,ellK2);

K3:=Statistics:-Fit(a*(x-x0)^2-b*(x-x0)*(y-y0)+c*(y-y0)^2-1,
                   Matrix(s3[1..-5]), Vector(nops(s3[1..-5])),[x,y],
                   initialvalues=[a=0,b=0,c=0,x0=0.26,y0=0.0]):

ellK3:=plots:-implicitplot(K3,x=0.21..0.32,y=-0.025..0.02):
#plots:-display(s33,ellK3);

plots:-display(s11,s22,s33,ellK1,ellK2,ellK3);

Anyway, this was just an experiment. Perhaps you really do want three hulls, with s3 being treated in full for that.

@okoolo If you've adjusted interface(rtablesize) as suggested above, then simply entering the Matrix or Vector name and hitting return/enter should print it in full.

An alternative is to right-click on the Matrix output (including the short-form summary that you see if rtablesize is not big enough) and choose the context-menu item "Browse". That should launch a pop-up window with some nice views of the data.

First 426 427 428 429 430 431 432 Last Page 428 of 592