Imaginary Numbers

120 replies to this topic

#101 sabriath

sabriath

12013

• GMC Member
• 3147 posts

Posted 07 December 2011 - 12:08 AM

...the thought I was having about built-in imaginary numbers is that computers cannot do imaginary numbers anyway.

Computers calculate complex numbers the same way humans do. Complex numbers are just ordered pairs of real numbers, with certain algebraic rules about using them. Computers handle them the same way they handle reals.

Though I find it quite simplistic saying "Computers calculate complex numbers the same way humans do". That statement shoots past the whole application of complex numbers: to solve calculations.

How is it "simplistic? I'm not talking about applications. I'm talking about calculations, i.e., complex number arithmetic. My point to sabriath is that computers perform that arithmetic using real numbers -- just like humans do.

Exactly what I said....

"There are ways to calculate in the 'imaginary plane' using real numbers"

Meaning that using vectors and algorithms with those vectors, you can perform the actions of "imaginary space" through the real. And as I stated, this added method of doing things causes you to pour milk into a glass before a bowl because a drawing surface has X and Y....those aren't imaginary, so a transformation has to occur first. I did a small run with 3D a few months ago and have learned of the ease these transformation calculations have on rotations and such, but it still requires at lest 2 or 3 of them in order to account for the final calculation needed to get to X/Y space...meaning a static model doesn't need it.
• 0

#102 chance

chance

GMC Member

• Reviewer
• 5758 posts
• Version:GM:Studio

Posted 07 December 2011 - 12:44 AM

Exactly what I said....

"There are ways to calculate in the 'imaginary plane' using real numbers"

Meaning that using vectors and algorithms with those vectors, you can perform the actions of "imaginary space" through the real. And as I stated, this added method of doing things causes you to pour milk into a glass before a bowl because a drawing surface has X and Y....those aren't imaginary, so a transformation has to occur first.

You keep describing this as an "extra step". How else can one calculate "imaginary numbers", except by using reals?

Please explain how a machine, or a human, could calculate complex numbers any other way?
• 0

#103 Yourself

Yourself

The Ultimate Pronoun

• Retired Staff
• 7341 posts
• Version:Unknown

Posted 07 December 2011 - 05:39 AM

Please explain how a machine, or a human, could calculate complex numbers any other way?

They can't. They can't even compute using reals, either, they have to pick some digital representation of some subset of the rationals and then define the operations on the rationals in terms of Boolean operations on these digital representations.

So, yeah, this whole argument that there isn't a "direct" method of computation is totally ridiculous. Every done arithmetic by hand? Notice how you have to do it in small parts (usually by digit) rather than all at once? Eventually it always boils down into what amounts to a look-up table. Boolean operations? Defined by truth tables. Addition in base 10? You essentially memorize the sums of single digits. Multiplication? Same thing, why do you think they taught you multiplication tables? Because the basis of these algorithms always boils down to a look-up table. In the case of computers all the computational tools are built up from a few simple logical operations.

this added method of doing things causes you to pour milk into a glass before a bowl

It's absolutely nothing like that because it paints that intermediate step as somehow unnecessary. It's not unnecessary, it's unavoidable.

but it still requires at lest 2 or 3 of them in order to account for the final calculation needed to get to X/Y space...meaning a static model doesn't need it.

This is just stupid. The reason complex numbers are used as a representation for this is because they simplify some set of operations. In the case of quaternions, it vastly simplifies dealing with 3D rotations. Of course it requires a transformation, but every method of representing 3D orientation requires some kind of transformation. This should be obvious. Computers can't technically compute directly with matrices, either, those have to be "transformed" into sets of reals and then the basic operations defined on reals have to be applied. You can't compute directly with Euler angles, at some point they have to be passed through trig functions.

Of course this doesn't begin to address why you'd be setting up rotations for a static model in the first place.
• 1

#104 sabriath

sabriath

12013

• GMC Member
• 3147 posts

Posted 07 December 2011 - 11:37 AM

You keep describing this as an "extra step". How else can one calculate "imaginary numbers", except by using reals?

Please explain how a machine, or a human, could calculate complex numbers any other way?

That was exactly my point. xshortguy wrote it best in his vector post (#72), whereby he showed with reals how to make the imaginary number relationship. If you noticed, I stopped blathering after that point because I found that post "good enough." The only complaint I have is mainly people taking my crap out of context and not reading anything I actually type...it's hard enough for me to describe things as it stands, but any slip up and I get crapped on like I'm a \$10 trick.

Oh, and by the way, "use of complex numbers" from what I can tell that EVERYONE seems to be arguing for, is merely "use of vector math." There is a small difference which is probably why I was having a hard time understanding at first...but now I see clearly that that small difference was the words "complex" and "vector" being used separately when they should have just been used interchangably in this situation. I'm all for vector math, let's just call it that from now on to make it simple for us simple folk who cannot grasp the concept of using the all-common for-iterator variable 'i' in equations.

It's absolutely nothing like that because it paints that intermediate step as somehow unnecessary. It's not unnecessary, it's unavoidable.

I'm not painting that type of picture...have you seen how small the hole is in a jug of milk compared to a glass? Having a full jug and a full glass, I am positive the glass will fill at least twice as many bowls than the jug would in the same time frame. As for avoidability, I still didn't use "quaternions" or even vectors in my 3D stuff, unless you call these quaternions/vectors:

```xt = myx + lengthdir_x(1, lookangle1);
yt = myy + lengthdir_y(1, lookangle1);

For rotations, I could use a matrix transformation and then reduce the formula so that I get a simplistic x/y/z set, which avoids vectors yet again. I'm new when it comes to this type of 3D (I worked with raytracing in my youth), so maybe I'm doing it horribly wrong, but as far as I can see, the algorithms are as compact as I can get them (except I should be using the trig forms of "lengthdir" directly, but it's easier for me to read the way I have it).

Of course it requires a transformation, but every method of representing 3D orientation requires some kind of transformation

And a matrix representation can be trimmed down....this might be yet another reason I find this topic so difficult to grasp because with all of my code, I actually optimize it. Multiplying by the zeros in a matrix can just be ignored, so the rotations end up being a trig function, a multiply and an addition usually....maybe that's quaternion, I don't know, nor do I care. I'm going back to ignoring this, I'd appreciate not getting slammed, thanks.
• 0

#105 chance

chance

GMC Member

• Reviewer
• 5758 posts
• Version:GM:Studio

Posted 07 December 2011 - 12:21 PM

You keep describing this as an "extra step". How else can one calculate "imaginary numbers", except by using reals?

Please explain how a machine, or a human, could calculate complex numbers any other way?

That was exactly my point.
...
The only complaint I have is mainly people taking my crap out of context and not reading anything I actually type...

sabriath, I'm not trying to twist your words. But often, it seems like when someone refutes your claims with a better argument, you adopt that better argument and say "yes, that's what I meant".

I guess we have a communication problem. Anyway, glad to see we agree now.
• 0

#106 makerofthegames

makerofthegames

TV's busboy

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

Posted 07 December 2011 - 03:40 PM

But if there isn't an argument, what use is this topic anymore!?

...Anyone up for quantum physics?
• 0

#107 loverock125

loverock125

GMC Member

• GMC Member
• 1596 posts
• Version:GM8

Posted 07 December 2011 - 06:18 PM

I'm not really good at maths, but what I don't get is how can you calculate the square root of a negative number? I mean, even if it's called an imaginary number, the square root of a number a is number b such as b^2 = a. For negative numbers obviously there is not such answer so I can't see why Game Maker should introduce imaginary/complex numbers since you can use something else. Using math or calculators you cannot do that, hence they use complex numbers. No reason for Game Maker to have imaginary/complex numbers because the solution is very simple actually.

Spoiler

Besides, how would you use complex numbers in a game-making platform? Eventually you will have to convert them to real numbers.

In math the complex numbers are used to affect following equations (In order for them to be accurate, they can't be used directly, you can't say the x position of an object is at SQRT(-1)). In Game Maker, you can easily do this using the solution in the spoiler.

Edited by loverock125, 07 December 2011 - 06:29 PM.

• 0

#108 chance

chance

GMC Member

• Reviewer
• 5758 posts
• Version:GM:Studio

Posted 07 December 2011 - 08:51 PM

I'm not really good at maths, but what I don't get is how can you calculate the square root of a negative number?

Here's how:

Take two identical idiots. Let them work together. Their progress will be less than zero, i.e., Negative!

So each idiot's knowledge is the square-root of a negative number. See how it works?

Seriously, if your understanding is this limited, you really shouldn't post here. Just read the topic and learn.

But if there isn't an argument, what use is this topic anymore!?

You tell me. Why did you post here, if you have no use for it?

Personally, I'm waiting for someone to invent a fun GM application involving complex numbers.

.

Edited by chance, 07 December 2011 - 09:32 PM.

• 0

#109 loverock125

loverock125

GMC Member

• GMC Member
• 1596 posts
• Version:GM8

Posted 07 December 2011 - 10:25 PM

Here's how:

Take two identical idiots. Let them work together. Their progress will be less than zero, i.e., Negative!

So each idiot's knowledge is the square-root of a negative number. See how it works?

I must say I find your topic a bit offensive, especially for a Reviewer.

Nevertheless, your example doesn't answer anything to what I have said in the previous post. I know what a negative number is, I'm starting to believe that you didn't really read my post or you were just being sarcastic and calling me an idiot. Of course, I may be wrong. The square root of a negative number doesn't exist. That is why it is called imaginary, it is not used the way as in your example.

Edit: Just because you don't seem to understand something, this is educational: Imaginary numbers CANNOT be used in real-life examples; only in Math.

Seriously, if your understanding is this limited, you really shouldn't post here. Just read the topic and learn.

Like I said, my understanding is not that limited, you just didn't understand/read my post. This is the 'Programming and Mathematics Discussion' sub-forum, I believe it's not against the rules to post here since I am discussing.

Personally, I'm waiting for someone to invent a fun GM application involving complex numbers.

If someone ever invents a GM application involving complex numbers and I am alive by then, please send me a link to your game. I am SO curious to see where you are going to use them (efficiently).

Good luck!

Educational: Complex numbers are frequently used in electronics as they help in analysing signals.

Edited by loverock125, 07 December 2011 - 10:59 PM.

• 0

#110 TheSnidr

TheSnidr

That guy

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

Posted 07 December 2011 - 10:53 PM

Personally, I'm waiting for someone to invent a fun GM application involving complex numbers.

If someone ever invents a GM application involving complex numbers and I am alive by then, please send me a link to your game. I am SO curious to see where you are going to use them (efficiently).

What do you mean, as in something made in GM that uses complex numbers? Am I the only one thinking quaternions? They're extensions of the complex plane

Edited by TheSnidr, 07 December 2011 - 10:53 PM.

• 0

#111 loverock125

loverock125

GMC Member

• GMC Member
• 1596 posts
• Version:GM8

Posted 07 December 2011 - 11:21 PM

Personally, I'm waiting for someone to invent a fun GM application involving complex numbers.

If someone ever invents a GM application involving complex numbers and I am alive by then, please send me a link to your game. I am SO curious to see where you are going to use them (efficiently).

What do you mean, as in something made in GM that uses complex numbers? Am I the only one thinking quaternions? They're extensions of the complex plane

You already can use quaternions in Game Maker, but would Game Maker need an imaginary number data type? They are essential to Mathematics but I don't think it's very reasonable for YoYo Games to include them.

Edit: Quaternions are actually very useful for 3D Graphics but then again, there are alternative ways to get the similar effect (in graphics that is, not math). What is the connection between the user and the game? The screen displays images. As long as you can display those images (even faster than using 'correct' complicated math) you built yourself a game.

Edited by loverock125, 07 December 2011 - 11:36 PM.

• 0

#112 sabriath

sabriath

12013

• GMC Member
• 3147 posts

Posted 07 December 2011 - 11:54 PM

sabriath, I'm not trying to twist your words. But often, it seems like when someone refutes your claims with a better argument, you adopt that better argument and say "yes, that's what I meant".

Both you and NPT think this, and yet when I copypasta my posts to show that the ideas never changed, it would seem like the argument tends to bend toward my views rather than my views bending toward it. I even went back and showed what I said and people still think I'm just trolling....but it's mainly my fault because I have extremely bad miscommunication, my apologies.

But it seems that someone else has entered the furrow...

loverock125: I understand what you are saying, it was my viewpoint from the beginning as well....because "i" cannot exist in a computer architecture unless it is programmed to be parsed in such a way that it leads to 2 values noting it (called the complex pair, iirc), but parsing the 'i' form makes the architecture lose out on a variable. Instead these 2 values can be seen as a vector and if you go back to post #72 of this topic, xshortguy shows how to perform the math for square rooting a negative using the vector. A vector is pretty much what everyone is suggesting that GM add, not the 'i' symbol form of notation. Just because it is called "imaginary," doesn't mean it is nonexistent....just needs to be done in a different way.

Ok, seriously, let this topic die now, lol. Merry Christmas everyone by the way, and if you don't celebrate it, too bad for you.
• 0

#113 chance

chance

GMC Member

• Reviewer
• 5758 posts
• Version:GM:Studio

Posted 08 December 2011 - 02:00 AM

Imaginary numbers CANNOT be used in real-life examples; only in Math.

Ignorance is forgivable. Ignorance with over-confidence deserves ridicule.

Read my post #100 for some examples of complex numbers (with imaginary components). These are real life examples of physical things you can see and measure.

What's next? Pi = 3... because irrational numbers aren't "useful"? lol...

If someone ever invents a GM application involving complex numbers and I am alive by then, please send me a link to your game. I am SO curious to see where you are going to use them (efficiently).

Ever see any Mandelbrot art? That can be made in GM. And it depends on complex/imaginary numbers.

Edited by chance, 08 December 2011 - 02:08 AM.

• 0

#114 loverock125

loverock125

GMC Member

• GMC Member
• 1596 posts
• Version:GM8

Posted 08 December 2011 - 02:43 AM

Ignorance is forgivable. Ignorance with over-confidence deserves ridicule.

Read my post #100 for some examples of complex numbers (with imaginary components). These are real life examples of physical things you can see and measure.

What's next? Pi = 3... because irrational numbers aren't "useful"? lol...

Again, I find your post a bit offensive. We're just discussing, you don't need to be offensive, although I'm old enough to know what's over the internet. Anyway,

I know that math exist in real-life but that's not what I meant. That's math, numbers; that's why I said imaginary numbers only exist in Math. I even said that complex numbers are frequently used in electronics as they help in analysing signals.

These are real life examples of physical things you can see and measure.

Are you serious? That's the 'No point discussing' label over there.

If someone ever invents a GM application involving complex numbers and I am alive by then, please send me a link to your game. I am SO curious to see where you are going to use them (efficiently).
Ever see any Mandelbrot art? That can be made in GM. And it depends on complex/imaginary numbers.

I don't know about Mandelbrot and I don't have much time to do some research now. Of course it can be done in GM or any other similar programming software; even without complex/imaginary numbers. I really can't see what you don't understand. Imaginary numbers only exist in math. I never said they cannot be used.

...but then again, there are alternative ways to get the similar effect (in graphics that is, not math)...

Edit: By the way, in case you didn't notice you supported my own argument:

Ever see any Mandelbrot art? That can be made in GM. And it depends on complex/imaginary numbers.

Edited by loverock125, 08 December 2011 - 02:53 AM.

• 0

#115 Yourself

Yourself

The Ultimate Pronoun

• Retired Staff
• 7341 posts
• Version:Unknown

Posted 08 December 2011 - 06:45 AM

Multiplying by the zeros in a matrix can just be ignored, so the rotations end up being a trig function, a multiply and an addition usually....maybe that's quaternion

It isn't. If you're using basic rotations about axes you're using a type of Euler angle representation of orientation, which suffers from singularities depending on your choice of axes (and the singularities are unavoidable). Quaternions represent the space of 3D rotations elegantly and without singularities. The actual number of operations needed to compute a quaternion multiplication is less than the number required to compute a matrix multiplication, so they're computationally less expensive for composite rotations than matrices.

Additionally, it's easier to deal with numerical rounding with quaternions since you need only normalize it. In order to deal with rounding problems with matrices, you have to go through a rather complex process of orthogonalization, otherwise your matrix will gradually degrade into a matrix that no longer represents a pure rotation.

One shortcoming is that it's more expensive to actually transform a vector by a rotation represented as a quaternion, however for many transformations one could simply convert the quaternion into a matrix and perform the transformations using the matrix, this gives the benefits of both representations.

Quaternions also simplify the dynamics of rotation making it actually quite cheap and simple to have an object rotating about an arbitrary axis (or a changing arbitrary axis). In fact, given the angular velocity of an object as a vector, the rate of change of its orientation quaternion is simply one half the product of its current orientation and its angular velocity (expressed as the vector component of a quaternion). The matrix version is similar, but with it comes the problems of orthogonality and the relative expense of computing a matrix product.

That's math, numbers; that's why I said imaginary numbers only exist in Math.

Rational numbers only exist in math.

I even said that complex numbers are frequently used in electronics as they help in analysing signals.

They're also used in quantum mechanics and control theory. The founding equations of quantum mechanics are, in fact, complex-valued, because complex numbers are more generic than real numbers (naturally since the complex numbers contain the real numbers).

but then again, there are alternative ways to get the similar effect (in graphics that is, not math)...

Yeah, and those "ways" come with their own set of undesirable problems. Like gimbal lock (arising from singularities in the particular parameterization of the space of rotations), or more subtle issues like maintaining the orthogonality of a rotation matrix, or the fact that multiplying matrices is more computationally expensive than multiplying quaternions.

And computer graphics is pretty much entirely a subset of mathematics. Primarily linear algebra.
• 0

#116 chance

chance

GMC Member

• Reviewer
• 5758 posts
• Version:GM:Studio

Posted 08 December 2011 - 12:09 PM

Again, I find your post a bit offensive. We're just discussing, you don't need to be offensive, although I'm old enough to know what's over the internet. Anyway,

I know that math exist in real-life but that's not what I meant. That's math, numbers; that's why I said imaginary numbers only exist in Math.

I'm not trying to insult you. But your distinction between math and "real life" is funny.

But in a sense you're right. In fact, most things we call "real life" are just mathematical abstractions. Points, lines, circles, linear behavior, etc. We're just more familiar with some abstractions than others, so they seem more "real".

In my view, any mathematical abstraction we use to describe the world is just as "real" -- or unreal -- as any other. That why drawing a distinction with imaginary numbers is funny to me.

It's the same in physics. Students seem baffled by "action at a distance" between particles. They say it's unfamiliar -- unlike when they rap their knuckles on the table. That seems "familiar" to them... although it's still action at a distance.
• 0

#117 sabriath

sabriath

12013

• GMC Member
• 3147 posts

Posted 08 December 2011 - 02:40 PM

Imaginary numbers only exist in math

I was trying to soften the blow that others might have given you since you were as brash as I was....but I cannot defend a statement like that. It is as if you insist that "math" is some form of thought experiment that cannot and does not apply to things like computers, programming and games. If "imaginary numbers only exist in math" and math exists in games, then imaginary numbers can and does exist in games.

I am openly admitting I was wrong with the way I handled this topic, and I'm far from an expert when it comes to being able to mock someone, but you make it very difficult for me. I suggest you please go read the post by xshortguy, seriously, it makes all the sense in the world if you know anything about 3D programming....and if you don't, then you probably shouldn't even be in this topic.

Oh, and by the way, you cannot make a mandelbrot set without the imaginary space. That's like trying to turn on your TV with a blunderbuss at 20 paces blindfolded....good luck with that.

@Yourself: Thanks for clarifying...maybe someday I'll use quaternions, but I'm not doing any rigidbody or anything overly complicated at the moment to need it in my opinion.
• 0

#118 Digisynth

Digisynth

GMC Member

• Validating
• 55 posts

Posted 22 March 2012 - 08:51 PM

This should do:

This code returns the number as a string:
```//ipower(number,power);
if argument0<0
{
return string(power(-argument0,argument1)+"i")
}
else
{
return string(power(-argument0,argument1))
}
```

This code indicates if the string from the first function is imaginary:
```//isnumberi(string from first function);

if string_pos("i",argument0)=0
{
return false
}
else
{
return true
}
```

And finally, this function returns the value of any real/imaginary number:
```//getvalue(number,power);

if argument0<0
{
return power(-argument0,argument1)
}
else
{
return power(-argument0,argument1)
}
```

I didn't check the functions jet, but they should work.

#119 Digisynth

Digisynth

GMC Member

• Validating
• 55 posts

Posted 22 March 2012 - 08:59 PM

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.

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!

It is on the other side of the ruler.

#120 roytheshort

roytheshort

Wind Up Merchant

• GMC Member
• 344 posts
• Version:GM8

Posted 01 June 2012 - 09:44 PM

Just to end two arguments, I'll just post this stuff here. Also, for the sake of it, my post now has a novelty numbering system.

2i) Imaginary Numbers do not have real world applications.

Wrong. Complex numbers are fundamental to physics. For example, Momentum functions with no real roots and
Quantum Mechanics. You can read more here.

1+i) Imaginary numbers don't exist.

They exist as much as any other number does. Without them there wouldn't be solutions to (Sinθ) = 2 or (-1)^0.5. To just deny the existance of numbers would be as naive as what the ancient greeks did for denying the existance of the square root of two. What happened? Hippasus was thrown into a river and drowned because the idea that it existed was so controversial.

1.09868411 + 0.455089861i) Imaginary numbers can't be represented on calculators.

These calculators exist and cope just fine with it.

Edited by roytheshort, 01 June 2012 - 09:45 PM.

• 0

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users