Computers and Imaginary Numbers

Discussion in 'Computer Science & Culture' started by angslan, May 20, 2011.

Thread Status:
Not open for further replies.
  1. angslan Registered Senior Member

    Messages:
    16
    Helloo.

    I've been reading a Paul Davies book, and in it he suggests that human's ability to do maths is related to the physical structure of their brains and the physics of the universe in general - we can only understand maths as it is because we can only compute physically computable things, which is defined by the physics of the universe.

    So, obviously humans figured out a system that included a solution to the square root of minus one - the imaginary unit. When I use my old-fashioned calculator, it has no idea what I mean. Neither does Excel. It doesn't tell me, Yes there is a solution to the square root of minus one. It tells me, What? That's not maths.

    So I have two questions. Can computers solve the square root of minus one? And if they can't, why can't they when human minds can?
     
    Last edited: May 20, 2011
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. phlogistician Banned Banned

    Messages:
    10,342
    No, because it's not a number.

    We can't. We instead use a token, i as a placeholder for the result of that operator. When we later try to simplify, say, binomial expansions, it can save time, by eradicating terms.

    i pops up in a few places in mathematics, ie:

    \( e^{i\pi} = -1 \)

    If anything, it tells us that mathematics bears very little resemblance to the physical world.
     
  4. Google AdSense Guest Advertisement



    to hide all adverts.
  5. przyk squishy Valued Senior Member

    Messages:
    3,203
    MATLAB session:
    Code:
    >> sqrt(-1)
    
    ans =
    
            0 + 1.0000i
    
     
  6. Google AdSense Guest Advertisement



    to hide all adverts.
  7. mathman Valued Senior Member

    Messages:
    2,002
    Computer programs are written by people. If the program has been designed to understand the concept of the square root of -1, it can handle it, otherwise not.
     
  8. James R Just this guy, you know? Staff Member

    Messages:
    39,421
    It's more a matter of recognising that a system that doesn't include the square root of minus one is, in a sense, incomplete. So, you expand the system to handle what the old one couldn't.

    You can buy calculators that have no problem with taking the square root of negative numbers. Often, they have a special "complex number" mode or something. mathman is correct. Computers do what they are programmed to do. If they aren't programmed to add numbers, they won't do that any more than they'll take a square root when they aren't programmed to do that.
     
  9. AlphaNumeric Fully ionized Registered Senior Member

    Messages:
    6,702
    It comes down to an area of mathematics known as algebraic geometry and ring theory. What is the definition of i? It solves \(x^{2}+1 = 0\). This means that every time you see the combination \(i^{2}+1\) you can replace it with zero. It works for other algebraic numbers too. The square root of 2 solves \(x^{2}-2 = 0\) so every time you see \((\sqrt{2})^{2}-2\) you replace it with zero. What about something more complicated like the golden ratio. It satisfies \(x^{2}-x-1 = 0\) so every time you see \(\phi^{2}-\phi-1\) you replace it with zero. You could also use that to replace \(\phi^{2}\) with \(\phi+1\).

    This allows you to do more general calculus. For instance, there's a number, often defined as j, which solves \(j^{2}=1\) but isn't +1 or -1, it is 'something else'. It is not a complex number, it is an extension, into a new realm of numbers. But provided you know that every time you see the combination \(j^{2}-1\) you can replace it with zero you can do exactly the same sort of calculus you would with complex numbers.

    The mathematical software known as Singular is extremely good at these kind of concepts. You don't tell it "Work with the complex numbers", you tell it the ideals you want to define, ie you give it \(x^{2}+1\) to define i, or \(x^{2}-1\) to define j. If you give it \(\phi^{2}-\phi-1\) then although there is a real number, the golden ratio, which satisfies that it would not treat \(\phi\) as a number, ie if the golden ratio is about 1.6 then if you asked it for \(\phi+1\) it wouldn't return 2.6ish, just like asking what 1+i is doesn't give you anything other than 1+i.

    The nice thing about the complex numbers is that no matter what polynomial expression p(x) you give (provided coefficients are in the complex numbers) there is always a complex number which solves p(x)=0, its the fundamental theorem of algebra. This makes the complex numbers 'algebraicly closed', ie all algebraic numbers (those defined by said polynomials) are complex numbers.

    People think about i as if its something special but in reality its a particularly simple case of the much more general concept I just outlined. You know that when you see \(i^{2}\) you replace it with -1 but that's the same as doing the following : \(i^{2} = i^{2} + 0 = (i^{2} +1) - 1 = 0 - 1 = -1\). You're doing what I just explained a computer can do, setting \(i^{2}+1\) to zero.

    The entire realm of computational algebraic geometry and mathematics like Hilbert's Nullstellensatz, Groebner bases, ideals and varieties is devoted to algorithmic development of how to get a computer to take a HUGE expression and split it down into simpler things using such methods. For instance, if you tell a computer \(5x^{2} - 4x + 2 = 0\) and \(x^{20} - 3x^{7} + 5 = 0\) then you can get it to simplify \(x^{4049593} - 39539x^{390593} + 40205 x^{2142} - 5\) etc. It's easy to see how to do it in 1 variable but the methods work for any number of variables. I made us of them during my PhD, where I was trying to find common factors of 10 expressions in 12 variables, where the expressions were, I shit you not, 50 pages long if you printed them out. Singular ate them for breakfast!
     
  10. Dinosaur Rational Skeptic Valued Senior Member

    Messages:
    4,885
    My HP hand calculator does complex arithmetic.

    It is easy to program a decent computer to do complex arithmetic. I wrote a play program to solve for the roots of polynomials. Its only limits relate to time & memory.

    I have toyed with it for up to 50th order polynomials & do not know the order at which it would fail.

    After being given the order, it generates text boxes for input of the coefficients & pairs of labels for the roots.
     
  11. mathman Valued Senior Member

    Messages:
    2,002
    How can you be sure the solution is correct? From my experience (a long time ago) polynomials greater than 8th degree have problems with precision, even in double precision.
     
  12. Dinosaur Rational Skeptic Valued Senior Member

    Messages:
    4,885
    MathMan: There are likely to be some polynomials for which the precision of the roots is suspect.

    The first term in the derivative of a 50th order polynomial is 50*x[sup]49[/sup], which can be a huge number. The method I use computes derivatives in the vicinity of the roots. For certain polynomials, this can be a problem.

    Having mentioned the above, I have very good reason to trust the software.
    The hardware I am using provides about 16-17 decimal digits of precision.

    My program has an option to evaluate the polynomial. So far, this option has verified the calculated roots to 14-15 or more digits.

    For each polynomial solved, the program calculates the sum & the product of the roots it determines. If the coefficient of the highest order term is one, the sum of the roots is equal to the coefficient of the next term & the product of the roots is equal to the constant term. So far, this check has always agreed to to 14-15 or more digits.

    Polynomial evaluation uses the best numerical method. Ax[sup]3[/sup] + Bx[sup]2[/sup] + Cx + D is calculated as ((Ax + B)*x + C))*x + D This minimizes loss of precision.​
    While I expect some polynomials to cause precision problems, the program has so far seemed correct for up to order 50.

    The two checks described above (Root evaluation & sum/product of roots) make it almost certain that the program has no bugs.

    This is a play project for my amusment rather than a project I got paid for. Hence, I did not thoroughly analyze the possible pitfalls.

    There is no program logic to deal with polynomials with equal roots. Such a polynomial has a zero derivative at the multiple root. The derivative is used as a divisor in the method used. Even if a zero derivative is not encountered, some nearly zero derivatives will be used as divisors which would be expected to cause problems with the convergence process.

    I have a vague memory that tells me of functions for which the Newton method does not converge. One condition is the existence of distinct roots which are almost equal (an infinite loop can occur). I suppose there are polynomials for which the Newton method does not converge.
     
  13. mathman Valued Senior Member

    Messages:
    2,002
    I appreciate your analysis. The computer program that I was working with had only about ten (?) significant figures.
     
  14. angslan Registered Senior Member

    Messages:
    16
    Thank you, Alphanumeric. You have provided me with a very clear way of seeing how it is the that a computer would handle these things, and I think that answers my question mostly. I'm not even going to think about how the human brain does it...
     
Thread Status:
Not open for further replies.

Share This Page