🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Changing number space with multiplication

Started by
19 comments, last by LorenzoGatti 6 years, 3 months ago

Lets say I have some variable x in a domain i.e. <-inf, inf>. If I want to change it's space I know that I can multiply or divide it by some other number k, i.e. if I want to change it to circular space I can multiply/divide it by 2PI. What is the difference if I multiply it versus if I divide it by some number, what would be the outcome and what are the different uses?

I could take for e.g. time variable t and multiply/divide it by 2PI. Why would I want to do one versus the other besides that one gives smaller resulting values and other one greater values?

Advertisement
41 minutes ago, ryt said:

if I want to change it to circular space I can multiply/divide it by 2PI

What is a "circular space" in this context? I'm assuming based on the 2*pi constant that you are talking about mapping a linear sequence onto a number of rotations?

The two mappings you describe have very different results. Multiplying by 2*pi means that 1 unit represents a complete rotation. Dividing by 2*pi means that it 0-2pi represents a complete rotation. There are infinitely many mappings of the form linear-factor*constant*2pi, resulting in infinitely many speeds of rotation...

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

8 minutes ago, swiftcoder said:

What is a "circular space" in this context? I'm assuming based on the 2*pi constant that you are talking about mapping a linear sequence onto a number of rotations?

The two mappings you describe have very different results. Multiplying by 2*pi means that 1 unit represents a complete rotation. Dividing by 2*pi means that it 0-2pi represents a complete rotation. There are infinitely many mappings of the form linear-factor*constant*2pi, resulting in infinitely many speeds of rotation...

I guess that that's true. I wanted to transform for e.g. time variable to rotations and see what I will get.

By your explanation I think that the important thing to remember is that 1 unit, that is if we multiply there is a one-to-one relation between 1 and 2*pi, from the e.g. 3sec will be translated to 6*pi (3 rotations). On the other hand if we divide, one unit (a span) is transformed to 0-2pi so a dividend "falls" into this space.

I hope I got that right, I know it's a bit confusing.

Do you maybe know some examples where we would want to multiply by 2*pi and where we would want to divide by 2*pi?

What would be the effect of only using only pi instead of 2*pi? I know that the resulting value would be smaller for multiplication case and with your explanation that 1 unit would represent half rotation but I'm just asking for completeness in case I forgot something. 

39 minutes ago, ryt said:

Do you maybe know some examples where we would want to multiply by 2*pi and where we would want to divide by 2*pi?

It's better to think of them both as multiplications. In one case you are multiplying by 2*pi, and in the other by 1/(2*pi). This makes it clearer that you are performing the same operation in both cases (projecting a distance onto the circumference of a circle), and the only difference is how fast the circle rotates.

41 minutes ago, ryt said:

What would be the effect of only using only pi instead of 2*pi?

It'll rotate half as fast.

There's nothing magical about the constant 2*pi given the operation you describe. In one case you are rotating by 180 degrees per unit of time, and in the other by 360 degrees per unit of time.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

I came with two examples. Lets say we have to numbers, t = 3 and t = 15. These could be interpreted as times with dimension in sec.
For first part, if we multiply 3 * 2pi, we get 18.84. Since pi is in radians we get 18.84 rad. This could be thought of changing the space and getting it actually in radians, something like in 3 sec we passed over 18.84 rad.
For second part, if we divide 15 / 2pi, we get 2.38. Same as before this is 1/rad or if we think of t as time than it becomes sec/rad. This can be thought of how many units per some other unit, or how many sec per one rad, something like 2.38 sec in 1 rad.

Another example that comes to my mind is taking a t between [-1, 1] that goes back and forth. If we multiply t * 2pi, we are getting a space in rad that corresponds to rotations [-6.28, 6.28] that go also back and forth. A rotating circle that rotates one turn in each direction.
Taking the same example and dividing it instead t / 2pi, would get us [-0.15, 0.15] which would mean 0.15 in each direction per one rad.

47 minutes ago, ryt said:

Same as before this is 1/rad or if we think of t as time than it becomes sec/rad. This can be thought of how many units per some other unit, or how many sec per one rad

I think you are overcomplicating things by switching units in the middle here. Whether you multiply or divide, you are still treating the input as time (measured in seconds), and the output as rotation (measured in radians), and performing the same operation (multiplying by a  constant).

If we write the equation down:  T seconds * x = R radians. Then it becomes immediately clear that the unit of has to be radians/second.

In your first example, we get x = 2pi radians/second, and in the second one x = 1/2pi radians/second. Which you could also write as 2*pi seconds/radian, but it isn't generally useful to do so, since it just obscures the fact that they are the same unit conversion, just with a different constant factor.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

22 hours ago, swiftcoder said:

Which you could also write as 2*pi seconds/radian, but it isn't generally ...

I'm confused about this one, I guess you meant to write 2pi*x = 1 or similar.
Edit: Oh, I think I got it. To rewrite you meant T seconds * (1/2pi) = R radians which yields 2pi = T/R. 

From your first equation, T seconds * x = R radinas, if I'm correct we can conclude that multiplying some dimension (seconds here) by a constant gives us another dimension (radians in this case). I think that we get as a result radians because we explicitly multiplied with 2pi (could be pi too), but if we chose to multiply by some other constant we would get some other arbitrary space, not necessarily in radians?

For e.g. multiplying by 0.01 would give us a percentage, or multiplying by some other constant would give us some other space.

10 minutes ago, ryt said:

if I'm correct we can conclude that multiplying some dimension (seconds here) by a constant gives us another dimension (radians in this case). I think that we get as a result radians because we explicitly multiplied with 2pi (could be pi too), but if we chose to multiply by some other constant we would get some other arbitrary space, not necessarily in radians?

For e.g. multiplying by 0.01 would give us a percentage, or multiplying by some other constant would give us some other space.

No. Constants don't have implicit units. There's nothing about the constant 2*pi that makes it be radians/second. 2*pi could just as well be in units of pizzas/fortnight or miles/second^2.

Because you want to convert from seconds to radians, the constant in your equation must be in radians/second, regardless of the value of the constant.

If you don't provide units, your equation will be dimensionless (i.e. just plain numbers). As soon as you add units, they have to be consistent across both sides of the equation (i.e. the same rules as standard algebra).

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Let's say we have another circle but this time not in radians but instead in domain [0, 4], where 0 represents beginning (like 0 rad) and 4 represents the end (like 6.28 rad), 0 and 4 are same point and 1, 2, 3 are evenly spaced between them (that is pi/2 apart).
Than let's say that there are two points A and B on this circle. B is a fixed point and A tries to reach it through the shortest distance. Let's say that B = 4 and A = 3.
Can we use the math we used above to find this solution for any points A and B?
Would it help us if we transform this space to radians and than try to solve it?

I invented this problem to see if I could apply the above logic. Maybe I went a bit of the path and the problem doesn't really need all the logic or it could really need something different. I'm not sure at this point so I wrote it.

This topic is closed to new replies.

Advertisement