Robert Israel

6577 Reputation

21 Badges

18 years, 209 days
University of British Columbia
Associate Professor Emeritus
North York, Ontario, Canada

MaplePrimes Activity


These are replies submitted by Robert Israel

Very nice, but it would be even better if Sockets had functions that could do some of this more automatically.  And it doesn't always work for me.  If I try it with, say, http://www.math.ubc.ca/~israel/convhull.jpg, so the first lines are  

 

q := cat("GET /~israel/convhull.jpg HTTP/1.0\n",
             "Host:    www.math.ubc.ca\n\n");
sock := Sockets:-Open("www.math.ubc.ca", 80);

 

I only get about the top half of the image.

 

Very nice, but it would be even better if Sockets had functions that could do some of this more automatically.  And it doesn't always work for me.  If I try it with, say, http://www.math.ubc.ca/~israel/convhull.jpg, so the first lines are  

 

q := cat("GET /~israel/convhull.jpg HTTP/1.0\n",
             "Host:    www.math.ubc.ca\n\n");
sock := Sockets:-Open("www.math.ubc.ca", 80);

 

I only get about the top half of the image.

 

@hirnyk : yes, a Spreadsheet and a table (i.e. an object of Maple's 'table' type) are different things, and a Table as inserted from the Insert menu is something else again. I think the original question was about this last sort of Table. Unfortunately, AFAIK there is no programmatic interface to a Table.  There is a programmatic interface to a Spreadsheet (the package is called Spread, not Spreadsheet, though), which is probably why Will mentioned it.  A Spreadsheet might be a viable alternative to a Table in many applications.

@hirnyk : yes, a Spreadsheet and a table (i.e. an object of Maple's 'table' type) are different things, and a Table as inserted from the Insert menu is something else again. I think the original question was about this last sort of Table. Unfortunately, AFAIK there is no programmatic interface to a Table.  There is a programmatic interface to a Spreadsheet (the package is called Spread, not Spreadsheet, though), which is probably why Will mentioned it.  A Spreadsheet might be a viable alternative to a Table in many applications.

There are many different flavours of entropy.  What you are using is the 0'th order entropy, which is appropriate for the case where each bit is independent of the previous ones.  For a process where the probabilities of the next bit depend on the k previous ones, you might use k'th order entropy.   Of course, for a PRNG, in principle if k is large enough k consecutive bits should be enough to determine the seed and therefore all future bits, and then the k'th order entropy is 0.  A sufficiently clever compression scheme would be able to do this calculation and obtain a compression ratio approaching 0.

@hirnyk : The only reason the values in one case appeared to be different was that you only used 7 digits for the evaluation.  What this does is make roundoff error very severe.  Trying it with 20 digits, I get -3.9024348827827891064*10^8 vs -3.9024348827793256930*10^8, so these are likely to be equal.  The
fact that is returns false is not indicative: it may simply mean that there is a simplification Maple was not able to do.

@hirnyk : The only reason the values in one case appeared to be different was that you only used 7 digits for the evaluation.  What this does is make roundoff error very severe.  Trying it with 20 digits, I get -3.9024348827827891064*10^8 vs -3.9024348827793256930*10^8, so these are likely to be equal.  The
fact that is returns false is not indicative: it may simply mean that there is a simplification Maple was not able to do.

@Al : I don't know how you're getting your

[S1, F1, F2, S2], [F1, S1, F2, S2], [F1, F2, S1, S2], [F1, F2, S2, S1]

What exactly is the rule here?  Are all permutations of F1, F2, S1, S2 allowed?  If so, it's just

permute([F1, F2, S1, S2]);

but there will be 24 possibilities, not 4.

@Al : I don't know how you're getting your

[S1, F1, F2, S2], [F1, S1, F2, S2], [F1, F2, S1, S2], [F1, F2, S2, S1]

What exactly is the rule here?  Are all permutations of F1, F2, S1, S2 allowed?  If so, it's just

permute([F1, F2, S1, S2]);

but there will be 24 possibilities, not 4.

@Joe Riel : the fly-through passes through the wall of the Klein bottle twice, once near the beginning (where the part it goes through is magenta) and once near the end (where the part it goes through is yellow).  You come out where you went in, but heading in the opposite direction.

Actually a somewhat better result is obtained by switching the y and z coordinates, because of the way the "camera" orientation is chosen, avoiding some strange-looking flips.  This version also has you approaching the mouth of the bottle before diving in. With S initially as before:

> S:= [S[1],S[3],S[2]];
P := eval(S, {cos(v)=0, sin(v)=0});
PP:= [piecewise(t<0,0,P[1]),piecewise(t<0,-t^2/4,P[2]),piecewise(t<0,t,P[3])];
   plot3d(S, t = 0 .. Pi, v = 0 .. 2*Pi, scaling = constrained, grid=[150, 30], lightmodel = light3, colour=t,
viewpoint=[path=[PP,t=-2..Pi],look=forward,fieldofview=90], frames=120);

On my system (Windows Vista Home Premium) after right-clicking on the desktop I had to choose "Personalize", then "Window Color and Appearance", then "Open classic appearance properties for more color options", then "Effects...".

My favourite parametrization doesn't use a Heaviside:

> S:= [-2/15*cos(t)*(3*cos(v)+5*sin(t)*cos(v)*cos(t)-30*sin(t)-60*sin(t)*cos(t)^6
 +90*sin(t)*cos(t)^4),
 -1/15*sin(t)*(80*cos(v)*cos(t)^7*sin(t)+48*cos(v)*cos(t)^6
 -80*cos(v)*cos(t)^5*sin(t)-48*cos(v)*cos(t)^4-5*cos(v)*cos(t)^3*sin(t)
 -3*cos(v)*cos(t)^2+5*sin(t)*cos(v)*cos(t)+3*cos(v)-60*sin(t)),
 2/15*sin(v)*(3+5*sin(t)*cos(t))];

plot3d(S, t = 0 .. Pi, v = 0 .. 2*Pi, scaling = constrained, grid=[100, 30], lightmodel = light3, colour=t, orientation = [30,-30]);

And for the flythrough:

> P := eval(S, {cos(v)=0, sin(v)=0});
   plot3d(S, t = 0 .. Pi, v = 0 .. 2*Pi, scaling = constrained, grid=[100, 30], lightmodel = light3, colour=t,viewpoint=[path=[P,t=0..Pi],look=forward,fieldofview=90], frames=100);


   

@Alejandro Jakubi : or, for display in a Classic worksheet, you could try

plots[display](seq(plottools[transform]((v,u) -> [(2-u)*cos(v), (2-u)*sin(v)])
        (plot(1, x=i*Pi/4..(i+1)*Pi/4, filled=true, colour=cyan)),i=0..7), labels=[x,y]);



This works because each region to be filled is star-shaped with respect to its first boundary point.

@Alejandro Jakubi : or, for display in a Classic worksheet, you could try

plots[display](seq(plottools[transform]((v,u) -> [(2-u)*cos(v), (2-u)*sin(v)])
        (plot(1, x=i*Pi/4..(i+1)*Pi/4, filled=true, colour=cyan)),i=0..7), labels=[x,y]);



This works because each region to be filled is star-shaped with respect to its first boundary point.

First 24 25 26 27 28 29 30 Last Page 26 of 187