Live CEOing Ep 688: Language Design in Wolfram Language [SphericalDistance, LevelMap, and More]

Stephen Wolfram reviews the design of spherical geometry functions for Wolfram Language, including SphericalDistance, coordinate conventions, and visualization on spheres. The team discusses trade-offs like ellipsoid versus sphere models, how to handle complex inputs, and connections to existing Geo and Astro functions.
Chapters
Okay. Hello, everyone. Welcome to another Wolfram language design review, part of our incremental language development series. We seem to have three items for today. First is spherical geometry. I've been waiting for this for a long time. This is the Earth as unit size or something. Let's take a look. All right, so this is the analog of geodistance, but with a unit sphere, presumably, and with angles measured in radians. Is that correct?
Yes, and actually, I think that the measuring angles and radians is a little bit different than using the latitude longitude coordinate system.
It's the traditional co. Latitude longitude system used in spherical computations.
Does that mean that, like, latitude zero is at the North Pole or something?
Exactly.
Yeah.
So it's colatitude.
Right. Makes sense.
Okay, so we have a ref page. Probably the simplest thing is to look at that.
Can I get something other. Oh, yes, wait a minute. Geodesic distance. Oh, we don't want a third argument. Which is the radius.
Well, well, that's one of our questions today. I've gone back and forth on the design, but then for this last presentation version, I've taken the radius out just because I don't think it adds very much.
Are we able to do an ellipsoid or is that too hard and does it require too much other sort of equipment to do an ellipsoid?
I'm sure that we could do that because we do it in other areas of the code. Like it has to be done, I think, for geodistance. But the way that spherical distance is programmed now, it doesn't accept eccentricity or anything like that in any sort of deformation parameters.
Yeah, it's also the case.
Sorry.
It's also the case that there would not be exact formulas for the ellipsoid.
Achilles even with elliptic functions.
I mean, there are. It just wouldn't be.
It's nobody cares type situation.
Probably it's integrations of elliptic functions. So I'm not sure we have close results. Geodistance works with these via.
Oh, that's really nice that this will work for higher dimensional spheres. That's really nice. Yeah.
Well, then. So that's another problem with the potential problem if we wanted to do ellipsoids, is that.
Yeah, yeah, yeah. Forget it. Forget it. It's way too complicated. I think it's much more interesting. Okay, so this. Oh, why isn't it assuming that these are real?
Well, yeah, that's. The other question is do. The other big question we have is if we want to do complex values or if we should Just be restricted as to real only.
Oh, splatteroo. Here, I opened this in the prototype build. Great.
What happened?
It crashed.
That looked like a front end thing, though.
Yeah, yeah, there's nothing but.
Sorry.
So it's a question of whether you could have, for example, complex radii for.
No complex radius is always one. Then the question's about complex angles.
I don't think we care about complex angles. I think we're going to have a separate hyperbolic story. I mean, what do complex angles mean?
We don't know. And Jose and I have been looking a little bit.
I mean, let's just not worry about that, I think.
Okay, great.
I think it's much better to have formulas that look reasonable and don't. Aren't full of crude than it is to support the complex case where, you know, I just don't think that's an important case. I've never heard of complex angles for this.
So we seem to support them in rotation metrics and of course we do have complexes in things like vector angle, things like that.
So. Yeah, I understand, but I think. I don't know why we support them in rotation matrix. I mean, Lorentz transformation. Somebody might have thought that's what Lorentz transformations are. But they're not, right?
No, it's not. We have looked at the code and it's not.
I mean, just to give a sense of this, let's say. How do we do this? We say assuming. What do we do here? Assuming a B element reals.
You can do simplify, right?
You need to simplify there.
Can we just do this?
No, I think you need to add the element.
Okay, I don't think we need to even discuss this. I mean, this is just like a. And I don't even understand. Okay, this is right. Because it has to do the wraparound, Right? Right. Yep. But I mean, the other one is just silly. You know, maybe we could have an assumptions argument for spherical distance if we really care. But I think we don't care. I think we should just assume they're real.
Okay. And we error out if we find complexes.
Do what? Sorry?
If we feed complex numbers, we are out.
I think so.
And what, what's the order of the angles? I mean, is it consistent with. With. Is it consistently consistent with hyperspherical or is it.
It's what coordinate chart data does, except for removing the first argument, which is the. The first element, which is the radius.
Right, but so it's doing. So it's in three dimensions. Is it consistent with spherical or with Hyperspherical.
Are those consistent?
No, because they're oriented differently. Right. One, the spherical is a. Is a special case because.
Right.
It's oriented in Z. Maybe it doesn't matter if you're, if you're intrinsic.
I'm not understanding this. This is a question of what if you're going from point A to point B, Is that what you're talking about?
So there was a convention here about whether you put first all the theta angles and then a phi or all the phi angles and then theta and things of that.
Oh, oh, okay, okay, okay, okay, okay. You're talking about. Okay, I understand what you're saying. You're saying in the right. Is it theta phi, which it would normally be for the, you know, that's co longitude, co latitude or something. Is that right?
It's that sort of thing. I cannot precisely state it right now, but Itay and I were quite careful about this in coordinate chart data. We should check against it.
But, Brad, do you know.
Yeah, I'm pretty sure we have checked against it. We can check again. But I wasn't aware of what ITAI was saying that maybe if we check coordinate chart data for spherical and hyperspherical with, you know, three dimensions, that they're not the same.
Well, certainly the embedding is not the same. Maybe the order of the coordinates is the same.
Yeah, so it's a detail. We can, we can figure it.
By the way, documentation wise, why is it the case? I mean, it would seem great to me if we did one of these things where we had a list of, you know, a guide page of the burst coordinate charts and then separate documentation for each coordinate, you know, for each coordinate system. Does that make sense?
Yeah, I think, like stuff is getting crammed in the details here. Is that what you're trying to say?
Yeah, that's what I'm trying to say. I'm trying to say I think it would be great if there was a page specifically about oblates varietal coordinates.
Okay, well, I don't know how to create such a page.
I, I know that, I know that. But I mean, look at, for example, I don't know, something like import. Okay. It has that listing of formats, goes to this, then it goes to a special case page type. And that's a Brian story to create those.
Okay, I like that very much. We could reuse it for projections and for frames in Astro. It's all the same type of idea.
Yes, let's do it. I think it'll be much, much clearer. Okay, so. Because Otherwise this is really hard to extract. What the hell? I don't even know how to answer the question that you were asking about what the coordinates are. I don't know where is this even spherical? The order radius, polar angle as a muthanel angle. Okay. And hyperspherical poles along the x1 axis. I don't really understand this. That's why we need a longer documentation page.
Okay.
Well, what is the coordinate chart data output if you call to it?
Okay, let's find out. So you're saying coordinate chart data of spherical, for example.
Well, you'd need to give it. You'd need to give it a property.
Like what property do you want coordinates. Is that.
Is that a property? Yeah, that's probably.
Coordinate range assumptions would be. No, that's not very useful. I mean, we like. What are the names of the.
It's.
It's standard coordinate names.
I see. Okay. Boy, this would do better on a separate page. Okay, that's R, theta, phi, hyperspherical or what are.
What are the scale factors are also probably pretty good to look at. And you may need to give it.
Yeah, for hyperspherical you need to tell it what dimension. Right. So you need list three.
Okay. But now let's do four.
Yeah. So psi is probably another angle like the theta.
Right? Yeah. Okay. Right. So.
Right.
It's really only the embedding into R3. And since we're doing intrinsic geometry, it doesn't matter. I was momentarily confused. I mean, this was a useful little detour, but I was most.
Could you explain that eti, just so I understand what you're talking about.
So I mean, the theta in spherical coordinates is the angle from the Z axis.
Right.
Hyperspherical, it's the angle from the X axis.
Yeah, whatever that means. It doesn't really matter because.
Yeah, because.
Well, it matters. It matters if you're doing coordinate transform data between hyperspherical and.
Right, but these are intrinsic coordinates in theta phi in. Exactly. And so it doesn't matter. Right. Were you to convert. Were you to take these coordinates. Were you to take those points and deduce them from Cartesian coordinates, it's still not going to matter. Yeah, it's just gonna. Okay. Anybody.
Distance is invariant under rotation.
Yes. Okay, nice. Is this nice and fast?
It's pretty fast.
Yeah.
I mean, it's not compiled, but it's. I think it. It's about as fast as it can be without being compiled. And then the array or the matrix usage has. Threat is threaded and it uses its own code so that's also even faster.
Okay, cool. All right, so just so I understand, I'm just sort of curious here. So if I say like spherical distance and I go from the North Pole, so I say table 0n here and I go to the. What would I have to do? I would go to table PI over 2n. Is that right? Is that obvious?
You're doing different hyperspheres, right?
Yeah, I'm doing different hyperspheres. And I'm asking a question, right?
What's the difference? Yeah. What's the distance to the equator from the poles?
Is it to the equator or is it some point on the equator? It's just to the. Let's see, if I just say. Well, the.
Every point on the equator is probably equidistant to the poles.
Yeah, it's probably true.
But.
Right.
But the equator might actually be an n minus one sphere or something like that. It'll be weird. If you have two sphere, the equator is a one sphere. If you have a three sphere. I don't know. I guess the equator is a two sphere, maybe.
Yeah, right.
Always you're just setting one coordinate to zero.
Yeah. And this is probably obvious that this has to be the.
If. If you look at the scale factors, maybe, but I don't know if we're.
Going to do that.
What, like, go to coordinate chart data and change standard coordinate names to scale factors and see what it says.
Do we have a function for like. Like random spherical position? Like random geoposition?
We don't yet. The plan was to support geoposition inputs here too, interpreting them as being on the unit sphere.
I see. So you would. You could run random geoposition, which already probably uses effectively a sphere, and then just feed those directly into this.
Or I could say random point. What about this? If I say random point. Oh, the problem is it'll be a different coordinate system. Right.
This would return 3D.
Well, we can't use the. We have existing functions about the polar coordinates. No, I think we have like two spherical coordinates, don't we?
Yes. And from spherical. So here we see the problem that we need to remove the radius.
Right.
You want rest of two spherical coordinates.
Yeah, it's got the longitudinal.
Integer argument to sphere to specify the dimension under random point.
What do you mean? The dimension?
So if you did sphere of four.
For example, I think you have to do sphere of 0,000. Oh, never mind, Never mind.
You need this. You need to use the.
You need the two polar coordinates. So because.
Okay, cool. Now.
And the reason for that is precisely because of this embedding issue because spherical is the odd man out.
Yes, I get it. Okay, so fine. So there's some examples here that could be given on the spherical distance page, for what it's worth. In the. In probably some. Somewhere down in the. In the. Boy, there's a lot of interesting things.
Here and I assume, Let me see. Right. It wouldn't be possible to interpret these spherical coordinates with a radius as spherical coordinates because you can't tell whether the first number is a radius or a. Yeah, well, yeah.
And then the other issue if, let's say we're going to change the input format to just accept the vectors is like, what if somebody goes in there and puts in one point with one radius and another point with a different radius than what?
Yeah, it's hopeless. Hopeless. I agree. I don't think it's useful. Okay, let's keep going. Yeah, I think we answered these. So by the way, I assume we're going to eventually have spherical list plot and all the various. I mean, it will be. Well, actually more relevant here is something we don't have for the GEO case, which is spherical plot. Right. Taking a function and plotting it on a sphere. Am I making sense?
What's that, 3D visualization in geo.
Yes. Yeah, 3D visualization on a sphere. Because I think that is a function on a sphere. Right. It shows up all over the place for all sorts of applications where it's just a function. And there's also plotting data on a sphere. I mean, basically spherical density plot, spherical list plot, all these things are reasonable things to ask for. And then with various projections.
Well, there's kind of two things, right. I mean, there's like in the geographics case, there's several function repository entries for basically geographics 3D quotes where it's not really about plotting data, it's just about generic, you know, graphics primitives. Right. Or geographics primitives. I mean, you could imagine a spherical graphics or spherical plot. No, spherical graphics, 3D or something like that which would, you know, you could have primitives in it where you give, you know, point of such and such and it would show up on the sphere separately. There's the, you know, a bunch of visualization stuff.
Yeah, the one thing I've done with this next spherical triangles thing, which the spherical triangles is probably a pretty good place to start with depiction. Even following what Christopher said is I did use the region functionality to do depiction, a quick depiction function for spherical triangles.
But.
So this is. This here is a whole separate idea that's related to some other functions that we have about solving the data of plane triangles. And this is just a generalization of that to the sphere or adaptation of that to the sphere, where if you, you have a list of sides and you have a list of angles and that list has some values filled in and the other values are left null. And if you have enough data that this, that the triangle is exactly determined, it will try to find, populate the rest of the data. And there's so some sometimes.
Which function is this in the. For plane triangles? What function is this?
Well, there's a whole range of them.
I think triangle, etc.
So this, there are a bunch of separate case functions hidden in the source code for this. But I just made this one. Spherical triangles thing accepts a general template and figures out how to solve it.
But so you've taken a different design approach from, I mean in the case of plain triangles we just have explicitly SAS triangle, etc.
Yeah. And I don't know if we want to keep this design approach or hide it, but for now it works and it has a lot of flexibility. It does whatever case.
Well, I think it's interesting. It's a design idea we didn't have for ordinary triangles. I think.
There are two important differences. One is that this is focused on the primitives. And the second thing is that the plane case we are looking at, we detected, it doesn't consider all cases. And the spherical case is even more complicated because it has ambiguity sometimes. So it returns a list of two possibilities.
Yeah, well, actually, actually the plain case, the A, the aas. I think plain case can return multiple results, acute and obtuse. But that, that one was never. Or maybe it's side, side angle because there's one that's missing from. There's one plane case that seems to be missing. So can we try side side angle and see if that one is in there? SSA triangle.
No.
So I think that one is missing and I, My, my understanding is that it's missing because it doesn't fit this pattern of one set of inputs. Result, returning one result.
Well, you could ask Michael, I mean, or somebody who's.
It's a standard non postulate ssa. It's not, it's not unique. You get two in general.
Right. So I think that's true on a sphere as well sometimes. Yeah, but so if, then the design choice was. Well, okay, because we can return two results instead of always returning one that we shouldn't, we shouldn't have that.
Well, I, I think it's Perfectly reasonable to have. I mean, this is like functions of the branch cuts. You know, it's like.
I'm not sure that there's a standard, you know, of the two possible results.
Well, I mean, in the plain case, there surely is the acute triangle.
Well, why is the acute one better than the obtuse one?
I don't know, but I mean, that's an obvious thing to return. But my question is, you know, there's no good unless you can get the other one. And maybe you can get the other one by side, side angle. You know, a convention like with branch cuts that says if that angle is greater than whatever, then it's the, you know, in the interior, it's always the interior angle or something. I don't know how you do it, but. But in order to, you know, to be able to get the other case by, by changing that angle.
Yeah. From my basic experiments, me not being an expert in this field and just sort of getting into it now, it's a little bit. There are things that I've read, conditions stated, but in practice, it looks a little bit unpredictable to me. So the way that it's working right now is a little bit unsophisticated, but we could potentially put more time into working on the preconditions.
Hold on, let's. Let's start thinking about these things. So given one of these triangles, how do I find the area of the triangle? I mean, so if, if I've got an SSS triangle here, let's say I've got this and I go, you know, so here, I mean, is there a.
Meaning you could try to do region measure, since we calculated those. Oh, yeah. Or you could try. Does area work on regions?
Yes.
So you could try to do area there. But there's also, I think, a very simple formula for area, which just has to do with adding up the angles. So if your output is side, side, side, angle, angle, angle, you could easily get the area just.
Well, I know, but we want a function that does it, you know, that is the, you know, we want the, you know, all the stuff like the angle deficit, all these kinds of things.
Yeah, that's, that's definitely the next direction for this particular part of the functionality. But, you know, we just did this all without much design input from anybody else.
Okay.
All right, so let's, let's step back for a second. Okay. The next, you know, spherical triangles, clearly important. Okay. But let's try to understand. I mean, clearly plotting a function on the sphere is obviously important. Are there WFRs that do that yet. Anybody know?
Well, there are certainly geo ones, but that's all different.
And my, my go to is parametric plot. I think first plotting things on the sphere. Parametric plot usually.
Okay, but, but so the things we're going to need.
There'S like a stereographic projection which is similar.
Okay, but I mean, look to me we'll want something that says just called spherical plot. That's just a function F of theta phi. Oops. I mean we currently have the function. Actually we have a spherical plot 3D, don't we? Yes, we do. So what this does is.
Oh, it depicts R.
Whoops. Oh, it needs theta and phi separately. Okay.
Well, but that is R. That's. That's the picking rs.
I know. That's, that's. That's computing R. So what we want.
Is more like spherical density plot.
Yes.
Like, like how would we make a. Those pictures of spherical harmonics or whatever.
Exactly. Is it spherical density plots or is it. What's this? Wait a minute. Oh, this came from email. This didn't come from the. Oh, Avery, is this, is this in.
Yeah, it's in your Dropbox.
We should have picked it up from there.
You can just overwrite that one.
No, I'm going to, I'm going to go and pick it up from the other place. Okay. Okay, so just looking at the spherical. Okay, so we'll want something that has, you know, that in the end is like plotting a function. Just like geolist plot. Plots points. I mean, we'll want presumably spherical list plot, if I'm not mistaken. Right. Which will take a list of points, a list of theta phi pairs and plot those points on the surface of a sphere. So for example, if we say just to give an example, let's, let's say sphere points. You know what? Okay, so here I might say graphics 3D of point of that. Okay, but now I want to be able to plot that with the projection. How would I do that? I mean, I think we're going to want something where we can plot a function. Okay. To plot. Okay, how do I make. Okay, there's several different things I want to do. Okay. You know, plot a function or points on the sphere using a projection. Plot them on a 3D sphere. Does that make sense?
What do you mean by using a projection, projecting on the sphere or projecting.
On the plane like a geoprojection.
Yeah. Right.
So I mean in, in for example, in this case here, presumably I could do this in a somewhat bizarre way. So these sphere points, if I say two polar Coordinates. No, two spherical coordinates. Right. Of those and I say rest slash at that. And then I say how do I make those into geo positions? How do I make those into geo. What's it? I multiply by something. I divide by degrees, I think.
Yes.
Well, it's also collatitude. And isn't it?
Well, it doesn't really matter in this case. So let's say geolistplot. Of point. No, geo. No, no, just geolist plot of those values.
Maybe you need your position.
I'm not sure we will need a reverse because your position is going to come. It's going to be latitudes of 150. So.
Okay, so it's the reverse of that exact. No, it's still.
It's reverse.
Maybe it's because it's co latitude and it's.
Do you need geoposition around each one of the points?
No, no, but.
But you see, we have 153 as first element.
That.
That cannot be. That cannot be a latitude. So we need. We need to. Oh, we have a 137 in the second. No, something one.
No, I think it's because it's a. It's because it's the co latitude, isn't it? So 0 to 180 instead of minus 90 to 90.
Yes.
So what do we do? We subtract.
Add 90 to it or something? Or subtract 90. Sorry. Yeah.
But why doesn't this wrap around.
Latitudes cannot wrap around longitudinal.
What do I do? I say. I say of this. I say plus threaded.
Exactly. I think it's threaded of zero. Threaded of 90. Zero minus that array.
90. Zero minus the array.
Yes.
There you go. Okay, that's actually pretty cool. I mean the fact that it has the earth on it is kind of stupid, but. But that's what we're looking for, right? Given those points, given the.
Presumably that whole transformation, you know, should be, you know, there should be some simpler way to do it.
Yeah, we don't need it because if we've got actual spherical coordinates, we're not going to be messing around with geo anything.
No, no, but it seems fun to be able to convert between the geo, you know, representation and the spherical representation. And as we can see, it's a little bit fiddly.
Yes, that's true.
Yeah, I kind of agree with Christopher on that one. But for this plot here, I mean, the bigger question for me is, okay, what are we going to do when we start linking the points together? Do we want them linked geodesically?
Yeah, it's spherical path just like we have geopath.
Okay.
Now the difference of design here is that we don't have the notion of a spherical point. We just have naked coordinates.
Yeah. Is that. I think that's fine. Why not?
It probably is fine. I mean, I think what we have to. That means that when we represent a geopath. So I'm saying that then we got to have a specific thing called spherical path. Because we don't have that concept if we have line. Unless we decide that line on a sphere means the geodesic, that might be possible. What do other people think about that? I mean, line here would not mean that. So if I said here, I think that's too inconsistent.
The fact that line means one thing.
And, and what happens if I say, if I say line? Can I say line here or do I have to say.
I think you need geographics.
No, actually that one.
Yeah. So already in geo we interpret differently lines of geopositions and geopath of geopositions. Lines are always made of straight segments.
Where straight is defined how.
Yeah, in the projections you are working.
Okay, that's pretty amusing picture actually. So that. So that's geodesics between every point.
Exactly.
Nice. Okay, so I mean this is clearly a thing we're going to need. Now the other thing we're going to need, which we don't have, you said we do have it in a WFR for do case, is the function on the sphere.
Well, spherical plot. 3D is almost that in the sense that if you add a radius to your function, then you are already representing deviations with respect to that radius.
I understand. So if you say for example for this thing here. But that's a different way of plotting it because I think what I'm looking for is something where it's a 2D projection of the 3D. Like you know, the plots you always see of the cosmic microwave background.
I see, so you are still thinking about 2D plots. Yes. So the thing there is, what we don't have are the concept of functions on the sphere, like the equivalent of interpolating function on the sphere and things like that.
Wow, this is a mess. Let's say I go 30 or something here. Yeah. Then I mean, that's not very useful. But that and I probably add a color function or something. Okay, but so yes, so that's what I'm saying. I'm saying what if you give an analytical function. Okay, there are two points you're making. We don't have interpolation on the sphere, which is a big deal around the poles and Things like that. But if I just gave you a function, for example spherical harmonic, I should be able to plot that spherical harmonic on the sphere, a 2D projection of that.
But as a radius function or as a color function.
Well, I mean here as a color function because it's like a density plot. So I should be able to plot whatever the spherical harmonic is. I mean, if I say spherical. Look, let's do this. If I say spherical harmonic Y of, I don't know, 5 2, how does it work? Is it 52 like that or is it 5 2? Anybody know lm Theta Phi? Okay, so it's this thing here. Okay, so what I'm looking for here is we're evaluating this for many values of theta and phi. What? What?
I just put something from Michael in the chat there that might be helpful.
Yes, that's very helpful. Right, so what we're looking for is. Well, we probably want this case as well. We're actually showing it on a sphere in 3D. Right. But we also want this case where it's been flattened out to a projection. Am I making sense? Yep. But, but the, the source for this is just like density plot. I mean we're going to want both the list case and the.
In geo we already have the least case, which we call unfortunately GEO density plot, not GEO list density plot.
I've thought we should change that name and maybe there's a way to do that compatibly.
I think the basis here was that in the majority of cases the real data is data, not functions.
How does this dovetail with spatial statistics stuff?
They have their own representation functions. They have a powerful point value plot I think it's called.
Yes, I think we need to worry about that and I think we need to consider, you know, we could compatibly change this because geodensity plot, if it's given a function right, it's given this, it could produce the right resultant. Complain and give a message to get what I'm saying.
Yes, I think this is a discussion that would need bread.
Fine, but my suggestion is that we plan to change this to geolis density plot and make geodensity plots. Going forwards primarily be a function based thing. But you know, spherical density plot is surely the thing that we need. Look, but what I would assume we need a spherical density plot which is the projection version and then spherical density plot 3D, which is the version with an actual sphere. That makes sense. And then. We're presumably going to need spherical list plot. And we might as well have spherical list plot 3D. But the thing that that's not dealing with, Boy, is the case of primitives on the sphere. Right. Which would be something more like spherical graphics and spherical graphics 3D. And that would be okay, except for the fact that, for example, a triangle, which we have as a perfectly meaningful thing in, you know, look, I don't know. I mean, I'm kind of thinking that we might need functions like spherical path and spherical triangle or spherical polygon or something.
Functions or like containers, Wrappers.
Containers.
Well, yeah, I think we will have to. Unless we're willing to double use the containers that we already have. But it sounds like.
Which containers? Which ones?
Other than polygon, polygon line. But it sounded like people didn't like that idea.
Look, if we had these, it also allows us the possibility of saying for spherical polygon, we can just say area of spherical polygon, which would be kind of nice.
Yeah. Yep.
And then if we have that spherical polygon wrapper, why doesn't that subsume the spherical triangle stuff? Oh, I see. Because you have an angle specification there, right?
The specification is quite different.
Yeah. So the way the flow would work for calculating areas like let's say that you have a spherical polygon and inside there's a list of angular points. Well, maybe you find the centroid, break it down into spherical triangles, get used.
No, I understand, I understand the algorithm, but the question is spherical polygon would literally take theta phi values for the points around the polygon, right?
Yep, I think so, yeah.
Is it unique? Given the theta phi values, does that define. I guess we have to define. Just like we have to define a bow tie handling rule in 2D. Right. We'll have to define the analog of a bow tie handling rule. For spherical polygons, it's slightly more complicated.
To decide whether it's the inside or the outside.
Right. So if you leave the points of the equator, which side do you mean?
Right.
So that's why geopolygon, for example, takes an interior point or an exterior point.
Or as a second argument or something.
Yes. Or a left rule or right rule.
It has. We're going to have to copy that. That behavior, basically.
Yeah.
Right. So we could just copy that exact behavior.
But does it. Does it assume that the, you know, can't it assume the polygon you're talking about has minimal area?
Yeah, that's the smaller area case.
Exactly. There are multiple ways of specifying it and it will deduce one from the others.
Okay. And this now already has these things which are also very sensible, isn't that right? I mean that, that defines.
Well, on the sphere they are all the same basically on the ellipsoid geodesics and great circles are different. Ramp lines are still different. Yes.
Yeah. Okay, so it looks like we needed a spherical polygon that is the analog of geopolygon. What other primitives do we have for geo? Oh gosh, we have geodisc as well.
Yes.
And we're going to need all these. I don't see how we're going to get away with these.
Well, and remember that we also have this Astro family. So if there was a way in which we could at least merge. Right now we have the regions family, Geo, Astro and now potentially spherical too.
I don't think we should merge them. I think it's going to be too confusing.
And perhaps in Astro, I mean it's rare that you use primitives in Astro, but just for the moment. And perhaps you can reuse the spherical ones.
Yes, I think we could. Right. Because people imagine, you know, there's a concept of spherical astronomy and things like that. Whatever.
Exactly. Yep.
Really is a sphere. There's no, there's no. Despite the universe, maybe not expand. Well, it does expand more or less in the same. In all directions. So it is, you know, it's a sphere all the way down. So I agree. I think reusing the spherical ones for astro makes sense because. You know, for example, for the cosmic microwave background, which by the way might be another. I mean, at some point, just as we have those backgrounds like the galactic background, we could have the, you know, cosmic microwave temperature profile as a background in Astro.
Indeed we are looking for those images. It's just that it's difficult to find them with. With good enough precision. But we want them in every wavelength, X rays and things like that.
Right. But I mean, the reason that's interesting is, you know, what is it? We're back to 130 million years after the Big Bang. Oh, galaxy. There's a galaxy, known galaxy that had formed by that time. So at that point it becomes quite interesting to plot those galaxies against the temperature variations in the cosmic microwave background. No, it's kind of silly. If you're doing a current star in our galaxy, plotting it against the temperature fluctuations and the CMB is kind of silly. Yeah, but it isn't by the time it's that far back.
But. But I was also thinking recently it'd be awesome if we could do the parameter extraction in like a one liner.
I.
It's probably not possible, but maybe parameter extraction. Well, you know, taking the, the Power spectrum of the CMB and trying to get the edge of the universe out.
I don't see that. The power spectrum doesn't give you that. The power. No power spectrum just tells you fluctuations.
Okay, maybe I'm confused about something.
I mean, we do have a standard universe thing, which gives you all the stuff about the redshift versus this. Like for example, I'm sure that if we say standard universe. Actually, I'm now curious because I was sort of surprised. The thing I was reading. Does this work? Oh, cool. Asaurus. That was what I was wondering. I mean, the thing I read was talking about 130 million years after the Big Bang and it didn't give the freaking redshift. Well, there we have it. Nice. That is not the most beautiful graphic. And by the way, I bet that's wrong now. And somebody should point that out to Jeff. Make sense, Jose Avery, maybe somebody. I think that data has changed.
Yeah, we'll talk to him.
But this is very nice that it just generates this. Okay. Any case that's irrelevant to us right now. Okay, so if we do this, the one functionality we're missing, which is what you've already put in, Brad, is a triangle deducing a triangle from angles. Right. This is a triangle from its edge, from its corner coordinates. Right.
Okay.
Right. So that, that's not the same as like SSS triangle, which by the way, is a disembodied triangle. Not saying where it is on this, on the, you know, on the plane.
Yes. But if you look at the example there, it project. It projects it to a particular orientation.
And the depiction, it's. It's picking a particular place to put the triangle that starts at the origin.
Yep. So. So this return format is actually different than the return format for my spherical triangles thing because it's like immediately depictable. I think all you have to do is hit that with graphics and it becomes.
Right. Which it seems to me. Okay, so hold on, hold on. Let's just look at this.
We could have some sort of spherical triangle solve with properties. Some properties would be give me the triangle back as a graphics primitive.
Yeah. I mean, it'd be nice to have it somewhat consistent with the planar case. Okay. When you have a spherical triangle, I mean, the thing I'm most used to is things like the area deficit of a spherical triangle, blah, blah, blah. I mean, by the way, I mean, we would have the slightly peculiar spherical disk here. Unless we call it spherical cap. Right. Same as we would. You know, we have a spherical disk with a theta Phi center and a radius. Right. Does that make sense to people?
Yeah, it would have the third argument as disk with the beginning and final asimis, so that we can consider sectors too.
Yes, yes, yes, yes, yes. Right. Just like presumably geodesk does.
Yes, indeed.
Now I mean, we presumably need a spherical area as well, because the area, if I'm not mistaken, area in the geocase, Am I confused here? Area is the slicing through the earth area. Is that true?
No, it's area on the surface.
But what's geo area?
Sorry, no. Geo area is. This is the area on the surface. And area on a geodisc calls geo area.
So if I say area of geodisc of geodisc, let's say, you know, New York 100 miles, for example, Why isn't that a correct region if I say geo area?
Yes, I thought this would.
I thought. We decided that didn't work because we thought that area should be the slice through the earth area in some way. No, geo area was the cap area.
No, I don't think so. I thought this was working. I have to consult with chance. So the idea is that the geoprimitives would be interpreted as the corresponding curved primitives in 3D. But then area would go and say, oh, this is a 2D primitive in 3D. So I compute the area and give the same result, perhaps in a different unit, but it would be the same thing.
I don't understand that. The edges in the area case, are they geodesics or not?
A geodesic is a bunch of geodesics starting all from the same center.
Oh, no, no, I'm sorry if I. What I meant was area of something which is a geopolygon or a polygon. Oh, I'm confused. If we give a polygon on the sphere on the geoid, does the polygons edges on the geoid, are they geodesics?
Yes, yes.
Well, okay, so I mean, I don't understand why we're not just having it. Okay. The only difference is we think it's useful in analog to the planar triangle case to have like an SAS spherical triangle, right? Which we do not have an SAS spherical SAS geo triangle. Although we could make it with bearings and things.
Could we not go into more details?
Hello? Sorry, somebody's. Somebody's talking. Hello? Hello? Hello? Somebody needs to go on mute. You're good to go. Okay. Okay, what are we saying? So.
So a geoprimative is always defined on the surface of the earth. And when we go to the regions world, what we do is to convert it into a 2D region or mesh embedded in 3D.
I understand, I understand. So I'm asking the question. What Brad has been working on is things like SAS spherical triangles. But at the present time, in the GEO case, Brad, we do not have a convenient way to give angle based triangles, do we?
No, we don't. We have only geopolygon that takes the vertices.
Right?
Yeah.
Although we do have geodirection. Right.
But I think that the geocase is a little bit more complicated because of the ellipticity thing, you know, I know that.
But the thing is, okay, the point is the use case. The case of, you know. Okay, so spherical. What do people use spherical triangles for? I mean, clearly they use them. Go ahead.
The nice thing about the spherical triangles is the rotational invariance of the sphere is a similar property to the translation and variance of the plane. So when you, when you give this specific data, it will hold when the points are put anywhere on the sphere. Similarly, when the points are put anywhere in the plane. And I don't think that's probably not the case with ellipsoids or anything.
Obviously not. Obviously not. Right. But I mean, my question is a different question, right? In, in sort of basic general relativity type stuff. You know, it's a very, it's a very common case to want to look at area deficits and so on and angle deficits and triangles, that kind of thing. It's a standard sort of illustration of curvature of space, etc. Etc. Etc. But I mean, people had studied spherical triangles obsessively. Surveyors had studied, I mean, I think like in. If you look back at a book from 100 years ago, there'll be all kinds of stuff about spherical trigonometry. What was that for? Was that for the Earth? Was that for, you know, idealized spheres? Was that for astronomy? Who knows?
I would say as GEO and astronomy were the two main motivators of that interest.
But why was spherical triangles important? Were triangles important for surveyors?
Yes, yes. I mean, if you have a large enough area of the Earth, you have to use curved geometry. And at that point in which doing ellipsoidal geometry was so incredibly difficult, they tended to do first the spherical approximation and then have linear perturbation formulas.
And the reason that spherical triangles were important is if you're surveying a large area, area, you're going to do it with triangles, you're going to have a triangle decomposition. Is that right?
Exactly, yeah. For example, the first time that they separated small parcels of area in the US around 1800, they already took into account the curvature of the Earth to do very tiny, mild size computations.
So, like in Kansas or something, when they were, you know, for the. Whatever it was, the land rush or whatever. Whatever that whole thing was.
Yeah, yeah. There is this story that the government bought a large area of the US and then made it into small pieces and sell it to the citizens.
Right.
And so they had to be very.
Careful with those pieces, but so that surveying was done. So at that time, people cared about spherical triangles because they surveyed it in triangles. Is that true?
Well, perhaps in quadrangles, but they certainly took into account the fact that they were working with meridians that were approaching towards the port.
Okay, but I mean, my question is the concept of putting in a spherical triangle as opposed to a spherical polygon. Clearly, a spherical polygon is something we need and specifying it by its actual theta five points on the sphere. We understand we need that. Now, Brad has done an additional thing here, which is to specify triangle using angles, using combinations of distance and angles. Right. Which is the equivalent of using geodirection on the Earth, is it not?
It's related. So I think the problem comes from the fact that when you do quadrangles in curve geometry, you end up doing a lot of trigonometry. So what Brad has done is the equivalent of trigonometry in the flat plane, but on the sphere, all these sides. Yeah, go ahead.
And I would just add that I think it's going to be useful in a workflow of once we have the spherical polygons, breaking them down and measuring them by turning them into sets of spherical triangles.
No doubt. But the question is whether sourcing the triangle. Because you've got a completely new and different way of sourcing triangles with those nulls and things in it. Right. So we either have to.
We might eventually hide that.
But I understand that. I understand, but, but so it's. It's an interesting idea, which perhaps we could also apply in 2D. I mean, in flat space. But I want to understand geodirection because to me, what you're doing is you're saying you're giving a sequence of geodirections. I mean, we could specify a polygon in a geopolygon by saying the start point and then a series of geodirections very similar to what angle path does, except angle path is just one, you know, it's just a, you know, a 1D object. Is that making sense?
Yes. The geo direction is indeed equivalent to the problem of given three Points find the angle that one sees the other two.
Right. But I mean, okay, to me it seems like there's more. These things we've got on the screen right now seem more obviously usable than the point and angle. Point and bearing based version of spherical triangles. I think. But I might be missing something. You had raised spherical interpolation function, which I think is yet a separate thing. Am I making sense?
Yep.
And we don't yet have geointerpolate, although we could.
Yeah. So that's something that the statistics team have been looking at.
I see. But I mean they effectively have that. Oh, I see. They don't have that. They only have point processes and things on the plane. Is that true?
Yes. So what they do is to convert into an equal area projection in which the interpolation preserves area, which is the most important thing for them.
Well, that seems like a fine process implementation. And then convert back.
It depends on what you are interested in. If you are interested in preserving length because you are interpolating along a line.
Yeah.
Then an equal. Other projections might be more equidistant projections.
So. But you're saying potentially there's a spherical interpolate which contains in it some kind of spherical projection.
Exactly. For example, random geoposition takes a projection in which you want homogeneity. Because points homogeneous in one projection will not be uniform. Sorry. Would not be uniform in another projection.
Yeah. Okay. So spherical interpolate and geointupolate would have to do the same thing. But to me the first step is, you know, the spherical plot. Okay, so wait a minute, so we've also got spherical. No, we got spherical density plot which is producing the flattened version of this. Right. And spherical density plot 3D is producing basically this. That makes sense.
Yes.
Yeah, I think that's a good starting place actually. Or continue.
Point. Okay, so can I. Can I raise one more question? What about the hyperbolic case?
Personally, I think it's really important, but I'm biased because I spent a lot of time studying algebraic curves, so.
Okay.
I want to see more about hyperbolic triangles in relation to this Riemann uniformization theorem.
Okay, but, but hold on. I just want to know design wise. Okay, if we had. Just like we have spherical, we had hyperbolic as another family here. Do the things we've been discussing make sense for the hyperbolic case? Like does hyperbolic distance make sense? I think it does, doesn't it?
Yes, but we are entering the domain of arbitrary metric. What about projective spaces or some other type of.
Well, but I think hyperbolic space is just one that is, you know, like. Like a sphere is important. Well, we happen to live on one. But, you know, spheres are important because we make them all the time. You know, clearly, just like we said, it's not really as important to do ellipsoid stuff as it is to do the sphere case. I think, you know, one day maybe we have the arbitrary metric case, but I think the hyperbolic case is clearly much more important than the arbitrary metric. Does that make sense?
But my understanding of the hyperbolic case is that there isn't just one hyperbola in the same way that there's one sphere or not one hyperbolic manifold in the same way that there's one sphere or one plane.
I thought they were just different models of hyperbolic space. Am I confused? Anybody here know that? I mean, like, there's a Poincare disk and there's the various other models. But I thought that there was.
Well, we would start just with Minkowski metric, perhaps in N dimensions, and do geometry.
Just the Minkowski metric. Just like. Right. That's the analog of, you know, that's the differently signed Euclidean metric. And I mean for mathematical uses. I mean, because the case that I can see is a variety of, you know, for example, hyperbolic visualization. You know, visualize a tree in hyperbolic space, And that would work in the. You know that that's going to just work in Minkowski space. Right. That's not. That doesn't require any other. And then there's the question of what is the. I don't quite understand the difference between the quotes. Model of hyperbolic space, like the hungry gray disk versus a projection. It's some kind of generalized projection. Yes, something like that. We may have the wrong set of people here to answer this.
I was thinking. So I've seen Ian investigating hyperbolic representations of trees in which all the nodes get very close to each other near the border of a disk.
Right?
Yeah, yeah, we can explore those things. It's an enormous world of rotations of multiple new things to consider.
Right. But I mean, okay, so we have. In the function repository. Yeah, we have a bunch of things here. Hyperbolic distance. Look at that. Huh? I see. Well, things to look at here. I'm just trying to understand whether that. I'm just trying to look ahead to see whether the design we're making for the spherical case is going to be insanely different for the hyperbolic case. Oh, yeah, Right. Okay, we should probably wrap up here. Sorry we did not get to the other topics for today, but do we have This, I mean, clearly spherical distance looks like it's good to go. And then I think we need to be tackling some of these other spherical functions.
Okay. We will explore with Brett a bit. I think he needs to be involved in any of this.
Yes. But I tend to think that we need these wrappers, spherical paths, vertical polygon and so on. I don't think we need a spherical point, I don't think. But I don't know for sure. What would happen if we did. Yeah, go ahead.
Maybe the next, next thing to do is try and take some of these wrappers and show how they would work with the spherical triangles thing for extracting property information.
Maybe. I mean, I'm just not convinced that the. Look, your scheme for how spherical triangles are represented is quite interesting and potentially applicable to plane triangles, but we're not going to have it for spherical triangles and not for plane triangles. See what I'm saying?
Do you want those functions then to look more like the plain case or.
I don't know, because I don't know how spherical triangles are used. I mean, my speculation is that they were used by surveyors or possibly astronomy people, but I think more likely surveyors, you know, 100 plus years ago. And I don't know how they're used today. I just don't know. So we need to find that out.
But there's something here.
I mean, I guess this is called spherical. Try. Is this plural spherical triangles.
But yeah, because it possibly returns more than one.
Right.
But I, I would expect spherical triangle or, or even, you know, I. To be more like triangle where you just give it three vertices and possibly additional information because you need to choose an insider, an outside, et cetera, et cetera.
Yeah, we don't have a final name for this either. And Jose has already suggested, you know, maybe adding solve to the name for it so that it's clear some. Something's being solved here. Another name I thought of was spherical triangle completions.
I don't think we know what spherical triangles are used for. We need to figure that out before we go. I don't know whether this design makes sense. Right. We need to understand more about what spherical triangles are used for. Because if really all we're trying to do, you know, look, I know from the 1960s, for example, books of tables always had sections on spherical triangles. I never used them once. I don't know what they're used for. Am I making sense? Just like the. Have a sine function, for example, which appears here. Right. See that have a sine function Yeah.
I mean, my, my basic understanding is it's similar to the simplex thing.
Yes, I, I understand that, but. But it may be that this was a method that was important when you were doing by, you know, surveying with chains and theodolites and things like this. Right, but it's irrelevant today. Just like have a sign is not a function any of us have used, I believe. Does anybody here used Haversine?
Yes, to improve the Haversine ref page.
Not outside this context of geo and spherical geometry. But I guess the point here is when do you need spherical geometry?
And there are.
I know, design of antennas. You are designing your solar panels.
Exactly, exactly. There are places where functions on the sphere are very important. Spherical triangles. I don't know about. I don't know if you use spherical triangles in antenna design. I think you do not. You certainly use functions, you know, F of theta phi, you know, power I of theta phi is absolutely used, integrals over that, things like this.
But perhaps we are focusing too much on a spherical triangle.
That was the design problem that Brad has given us here.
But what I mean is that spherical triangles are used to do spherical trigonometry. So the important thing is that you have sides and you need to compute angles, etc. And to visualize that and to work with that, you use triangles. But the main thing you're going to get is not the triangle itself, but the angles or the sides.
Okay, but I don't even know that. I don't even know that you get the angles and sides. I just don't know. Give me an example where you get that. You don't get that in antenna design.
Well, I mean, if you want to see the area that is covered by the circle of the antenna from a given point of view. Right. So you need some sort of GEO area, spherical area computation, you might do it.
I understand, but I don't think it's spherical triangles. I don't know. I, I think spherical triangles are creatures of an earlier period in how surveying was done. Might be wrong. But let's try and determine that before we spend. Before we invent a whole giant mechanism for dealing with spherical triangles inconsistent with our mechanism for dealing with plane triangles. Let's find out. For plane triangles, we know that SAs, SSS and so on are important because that's how people learn about triangles.
Yes, but the point with those triangles is that you are feeding information about sides and angles and you're getting back something that is placed somewhere. So there is some sort of arbitrary decision on where to place it and where to orient it. The design that Brad was presenting here is more self consistent in the sense that you play with sides.
I get it, I get it, I get it. Which means that we potentially should use it for plane triangles as well. Yeah. But I mean, in the end, if we visualize the triangle, we've got to place it somewhere. And I've got to go. This is nice stuff, Brad. Thank you. I mean, this is good. We're finally off and running with the spherical stuff. Okay, to be continued. See you guys soon.
Bye.
Bye.
More from Guy

Cheryl Strauss Einhorn | The Human Edge: Smarter Decisions in the Age of AI | Talks at Google

Rachel Glennerster | Innovation and the Center for Global Development | Talks at Google

Rebecca Winthrop | Rethinking the Purpose of Education in the Age of AI | Talks at Google

Dr. Robert Wachter | A Giant Leap: How AI Is Transforming Healthcare... | Talks at Google






