**Video Transcript / Captions**

Closed captioning for this video is available on YouTube: Using Numbers for Orbital Calculations.

You've probably used Numbers for things like balancing a checkbook or computing some sales numbers or something like that. But you can use it for physics. So let me do a simple example. Well, maybe not so simple. It's going to be calculating orbits.

So, let's start with a blank spreadsheet here and in this spreadsheet I'm going to create columns. I'm going to get rid of the left header there. Let's put a satellite at position X and Y. Where X=0 and Y=O are the center of this whole thing. In other words the center of the planet that the satellite is orbiting.

Let's start off with the satellite is to the right of the planet. Here's the planet and let's do a small satellite that is going to be just off to the right like there. So that's going to be X=, let's come up with something like 100 and Y=0. The Y coordinate is the same as the planet and X is over to the right. So the planet looks like it might be a certain radius of 50 or something like that. But the actual R we're going to use is going to be the distance from the center of the satellite to the center of the planet. So to calculate the distance we need to do Pathagorean's theorem which is going to be the square root of the sum of the squares. So the X coordinate to the power of 2 plus the Y coordinate to the power of 2. The square root of the whole thing. So you can see the distance from the center to the center is 100 which is what you would expect with X being 100 and Y being 0.

So now let's create a velocity because if this thing's in orbit it's got to be moving. So we'll do DX and DY and let's say what would make sense at this point is that the satellite is moving this way. Right, because gravity is pulling it here the satellite has got to be moving this way in order to orbit. So, we'll do DX of zero and DY of 10 as a starting value. So straight down. The acceleration though is going to be towards the center of the planet. The planet is pulling it there. Let's go and shrink this table a little bit by selecting the entire thing. We don't need columns to be so big. Let's add another column there. Let's do the acceleration because of gravity is going to be a formula where it's equal to a gravitational constant divided by, we'll do the gravitational constant as 1, divided by the distance squared. So power of distance to the center squared. That's gets us a number like that.

Now, the constant can be anything and we're not using units here. 100 is not a hundred kilometers, miles, nothing. We're going to skip units to keep this simple. So a gravitational constant that would work really well at a radius of 100 would be 100 squared. So you could find this through experimentation or because I happen to know this I can put that in there. That's the gravitational constant.

Now if you want to get the acceleration in the X direction and the acceleration in the Y direction what you need to do is that's equal to acceleration and that's multiplied by the X coordinate divided by the total distance there. The acceleration for Y is the acceleration multiplied by the Y coordinate times the total distance.

Now there's one adjustment we need to make. These need to be negative because it's pulling towards, not pushing away. So let's just put a negative there. Great. So now let's calculate the new acceleration here which is going to be equal to the old one, right, plus AX. DX plus AX. This is going to be equal to the old one, DY plus AY. That's the new amount. Now, given that the new X coordinate is equal to the old X coordinate plus the difference in X. The new Y coordinate is equal to the old Y coordinate plus the difference in Y. The radius you can copy and paste and it will show you that it's approximately the same. A little bit smaller. The acceleration is based on the radius so we can put that in there. And this is based on the radius and the acceleration due to gravity. We paste those in there. That's the new amount. I can copy and paste these throughout the entire thing here. So this is what I get.

I can tell already that I've got a radius here that starts at 100 and it gets closer and then starts to actually get a little farther away. So what can we do to illustrate what is happening. Let's create a scatter chart. I'll take these two columns, the X and Y position. I'll create a new chart. Choose scatter. I've got it right here. Let's go into the axes here. We're starting at a radius of about 100. So let's change the scale to be the maximum of 200 and the minimum of negative 200 that's in X. The same thing for Y. There we go. We also want to go and make this a square chart so I can see that the width and the height are about the same. So we can see what's happening here.

So we start here at X equals 100 and Y equals 0. Then we go like this. That looks good! It looks like an orbit. Let's stretch this table a lot more and you can see it fills in with all the data. Now I can look and see I've got a circular orbit. How did I get a circular orbit?Well, I cheated. I knew that the answer would be this here. This is the speed right. Zero in DX and 10 in DY. I filled that in with a value of 10. Look what happens if I fill it in with a value of 12. It creates an elliptical orbit here. This is zero zero. I can actually move the planet, the shape here, right to zero zero. There we go. You can see what's happening here. If I change it back to 10 you can see it's a nice orbit. Change it to 13 you can see it actually looks like it escapes. Actually if I had enough space here it might actually orbit in a very elliptical way. If I decrease you can see it actually goes inside the planet here. Of course, I'm just giving an arbitrary size for the planet so I could shrink this down to certainly to some sort of more normal size like that. Put these at the center of each other. So depending upon the radius of the planet this could be an elliptical orbit or be a crash and burn orbit. You can even see here that things get to go out of shape as the satellite is going to continue to get closer and closer to the planet.

So you can use this to compute orbits. Another cool thing that you can do is you can create another chart that is for R here. So you can do that and do a line and you can see the altitude here with, you know, it's starting here and then this elliptical orbit gets really high and far away and then gets really close again. If I were to go back to a normal speed you can see it. But this goes from 90 to 110. To be fair I should actually do a scale of zero to 100. Sorry let's try that again. The maximum of 100 and the minimum of 0. There we go. 110. So you can see it actually see that it kind of stays somewhat in a stable orbit. Why? If this number is the right number, the DY, does it kind of go a little bit elliptical like that. That's because we're taking these big time steps here. If we had smaller steps in between then I would assume that this number would smooth out and if you had really tiny steps you would end up with 100s all the way down here. But it's just because we're jumping from one step to another, as the dots show, that it's kind of like loosing a little bit. Then it gets it back as the little bits of error are repeated and it stays at an average distance of 100.

So there's kind of a fun science thing that you could do with Numbers and showing that you can do more than just accounting and bookkeeping with it.

You've probably used Numbers for things like balancing a checkbook or computing some sales numbers or something like that. But you can use it for physics. So let me do a simple example. Well, maybe not so simple. It's going to be calculating orbits.

So, let's start with a blank spreadsheet here and in this spreadsheet I'm going to create columns. I'm going to get rid of the left header there. Let's put a satellite at position X and Y. Where X=0 and Y=O are the center of this whole thing. In other words the center of the planet that the satellite is orbiting.

Let's start off with the satellite is to the right of the planet. Here's the planet and let's do a small satellite that is going to be just off to the right like there. So that's going to be X=, let's come up with something like 100 and Y=0. The Y coordinate is the same as the planet and X is over to the right. So the planet looks like it might be a certain radius of 50 or something like that. But the actual R we're going to use is going to be the distance from the center of the satellite to the center of the planet. So to calculate the distance we need to do Pathagorean's theorem which is going to be the square root of the sum of the squares. So the X coordinate to the power of 2 plus the Y coordinate to the power of 2. The square root of the whole thing. So you can see the distance from the center to the center is 100 which is what you would expect with X being 100 and Y being 0.

So now let's create a velocity because if this thing's in orbit it's got to be moving. So we'll do DX and DY and let's say what would make sense at this point is that the satellite is moving this way. Right, because gravity is pulling it here the satellite has got to be moving this way in order to orbit. So, we'll do DX of zero and DY of 10 as a starting value. So straight down. The acceleration though is going to be towards the center of the planet. The planet is pulling it there. Let's go and shrink this table a little bit by selecting the entire thing. We don't need columns to be so big. Let's add another column there. Let's do the acceleration because of gravity is going to be a formula where it's equal to a gravitational constant divided by, we'll do the gravitational constant as 1, divided by the distance squared. So power of distance to the center squared. That's gets us a number like that.

Now, the constant can be anything and we're not using units here. 100 is not a hundred kilometers, miles, nothing. We're going to skip units to keep this simple. So a gravitational constant that would work really well at a radius of 100 would be 100 squared. So you could find this through experimentation or because I happen to know this I can put that in there. That's the gravitational constant.

Now if you want to get the acceleration in the X direction and the acceleration in the Y direction what you need to do is that's equal to acceleration and that's multiplied by the X coordinate divided by the total distance there. The acceleration for Y is the acceleration multiplied by the Y coordinate times the total distance.

Now there's one adjustment we need to make. These need to be negative because it's pulling towards, not pushing away. So let's just put a negative there. Great. So now let's calculate the new acceleration here which is going to be equal to the old one, right, plus AX. DX plus AX. This is going to be equal to the old one, DY plus AY. That's the new amount. Now, given that the new X coordinate is equal to the old X coordinate plus the difference in X. The new Y coordinate is equal to the old Y coordinate plus the difference in Y. The radius you can copy and paste and it will show you that it's approximately the same. A little bit smaller. The acceleration is based on the radius so we can put that in there. And this is based on the radius and the acceleration due to gravity. We paste those in there. That's the new amount. I can copy and paste these throughout the entire thing here. So this is what I get.

I can tell already that I've got a radius here that starts at 100 and it gets closer and then starts to actually get a little farther away. So what can we do to illustrate what is happening. Let's create a scatter chart. I'll take these two columns, the X and Y position. I'll create a new chart. Choose scatter. I've got it right here. Let's go into the axes here. We're starting at a radius of about 100. So let's change the scale to be the maximum of 200 and the minimum of negative 200 that's in X. The same thing for Y. There we go. We also want to go and make this a square chart so I can see that the width and the height are about the same. So we can see what's happening here.

So we start here at X equals 100 and Y equals 0. Then we go like this. That looks good! It looks like an orbit. Let's stretch this table a lot more and you can see it fills in with all the data. Now I can look and see I've got a circular orbit. How did I get a circular orbit?Well, I cheated. I knew that the answer would be this here. This is the speed right. Zero in DX and 10 in DY. I filled that in with a value of 10. Look what happens if I fill it in with a value of 12. It creates an elliptical orbit here. This is zero zero. I can actually move the planet, the shape here, right to zero zero. There we go. You can see what's happening here. If I change it back to 10 you can see it's a nice orbit. Change it to 13 you can see it actually looks like it escapes. Actually if I had enough space here it might actually orbit in a very elliptical way. If I decrease you can see it actually goes inside the planet here. Of course, I'm just giving an arbitrary size for the planet so I could shrink this down to certainly to some sort of more normal size like that. Put these at the center of each other. So depending upon the radius of the planet this could be an elliptical orbit or be a crash and burn orbit. You can even see here that things get to go out of shape as the satellite is going to continue to get closer and closer to the planet.

So you can use this to compute orbits. Another cool thing that you can do is you can create another chart that is for R here. So you can do that and do a line and you can see the altitude here with, you know, it's starting here and then this elliptical orbit gets really high and far away and then gets really close again. If I were to go back to a normal speed you can see it. But this goes from 90 to 110. To be fair I should actually do a scale of zero to 100. Sorry let's try that again. The maximum of 100 and the minimum of 0. There we go. 110. So you can see it actually see that it kind of stays somewhat in a stable orbit. Why? If this number is the right number, the DY, does it kind of go a little bit elliptical like that. That's because we're taking these big time steps here. If we had smaller steps in between then I would assume that this number would smooth out and if you had really tiny steps you would end up with 100s all the way down here. But it's just because we're jumping from one step to another, as the dots show, that it's kind of like loosing a little bit. Then it gets it back as the little bits of error are repeated and it stays at an average distance of 100.

So there's kind of a fun science thing that you could do with Numbers and showing that you can do more than just accounting and bookkeeping with it.