Tech Talks 2022: Examining Hyperspheres with Mathematica

This content was created by Guy Kawasaki. This content was uploaded by Guy Kawasaki. This is a YouTube video titled "Tech Talks 2022: Examining Hyperspheres with Mathematica" featuring a conversation between host Rebecca and guest Alistair Forsyth, an executive intern at the algebra and calculus department. Recorded on October 18, 2022, the talk explores the concept of hyperspheres, their visualization in Mathematica, and their applications in fields like machine learning.
Chapters
Hello and welcome back to another Tech Talk. I'm your host, Rebecca, and we're still streaming here from the wolfram Technology Conference 2022. And today I have Alistair Forsyth with me, who's the executive intern for the algebra and calculus department. His boss is Devendra, who we just met in the last TechTalk. So it's really good to be here with you today.
Yes.
Yeah. This is your first wtc, right?
Yeah. Yes.
Cool. Are you excited to be here?
Yeah, it seems cool. I'm having a good time.
Great. It's good to hear. Today Alster's going to be talking to us about examining hyperspheres with Mathematica, and I don't have a very technical background, so do you want to share with me more about what hyperspheres are?
So hyperspheres are pretty much like kind of what they sound like. Like if you have a sphere in three dimensions, if you can imagine, like a ball, if you added another dimension, like a fourth dimension or even a fifth dimension, and you just kept that proportionality between each direction, you'd have a hypersphere. So formally defined, a hypersphere is just a shape defined by having a constant distance between points on its surface and its center. So if you think of like a three dimensional like ball, each point on the ball is going to be this equidistant from the center of the ball. And there is a slight difference between an N sphere or an N ball and mathematical jargon, but basically I'll be referring to them interchangeably because it doesn't really matter for our contexts. But an N sphere is usually referring to the shape, whereas an N ball is referring to the volume. But it.
Okay, that makes more sense. Thank you. I needed to hear that so we can do this talk. Well, so how can we visualize this in Mathematica?
Sure. So one visualization I have going here is that if you take spherical coordinates, which is another way of mapping out spheres, you can imagine taking an angle from the X dimension to the Y dimension and let's call that S, as I have shown here, and an angle from the X dimension to the Y dimension, you can call that T. And if you give a radius R, that gives you a set of coordinates, basically spherical coordinates that you can use to define a three dimensional sphere. And basically we can just add more of those, more angles from different dimensions. And. And as long as we keep that R constant, you'll have a sphere. And I show that a little bit here. A concept that will help better visualize it is that if you take a Cut of a sphere in N dimensions, you'll end up with a sphere in N2 dimensions. So for example, if you take this here, I've got a three dimensional sphere, just a normal sphere like we're accustomed to. If you cut it in one little plane, you get a circle like an N minus 2 kind of a sphere. And so if we do the same thing but with five dimensions, you see, I've defined a five dimensional sphere using those spherical coordinates, but with five dimensions or my bad, sorry, four dimensions, if we take that cut of it, got a three dimensional sphere. So basically, if you can imagine a circle like on a two dimensional piece of paper, being like a cross section of a sphere, you could do the same thing with a hypersphere, let's say a fourth dimensional sphere, and get us like what we would just call a sphere. So does that make sense?
It does make sense. Why would someone need to, I guess, measure a hypersphere or have a hypersphere?
One place that it's helpful is possibly in machine learning or something like that, where you might need more than two or three dimensions to describe data. There is a concept of machine learning called the curse of dimensionality, where basically if you add, there are possibly unintuitive consequences to adding more dimensions to a data set. For example, I mentioned that a little bit near the end here, this slide. If you take like a small number, let's say I've got it defined here as epsilon, right now it's just 1/10 0.1. And you take the volume of a sphere with here I've got D and R representing the number of dimensions and then the radius of the sphere, if you increase D, the outermost portion of R, So let's say the outermost one tenth of that radius of the sphere becomes a larger and larger proportion of the sphere. For example, once we get here to 10 dimensions, the last 1/10 of that radius compromises well over a half of the sphere, which is a problem because if you have, let's say, evenly distributed data points in n dimensional space, if N is really big, a very small sphere will describe a lot of area, which it can be a problem because you'll get a graph like let's say if you have the number of dimensions and how many points are described here, you'll start off with almost none described and then eventually you'll have a lot of them, because adding just that little bit adds a lot of space.
Interesting. Okay, I saw you had a slide about geometry with this. I'd like to hear about that as well.
Yes, this is kind of interesting. I thought I'd include it because it's just a little bit unintuitive. There's actually recursion in the volume of an N sphere, which means essentially the volume of, let's say a fifth dimensional sphere is directly proportional to the volume of a third dimensional sphere, which is. It's a little unintuitive, but if you imagined taking a N sphere of radius R and you fixed an angle alpha like this, and then a radius R, you could integrate over that alpha and that radius like I have here. And then if you solved that, which I won't do here because it'll take too long and it'll be a little too technical and it won't be helpful, you'll actually get a little constant of proportionality just times the volume of the same sphere, you know, the same radius with two less dimensions, which is very odd. And I've got just some evidence for that here. You've got a classic definition for. I say classic, but in the math community, a classic definition for the volume of a sphere of D dimensions and R radius, which is using Euler's gamma function. And then if you find the proportion between the last one and n minus two and N, you get spit out the same result I got up here. And this is just doing the same thing in reverse. Cool.
Okay. So going back to just visualizing this in Mathematica, why would someone want to visualize this?
It could be a really hard concept to talk about on paper. For example, when I was first learning about this, I. It was in a multivariable calculus class and it just did not make sense to me at all because it was just like they just had like text to explain it, which was not helpful because it, you know, you can't really imagine things in three dimensions. We live in three dimensions. Or you can't really think of a fourth dimension without having some kind of precursor to that. Or it's not, you know, it's very hard to visualize. So having some way of translating that to three dimensions or showing how objects in fourth dimensions interact with bits of them in three dimensions can be helpful for people to kind of get the idea. Yeah. So I just thought it'd be better than just straight text.
Perfect. Yeah, absolutely. Okay, so what are you excited about seeing in Mathematica soon or that has happened recently with hyperspheres or geometry or math in general?
I'm not sure about any changes in Mathematica directly related to it because to be honest, I'm not actually sure how much. This is still being studied. There's a surprising amount that's already available online that you can learn about. But I guess I'm mostly interested in a video series that I'm doing on discrete calculus with Mathematica, which uses a lot of sometimes fairly new functions in Mathematica to describe different things in calculus. And, yeah, just Mathematica in general can be really helpful for visualizing or computing stuff like this. For example, I have some code back here that would take an eternity if you wrote it out by hand, which is basically, this is just taking those X, Y, Z, T, G. These are essentially spherical coordinates, but in five dimensions, and taking the gradient of those, which is. If you've done any calculus or multivariable calculus, to take a gradient of just one of those, you have to compute five different derivatives. And then to do this by hand, you'd have to take five gradients and then take the determinant of a matrix created by that, which, given that I did that on hand, I did that by hand forever ago in that course. It is awful doing stuff by that, stuff like that by hand. But Mathematica can compute it with almost no effort as long as you can type it out. And just to confirm that that is correct, you've got. You know, you can just look that up in the Wolfram math world and it comes out with the right formula.
Wow. Thank you so much. We'll definitely make sure to take a look at that video series that you guys are completing and just make sure to keep an eye on it, just in case the viewers don't know. Alistair is in high school and he is very, very, very smart. Smarter than I could ever be. So this has been a really informative talk. You've definitely made it easier for me to understand terms that I've never heard. So thank you so much for being here and for joining the Wolfram team.
Yeah, of course. I appreciate that a lot. Yeah.
Yeah. Thank you. And we'll be back with more tech talks later this week. Thanks. Thank you.
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






