acer

32353 Reputation

29 Badges

19 years, 331 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

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

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

@goli 

Trying appending the first point as a duplicate, as one way to closeout the hull.

a:=simplex[convexhull](B00,output=[hull]);

plot( [op(a),a[1]] );

@goli 

Trying appending the first point as a duplicate, as one way to closeout the hull.

a:=simplex[convexhull](B00,output=[hull]);

plot( [op(a),a[1]] );

@goli I made two plots. One, named `P1`, is just a point plot (the black points). The other, `ellK`, is the red ellipse.

Then I displayed both together, using the plots:-display command. You don't have to plot them together. They may be displayed separately. Just remove whichever you want, from that plots:-display call.

Also note that `K` is assigned a formula for the ellipse, in case you want that for some reason other than plotting.

I'm not sure why you got an error message about the initial values. Could you say which version number of Maple you are using?  Also helpful might be if you could upload your attemptin a worksheet, so that we may check the syntax, etc, and know that there is no misunderstanding in the code entry.

As far as what I did goes, it isn't as complicated as it looks at first. I took a general (curve) formula for an ellipse, with variables x and y and several parameters (a,b,c,x0,y0). I supplied it to the Statistics:-Fit command, also passing your point data. That routine works by computing values for the parameters which make the curve formula a "good fit" to the point data.

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