acer

32490 Reputation

29 Badges

20 years, 9 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by 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.

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

@okoolo The angle-brackets are a shortcut syntax for the Vector and Matrix commands.

By default, only small Vectors and Matrices get printed in full. (For the Standard GUI, the default cutoff is size 10,and for the commandline interface the cutoff is 25.)

You can control this with the interface(rtablesize) setting.

For example, you could put this early on in your worksheet,

interface(rtablesize=100):

FYI, these `interface` setting commands are a little funny, and sometime take getting used to. Their return value (ie. what prints out after you call them) is the old value, even though the new value one specifies gets stored and used.

@okoolo The angle-brackets are a shortcut syntax for the Vector and Matrix commands.

By default, only small Vectors and Matrices get printed in full. (For the Standard GUI, the default cutoff is size 10,and for the commandline interface the cutoff is 25.)

You can control this with the interface(rtablesize) setting.

For example, you could put this early on in your worksheet,

interface(rtablesize=100):

FYI, these `interface` setting commands are a little funny, and sometime take getting used to. Their return value (ie. what prints out after you call them) is the old value, even though the new value one specifies gets stored and used.

@okoolo Are you using an older version of Maple?

If your version predates the (new as of Maple 13) syntax for elementwise operation, then you could replace

ln~(p)

with

map(ln,p)

and so on.

But maybe this is not the problem, since in Maple 12 trying to apply ln~ to a list or Vector normally results in an error message like "Error, missing operator or `;`".

Could you let us know the version. But also upload your Worksheet/Document here, using the green up-arrow on the menu of the editing window? The failure of copy and paste, on your tilde, makes me wonder whether it might be some 2D Math or localization issue, and we'd likely need the poke around the sheet to find out for sure.

@okoolo Are you using an older version of Maple?

If your version predates the (new as of Maple 13) syntax for elementwise operation, then you could replace

ln~(p)

with

map(ln,p)

and so on.

But maybe this is not the problem, since in Maple 12 trying to apply ln~ to a list or Vector normally results in an error message like "Error, missing operator or `;`".

Could you let us know the version. But also upload your Worksheet/Document here, using the green up-arrow on the menu of the editing window? The failure of copy and paste, on your tilde, makes me wonder whether it might be some 2D Math or localization issue, and we'd likely need the poke around the sheet to find out for sure.

First 429 430 431 432 433 434 435 Last Page 431 of 595