Carl Love

Carl Love

28055 Reputation

25 Badges

12 years, 359 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

@oldstudent As far as I can tell, the Replies aren't even indexed by Google.

@Markiyan Hirnyk Kitonum is considering the range 000 to 999, not 1 to 1000, when he makes the statement about the equality of all digits. Now clearly the latter range has the same number of 5s as the former, although the number of 1s and 0s is different.

Could you be more specific?

@tomet Two ideas come to mind. The first is a logarithmic plot. The second is restricting the z-axis. You restrict the z axis with something like

plot3d(..., view= [DEFAULT, DEFAULT, 0..100]);

@Muhammad Ali I need more details about your project with the nested `if` commands. I am sure that it can be done, but it will require some thought.

As for your seq question, just do it as

seq([command1, command2]), i= 1..n);

@Muhammad Ali You can nest them however you want. It only checks the conditions that it needs to check. The following proves it:

P:= proc() print("Here."); true end proc:
`if`(P(), A, `if`(P(), B, C));
                        
                            "Here."
                               A
Note that "Here." is only printed once. The second P() is never evaluated.

Also, you should look into using the andmap and ormap commands, both of which only evaluate the boolean conditions that they need to:

ormap(P, [1,1]);

                            "Here."
                              true

@acer 

Thanks Acer!! This is very useful to me. It is very hard to find the documentation on your usage of an Array as the second argument to COLOR. It is in a footnote titled "Local options" (to the 2D section!!) on the page ?plot,structure . As far as I can see, there is nothing about it at ?plot,color or ?plot,colorfunc . Also, there is no mention of using a two-dimensional Array for HUE. This is much better than my usage of subsop.

I only learned how to do this by taking apart plots with op, carefully analyzing the structure, and reverse engineering them with subsop. So, I was just emulating the plot structure created by the command

plot3d(1, theta= 0..2*Pi, phi= 0..Pi, coords= spherical, color= theta)

which does not use an Array as an argument to COLOR. So perhaps plot3d can be made more efficient by using an Array.

@Markiyan Hirnyk I typed my answer about column 3 twice, but I can't post it for some reason.

@Markiyan Hirnyk 

The data were highly organized: Every degree of longitude and latitude were represented. The data were sorted by latitude (column 1) with each degree of latitude subsorted by longitude (column 2). There were exactly 360 rows for every degree of latitude, and there were 180 groups of 360. Thus, the position on the globe can be deduced from the position within column 3.

The data were in standard latitude/longitude/degree form. They were not in radians or spherical-coordinate form as stated in the original Question. If they were in another form, it would not have made any difference.

@Markiyan Hirnyk 

Okay, I indicated it in the Answer.

@JAnd It will be very easy to put your data into a grid. I just have to decide what to do with the "no data" values. For now I'll just make them equal to the minimal good value. (Thus they will appear red.) I might get to it tonight.

@Markiyan Hirnyk 

Your persistence has exposed a genuine bug in my code. Only the fractional parts of the entries of G are used for the color (hence, an integer G is all red). So G needs to be linearly rescaled to 0..1. I've updated the code in the Answer to reflect this.

@Markiyan Hirnyk The pinching at the poles only occurs for random data. With random data, you have 50 different values along the leftmost and rightmost columns of the matrix where there would only be a few for real data.

And my code is not "adjusted". I adjusted your data. The original code will work fine for actual, continuous data.

@Markiyan Hirnyk 

Thank you for your interest in the problem. The seam is only there for random data. For continuous data, the smoothing algorithm in the plot renderer will not produce a seam. We can simulate continuous data in a random G by making the first and last row of G the same:

with(RandomTools):
G:= Matrix(50, 50, (i,j) -> Generate(float(range= 1.0..2.0)));
G[50,..]:= G[1,..];
subsop(
     [1,2]= COLOR(HUE, ListTools:-Flatten(convert(G, listlist))[]),
     plot3d(
          1, theta = 0 .. 2*Pi, phi = 0 .. Pi,
          grid = [50, 50], coords = spherical,
          color = theta, style = patchnogrid, lightmodel = none,
          axes = frame
     )
);

Plot that and you will see no seam.

@Alejandro Jakubi 

Note that the Greek letter foo is not necessarily typographically the same as the Greek letter `&foo;`. In particular, this is true of epsilon and `ε`. It is possible to use your compose with the alternate version:

De:= compose(Delta, `ε`);

As far as I can tell, the two versions of Delta print the same.

First 537 538 539 540 541 542 543 Last Page 539 of 709