Jump to content


Photo

Imaginary Numbers


  • Please log in to reply
120 replies to this topic

#61 MasterOfKings

MasterOfKings

    The True Master

  • GMC Member
  • 4888 posts
  • Version:GM8

Posted 02 May 2011 - 06:47 AM

A square of area -1 is the same as a square of area 1, except the "orientation" is different. (Areas can have a sense of orientation.)

Mathematically, yes; but try and draw it...

Wait.. no.. I can't get dragged back into this... *runs*

-MoK
  • 1

#62 xshortguy

xshortguy

    GMC Member

  • Global Moderators
  • 4186 posts
  • Version:GM:Studio

Posted 02 May 2011 - 01:37 PM

It's easy to draw. Just draw a normal square. Draw a CCW circular arrow for positive orientation, and a CW circular arrow for negative orientation.
  • 0

#63 DerrenFreeman

DerrenFreeman

    GMC Member

  • New Member
  • 16 posts

Posted 02 May 2011 - 03:23 PM

This is all moot now, Yourself and others have put forth their all-knowing opinions on the situation. Although I do not agree (because I still haven't been shown, nor found any documentation on how it simplifies anything since no computer monitor takes in quaternion calculations as an input to derive a pixel position), it really doesn't matter because they know more than me in the mathematics area.

Stop arguing for the sake of it. If you REALLY want to know the uses, a quick bit of googling does the jobbie nicely.
Complex numbers:
http://www.math.toronto.edu/mathnet/questionCorner/complexinlife.html
http://www.st-andrews.ac.uk/~www_pa/Scots_Guide/info/signals/complex/cmplx.html
Quaternions:
http://www.gamedev.net/page/resources/_/do-we-really-need-quaternions-r1199
http://www.genesis3d.com/~kdtop/Quaternions-UsingToRepresentRotation.htm
http://www.3dkingdoms.com/weekly/weekly.php?a=36

I believe they all go into the real world uses of Complex Numbers and Quaternions nicely. Which is what you are asking, yes?

Now please explain the uses of irrational numbers. The uses are still there, but have about as much use as the above concepts.

I'm not saying they are "useless". Nor that the others are "useful." My point is that just because YOU have never used them, doesn't mean noone can, or should.
  • 1

#64 sabriath

sabriath

    12013

  • GMC Member
  • 3147 posts

Posted 02 May 2011 - 06:26 PM

A square of area -1 is the same as a square of area 1, except the "orientation" is different. (Areas can have a sense of orientation.)

uhhh....k *blink*

So your "negative circles" argument is invalid. If you ever get a chance, take a course in abstract algebra. Near the end, you will encounter a proof that the complex numbers are algebraically closed (I.E. every polynomial with complex coefficients has complex roots).

I _know_ that complex calculations can be used to solve equations, I never stated that they didn't have a place in this world....I stated that it makes no sense (to me) to have them included in a game making utility/engine/whatever (bloating the runner even more just for the 0.0001% of people who might use it).

It simplifies:
* Memory. Quaternion takes 4 times what a scalar takes, equivalent matrix takes 9.
* Multiplication: Quaternion multiplication is 28 scalar operations. Matrix is 45.
* Normalization. Quaternion takes 1 sqrt, 4 divisions. Matrix takes more, with the exact number depending on the method.

So basically it's a good way to handle rotations of an object. Once you want to rotate multiple vectors though, it's best to get a matrix from it and use that.

And how would you convert the 4 quaternion values into an x/y position on the screen?

I believe they all go into the real world uses of Complex Numbers and Quaternions nicely. Which is what you are asking, yes?

Nope, proves my point even more in showing that you have to _convert_ in and out of quaternion space before doing rotations. As far as I can see, staying inside quaternion calculations DOES speed things up, but then you need to perform some matrix transform in order to get an x/y position out of the equation.

From the blog of Mike, I guess what I'm trying to convey deals more with static 3D...transforming it's position in world-space onto camera-space. Why turn an x/y/z into a 4-value quaternion, do a single rotation, then transform it to x/y? I can see how dynamic 3D would help with calculations a little, but you'd have to have at least 3 rotations (in my opinion) before you see any efficiency. Unless someone can show me a direct equation from (q1, q2, q3, q4) -> (x, y) that is better than the ones I've googled (which is a matrix calculation, defeating the purpose of not using matrix calculations).

I'm not saying they are "useless". Nor that the others are "useful." My point is that just because YOU have never used them, doesn't mean noone can, or should.

I have used them, and I never said others can't use them...just don't see a use in complex numbers being built-in to GM. However, since Mike might possibly add complex typechecking in GM, it'll be no point fighting against complex numbers anymore. What I mean is, currently it's:

if(gmvar->type)
  //do 'real' calculation
else
  //do 'string' calculation


versus

switch(gmvar->type)
{
  case vt_real:
    ..
  case vt_string:
    ..
  case vt_list:
    ..
  case vt_stack:
    ..
  case vt_complex:
    ..
  etc.
}

The former structure is optimized by the compiler slightly more than the latter, so making the runner perform variable/value calculations a bit faster for games. But as I stated, Mike already wants to turn it into the latter, so no use fighting it anymore.


I honestly don't care anymore what is said further, you'll only be typing to blind eyes from here on....in fact, if you noticed lately, I haven't been around as much, or posted as often as I use to -- and soon I'll stop altogether.
  • 0

#65 DerrenFreeman

DerrenFreeman

    GMC Member

  • New Member
  • 16 posts

Posted 02 May 2011 - 07:28 PM

That whole post was just backtracking your own arguments, to try and make it seem like you have been saying our points all along. So FINALLY you understand they have a place in the world?

Anyway, to quote myself once more:

Neither Complex Numbers or Quaternions would be useful to the average GML user, however, if one is educated, and curious enough, to want or use them, then they are educated and curious enough to be able to implement such ideas into Game Maker by themself. Because of this, I contend it would be a waste of time, and (arguably) processing power, to natively input them into Game Maker.

-Derren Freeman


  • 0

#66 snake5

snake5

    GMC Member

  • GMC Member
  • 71 posts

Posted 03 May 2011 - 04:22 AM

sabriath:

A compiler could probably optimize the switch to a jump table or something like that. Which makes worrying about speed not useful.

Also, even more math primitives would be really useful here: vector (2d/3d/4d), quaternion, ray, plane, polygon, convex hull, matrix, ... along with lots of functions that help with calculation. So many people are already replicating most calculations in scripts so there's a solid demand for it.

And how would you convert the 4 quaternion values into an x/y position on the screen?

Quaternion doesn't describe position data. It describes rotation data. Which means it could be converted to a matrix and set as/added to a world transform matrix for 3D rendering.

Nope, proves my point even more in showing that you have to _convert_ in and out of quaternion space before doing rotations.

In a correct implementation, there should be no "in". Start with quaternions, end with matrices.


P.S. Complex numbers shouldn't really have a built-in type though - they're mostly useless for game development. They're only useful for making the equations that are later converted to code and that doesn't happen inside GM.

Edited by snake5, 03 May 2011 - 04:22 AM.

  • 0

#67 grygrflzr

grygrflzr

    GMC Member

  • New Member
  • 21 posts

Posted 03 May 2011 - 11:19 AM

Alright, I support imaginary numbers, but...

Where do you think you'd mark the ghostly number i on your ruler? You know it isn't the same as 1 or -1, and you can't even mark it at 0 because 0x0=0.
Posted Image
In the same way that ghosts float and can walk through walls without touching them, the number i floats above the ruler without touching it!


Quoted from 'Murderous Maths: Numbers, The Key to the Universe' page 185 & 186.
And a lol quote from page 185:

i might be imaginary, but like any self-respecting ghost, it exists!


  • 1

#68 MasterOfKings

MasterOfKings

    The True Master

  • GMC Member
  • 4888 posts
  • Version:GM8

Posted 05 May 2011 - 12:37 AM

It's easy to draw. Just draw a normal square. Draw a CCW circular arrow for positive orientation, and a CW circular arrow for negative orientation.

I meant draw it in real-world space. Yes, I know you can have a square of sides -1 and -1. But that is only mathematically. Nothing in this world has a negative length (or am I missing something?)

-MoK
  • 0

#69 makerofthegames

makerofthegames

    TV's busboy

  • GMC Member
  • 7299 posts
  • Version:GM:Studio

Posted 05 May 2011 - 03:09 PM

Your point is odd, negative numbers aren't only imaginary, they're part of the reals as well...
Unless you're saying something I don't get?
  • 0

#70 xshortguy

xshortguy

    GMC Member

  • Global Moderators
  • 4186 posts
  • Version:GM:Studio

Posted 06 May 2011 - 01:24 AM

I meant draw it in real-world space. Yes, I know you can have a square of sides -1 and -1. But that is only mathematically. Nothing in this world has a negative length (or am I missing something?)

-MoK


A square with sides of -1 and -1 would have an area of 1. The negativeness comes from the fact that you're orienting the areas, in the same sense that vectors are thought of as oriented arrows.
  • 0

#71 No Eyed Fsh

No Eyed Fsh

    GMC Member

  • New Member
  • 24 posts

Posted 20 September 2011 - 02:00 AM

Okaayy, this is way over my head.

So, from what I've vaguely understood from this thread, is that you guys are trying to figure out the square root of a negative number. Which is impossible, because a negative times a negative is a positive, a postitive times a positive is also a positive, and 0 * 0 is 0.

So you use an imaginary number (i) instead. Is that right?
  • 0

#72 xshortguy

xshortguy

    GMC Member

  • Global Moderators
  • 4186 posts
  • Version:GM:Studio

Posted 20 September 2011 - 03:13 AM

Okaayy, this is way over my head.

So, from what I've vaguely understood from this thread, is that you guys are trying to figure out the square root of a negative number. Which is impossible, because a negative times a negative is a positive, a postitive times a positive is also a positive, and 0 * 0 is 0.

So you use an imaginary number (i) instead. Is that right?


One can formally define complex numbers using only ordered pairs of real numbers:

Let (a, B) be a pair of numbers, and define two operations + and * on these pair of numbers as follows:
(a, B) + (c, d) = (a + c, b + d)
(a, B) * (c, d) = (ac - bd, ad + bc)

Observe then that
(a, 0) * (b, 0) = (ab, 0)
(a, 0) * (0, 1) = (0, a)
(0, 1) * (0, 1) = (-1, 0)

The first observation shows that numbers of the form (x, 0) behave the same way as real numbers.
The second observation shows that multiplication a number (a, 0) by the number (0, 1) makes transfers the number a to the second argument.
The last observation can be looked at in the following way: the ordered pair (0, 1) squared is (-1, 0)

We can rewrite these ordered pairs in a more compact way, and call (0, 1) = i, (a, 0) = a.
Then (a, 0) + (b, 0)(0, 1) = (a, 0) + (0, B) = (a, B) = a + b i

So there's no need of worrying about taking a "square root" of a negative number this way, for we have a mechanism for that.
  • 0

#73 chance

chance

    GMC Member

  • Reviewer
  • 5765 posts
  • Version:GM:Studio

Posted 20 September 2011 - 04:13 PM

Okaayy, this is way over my head.

Probably should've stopped there... :wink: ...and instead, visited a math site that explains imaginary numbers and their relationship with real numbers.

I propose another class of numbers, known as "GMC numbers". They're useful for describing such things as:

- the number of GMC posts containing complete made up crap.
- the number of times GMC members ask if their games are copyrighted.
- the number of topics asking if GameMaker is professional or not.

Interestingly, "GMC numbers" are related to imaginary numbers. In fact, the upper-bound on GMC numbers is itself an imaginary number.
  • 0

#74 paul23

paul23

    GMC Member

  • Global Moderators
  • 3355 posts
  • Version:GM8

Posted 20 September 2011 - 10:50 PM

Okaayy, this is way over my head.

So, from what I've vaguely understood from this thread, is that you guys are trying to figure out the square root of a negative number. Which is impossible, because a negative times a negative is a positive, a postitive times a positive is also a positive, and 0 * 0 is 0.

So you use an imaginary number (i) instead. Is that right?


One can formally define complex numbers using only ordered pairs of real numbers:

Let (a, B) be a pair of numbers, and define two operations + and * on these pair of numbers as follows:
(a, B) + (c, d) = (a + c, b + d)
(a, B) * (c, d) = (ac - bd, ad + bc)

Observe then that
(a, 0) * (b, 0) = (ab, 0)
(a, 0) * (0, 1) = (0, a)
(0, 1) * (0, 1) = (-1, 0)

The first observation shows that numbers of the form (x, 0) behave the same way as real numbers.
The second observation shows that multiplication a number (a, 0) by the number (0, 1) makes transfers the number a to the second argument.
The last observation can be looked at in the following way: the ordered pair (0, 1) squared is (-1, 0)

We can rewrite these ordered pairs in a more compact way, and call (0, 1) = i, (a, 0) = a.
Then (a, 0) + (b, 0)(0, 1) = (a, 0) + (0, B) = (a, B) = a + b i

So there's no need of worrying about taking a "square root" of a negative number this way, for we have a mechanism for that.

:blink:
Way to describe a simplistic tool in the most difficult to understand manner, you can always trust mathematicans on that! :P


Simple answer I'd take is "yes, that's a good entry point to think about imaginary numbers".
  • 0

#75 xshortguy

xshortguy

    GMC Member

  • Global Moderators
  • 4186 posts
  • Version:GM:Studio

Posted 20 September 2011 - 11:06 PM

Way to describe a simplistic tool in the most difficult to understand manner, you can always trust mathematicans on that! :P


Simple answer I'd take is "yes, that's a good entry point to think about imaginary numbers".


It's actually one of the most natural constructions of the complex numbers; in fact a similar procedure is used to construct the integers from the natural numbers, the rational numbers from the integers, vector spaces from real numbers, and more.

Thinking of i is simply the square root of -1 and then forming a sum of a + b i is confusing in many different manners, namely his problem with taking the square root of one. Arbitrarily defining things is never a good approach to mathematics.

For example, I could arbitrarily define a function as follows:

I want a function f(x) that has the following properties

f(x + y) = f(x) + f(y)
f(0) = 1

Sounds reasonable up to this point, it preserves the structure of addition, and maps 0 to 1.

Then 1 = f(0) = f(0 + 0) = f(0) + f(0) = 2

So even with a simple restrictions above, I created a function that is automatically nonsensical. This function only works if every number is equal to 0.

However if I make a function like this:
f(x + y) = f(x) f(y)
f(0) = 1

Then I have a function that easily satisfies this property: the exponential function.
  • 0

#76 chance

chance

    GMC Member

  • Reviewer
  • 5765 posts
  • Version:GM:Studio

Posted 21 September 2011 - 12:51 AM

The first observation shows that numbers of the form (x, 0) behave the same way as real numbers.
The second observation shows that multiplication a number (a, 0) by the number (0, 1) makes transfers the number a to the second argument.
The last observation can be looked at in the following way: the ordered pair (0, 1) squared is (-1, 0)

This is hysterical. @xshortguy: you're talking to someone who began his question with:

"Okaayy, this is way over my head."

Remember? :wink:
  • 0

#77 xshortguy

xshortguy

    GMC Member

  • Global Moderators
  • 4186 posts
  • Version:GM:Studio

Posted 21 September 2011 - 02:19 AM

Looking at the construction of how the complex numbers could be constructed from the reals will only make him taller, so it won't be over his head any more.
  • 1

#78 MasterOfKings

MasterOfKings

    The True Master

  • GMC Member
  • 4888 posts
  • Version:GM8

Posted 02 December 2011 - 02:04 PM

Real, string, float, double, boole are default data types

It's named after Boole, but not called Boole. It's Boolean.

That is all.
  • 0

#79 DanRedux

DanRedux

    GMC Member

  • GMC Member
  • 1332 posts
  • Version:GM:Studio

Posted 03 December 2011 - 02:48 AM

I'm with Sabriath in saying that, i is useful to some, but not useful to Game Design. I will continue to agree with him until you give me one real example of how it would at all be useful in GM.

Remember, the argument about 3D rotations is moot, no one in their right mind would try and make a 3d physics engine in GM.
  • 0

#80 chance

chance

    GMC Member

  • Reviewer
  • 5765 posts
  • Version:GM:Studio

Posted 03 December 2011 - 01:08 PM

I'm with Sabriath in saying that, i is useful to some, but not useful to Game Design. I will continue to agree with him until you give me one real example of how it would at all be useful in GM.

Remember, the argument about 3D rotations is moot, no one in their right mind would try and make a 3d physics engine in GM.

Are you arguing about their use in games design? Or just their use in GM?

If they're useful for 3D rotations in game design, then they're useful -- period. Whether or not you'd use them in GM is irrelevant.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users