Imaginary Numbers
#1
Posted 10 March 2011 - 06:02 PM
#2
Posted 10 March 2011 - 06:07 PM
#3
Posted 10 March 2011 - 06:14 PM
#4
Posted 10 March 2011 - 06:17 PM
Also I don't know of any programming languate that natively supports complex numbers. Real, string, float, double, boole are default data types, I have never seen "complex" as a data type. This is to be expected, since a complex number is essentially a vector with two coordinates (the real and the imaginary part), following a few special rules of arithmetic (the multiplication rule in particular). So to emulate complex numbers all you have to do is work with vectors of size two, and define the multiplication rule and the and nth power root rule for those.
In GM this can be done with lists. I don't see exactly what's wrong with writing your own algorithms for complex numbers that work on lists of size two.
Edited by Erik Leppen, 10 March 2011 - 06:18 PM.
#5
Posted 10 March 2011 - 06:31 PM
I mean, sqrt(9) results in 3. (Because 3 x 3 = 9)
But, sqrt(-9) also results in 3, that's because -3 x -3 = 9.
Anaway, complex numbers indeed work a different way...
Maybe check out Wikipedia for that, maybe there's an alternative way of calculating it
EDIT: Typo...
-RefluxLtd
Edited by Reflux Entertainment, 10 March 2011 - 06:34 PM.
#7
Posted 10 March 2011 - 09:23 PM
Matlab does, as does G/labview. However an imaginary number can actually be considered a simple vector with 2 components. Hence it is already in the suggestion/update list. (Adding the ability to create structures would enable this). Now only if we could overload functions (and operators) complex numbers would be as easy to use as real numbers. - The suggestion to use lists is pretty bad, it works but is very annoying to use (heck one can't even add lists and expect a simple vector addition). And because it is difficult to use it's error prone.What were you planning to use it for?
Also I don't know of any programming languate that natively supports complex numbers. Real, string, float, double, boole are default data types, I have never seen "complex" as a data type. This is to be expected, since a complex number is essentially a vector with two coordinates (the real and the imaginary part), following a few special rules of arithmetic (the multiplication rule in particular). So to emulate complex numbers all you have to do is work with vectors of size two, and define the multiplication rule and the and nth power root rule for those.
In GM this can be done with lists. I don't see exactly what's wrong with writing your own algorithms for complex numbers that work on lists of size two.
However for the calculations complex numbers DO help, and they should be considered a datatype just like "integers" and "floats" and "strings" are different datatypes.
@RE: you're wrong
#8
Posted 11 March 2011 - 01:24 AM
#9
Posted 11 March 2011 - 02:54 AM
Well, aside from a program devoted to solving equations, what purpose would it serve? You can only plot real numbers on a 2D graph, and in the end, that's essentially all Game Maker is supposed to do. I can't think of any conceivable purpose 'i' would have in an ordinary game. Perhaps I'm just narrow-minded?
Compare the following:
In other words, planar rotations can be thought of as multiplication of complex numbers. In particular, if a complex number has a magnitude of one, then it corresponds strictly to a rotation in the complex plane.
#10
Posted 11 March 2011 - 08:52 PM
In order to impliment it, Mark would have had to recreate that function. Given that imaginary numbers is not in large demand for a game creation tool, then it wasn't worth it.
The same can't be said for your calculator, where the ability to use imaginary numbers is in demand.
#11
Posted 20 March 2011 - 02:01 AM
But, ask yourself; in GM, a program designed and built to make simple 2D games, why would it need to understand the square root of -1? How many games would need it?
-MoK
#12
Posted 20 March 2011 - 02:56 AM
If put into common practice, 2D games can benefit from complex numbers.But, ask yourself; in GM, a program designed and built to make simple 2D games, why would it need to understand the square root of -1? How many games would need it?
Complex numbers have applications in 2D geometry. Both the distance between two points and the angle from one point to another have elegant representations if the points are given as complex numbers. And as xshortguy has demonstrated, rotations work well with complex numbers.
You can also treat this as coupling x and y into one variable, allowing for easy storage in variables and use in various functions. Instead of putting in the coordinates as two arguments in a function, we can have the x coordinate as the real component and the y coordinate as the imaginary part, taking up one argument space. Now, search through the manual for functions that take coordinate values as arguments --- you can see that some of the arguments take up a lot of room.
If complex numbers are to be implemented into GM, I expect quaternions to be too --- they function in similar ways compared to complex numbers (except with two more components, j and k, whereas i^2 = j^2 = k^2 = ijk = -1). They greatly simplify coordinates used in 3D, especially with regard to rotations. And let's not forget how many argument spaces it would save for d3d_*() functions.
GameGeisha
#13
Posted 20 March 2011 - 07:37 AM
GM understands strings and reals. Imaginary numbers don't properly exist; as any two numbers of the same type (positive or negative) will never be negative. 'i' was introduced as to allow mathematicians overcome this.
What? Imaginary numbers exist just as much as any other type of number. They come up because real numbers aren't "complete" in the sense that a polynomial with real coefficients may not have any real roots. With complex numbers this is not the case. A polynomial with complex coefficients always has at least one complex root (and, in fact, counting multiplicity there are exactly n roots for an order n polynomial). They have a number of other useful properties which help them unify a lot of methods in mathematics. As others have mentioned they do serve some use for geometrical operations among other things.
That said, I don't really think they serve enough of a purpose to include them as a specialized type.
#14
Posted 21 March 2011 - 02:00 PM
Also if "structures" would be possible in gamemaker, we can start to effectivelly extend the number of "datatypes".
GM understands strings and reals. Imaginary numbers don't properly exist; as any two numbers of the same type (positive or negative) will never be negative. 'i' was introduced as to allow mathematicians overcome this.
What? Imaginary numbers exist just as much as any other type of number. They come up because real numbers aren't "complete" in the sense that a polynomial with real coefficients may not have any real roots. With complex numbers this is not the case. A polynomial with complex coefficients always has at least one complex root (and, in fact, counting multiplicity there are exactly n roots for an order n polynomial). They have a number of other useful properties which help them unify a lot of methods in mathematics. As others have mentioned they do serve some use for geometrical operations among other things.
That said, I don't really think they serve enough of a purpose to include them as a specialized type.
#15
Posted 21 March 2011 - 06:48 PM
Also if "structures" would be possible in gamemaker, we can start to effectivelly extend the number of "datatypes".
Without operator overloading (or function overloading) anything that has a well-defined arithmetic will be somewhat ugly to use, however.
#16
Posted 22 March 2011 - 05:28 AM
#17
Posted 22 March 2011 - 08:01 AM
Wait, what? So instead of using 2 variables (x and y) to denote position in cardinal space...you want to use...2 variables (real and imaginary) to denote position in an off-the-wall space. How is that any more efficient? I especially ask this because last I checked, the monitor can only take x/y cardinal position...so you would still have to convert whatever formula you had through an algorithm to get it.Instead of putting in the coordinates as two arguments in a function, we can have the x coordinate as the real component and the y coordinate as the imaginary part
xshortguy shows us a rotation using imaginary math...but you would still have to convert it into and out of the imaginary space. How is THAT efficient over using the normal dot products and such?
I'm sorry if I sound daft when it comes to the 'i' world...but wtf is it needed for exactly in game making (that other more efficient forms of keeping it in realistic space can provide)? I can see this being used to possibly show mandelbrot sets (or the like), but I don't see how that relates to gaming (unless you are doing a "where's waldo" for the mini-bulb game -- yeah, that'll be popular among the kids).
Awesome, so instead of 3 variables (x, y, z), you want 4 (r, i, j, k) or possibly more?If complex numbers are to be implemented into GM, I expect quaternions to be too
Only in the minds of those willing to believe they can square root a negative number. I think MoK was stating it more in a realistic sense, that imaginary numbers are not actually "tangable" but a way to reduce other forms of math by going through a somewhat wormhole (imaginary space). As far as I know, 'i' is not an integral part of any microprocessor, so any methods you want will have to be done in software anyway...TI may make it a point to do extensive software on advanced trig/calc/wtfever concepts for their calculator (because their target audience are those in need of them), but I seriously doubt YYG will put that much effort into a game making engine (which doesn't target the heavy math community directly).Imaginary numbers exist just as much as any other type of number
I mean, it made sense to me...but what do I know, I'm only a simpleton.
#18
Posted 22 March 2011 - 12:35 PM
In other words, in the minds of most educated people.Only in the minds of those willing to believe they can square root a negative number.Imaginary numbers exist just as much as any other type of number
Nor is pi, e, or the square root of 2. So what does that have to do with it?As far as I know, 'i' is not an integral part of any microprocessor
I'm not saying you're wrong about imaginary numbers not being critical for game making. But for god sakes, come up with some better arguments.
.
Edited by chance, 22 March 2011 - 12:36 PM.
#19
Posted 22 March 2011 - 01:34 PM
And, um.. no one knows the final digit of pi (or e), so how do you expect someone to pre-program it into a micro-processor.
Regardless, I'm not saying complex numbers shouldn't be included; but as most of people that use GM are kids who have never even heard of them; is it reasonable for YYG to include them?
-MoK
#20
Posted 22 March 2011 - 01:37 PM
"0" didn't exist in mathematics neither, or negative number at all for that matter..@chance: Well, the square root of -1 didn't exist in earlier mathematics. They didn't just sit down and go "Oh my, what shall we do now?"; they made 'i'. Just because I said they don't properly exist; doesn't mean I think they're a waste of time. To a computer, trying to actual square root a negative number is impossible. We know otherwise.
And, um.. no one knows the final digit of pi (or e), so how do you expect someone to pre-program it into a micro-processor.
Regardless, I'm not saying complex numbers shouldn't be included; but as most of people that use GM are kids who have never even heard of them; is it reasonable for YYG to include them?
-MoK
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











