# imaginary numbers

Show 80 post(s) from this thread on one page
Page 1 of 2 12 Last
• 04-15-2003
Gil22
imaginary numbers
what kind of variable would you use to represent these?
• 04-15-2003
7stud
an imaginary one?
• 04-15-2003
Gil22
is there a type of variable you could use to represent them? i dont really know a lot about imaginary numbers and i need to use them in a program i have to write
• 04-15-2003
*ClownPimp*
not that i can remember, but what is stopping you from creating your own class to represent imaginary numbers?
• 04-15-2003
Gil22
ok you got me.......i feel like an idiot but what exactly is an imaginary number?
• 04-15-2003
minesweeper
• 04-15-2003
*ClownPimp*
• 04-15-2003
Stoned_Coder
std::complex maybe?

For imaginary numbers only i suppose you could set the real part to zero. Ive only used i as part of a complex number never alone.
• 04-15-2003
JasonD
I think the proper way to think about it is that an imaginary number is a complex number that isn't a real number, so it is always a complex number, regardless if the real part of it is zero or not.

...edit...

maybe not, the FAQ above explains:

"Imaginary numbers are numbers that can be written as a real number times i."

"Complex numbers are numbers like 7 + .4i; they're a real number plus an imaginary number."
• 04-17-2003
Gil22
ok i get what imaginary numbers are now. i have to write a program that solves the quadratic formula and i need to include imaginary numbers in the program......what do these numbers have to do with solving the quadratic formula?
• 04-17-2003
Extol
Think of this. The square root of a negative number has to be imaginary. So
y=4a+3b+4 would be written.
Code:

```(-3(+/-)(sqrt((squared(3))-(4*4*4))))/(4*2) assume #define squared(x) x*x```
Use what you learned in those tutorials to figure out how you would evaluate the problem above.
• 04-17-2003
farruinn
The quadratic formula will tell you the two roots of the equation. For example, for the quadratic y = x^2 - 1, the graph would intersect the x-axis at -1 and 1. These are the roots. If the graph were y = x^2 + 1 on the other hand, there would be no real roots because the graph of the quadratic doesn't intersect the x-axis. In this case you would have two imaginary roots, -i and i. We get this from the quadratic formula:

-b +/- sqrt( b^2 -4(a)(c)) / 2a
=
+/- sqrt(-4) / 2 = +/- 2i / 2 = +/- i
(remember i is the sqrt(-1))

I'm a beginner at programming myself, so I don't know which header it is that has support for complex numbers, but this is why you would need them.

Extol: remember that in your example, 4, 3, and 4 are equal to a, b, and c. I believe you want x's where you have your a and b
• 04-17-2003
Gil22
so to declare an imaginary number......i could just do this right?

double i = sqrt(-1);
• 04-17-2003
Extol
Oh gosh. Yea, isn't it 4x^2+3x+4 even. I don't remember.
• 04-17-2003
Gil22
alright i think i actually need to use complex numbers......is therea way to declare these?
Show 80 post(s) from this thread on one page
Page 1 of 2 12 Last