Results 1 to 4 of 4

Thread: Equation

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    England, Buckingham
    Posts
    1,341
    Hey,

    Ok, i have got the equation:

    (((X * X) - X) - 1) = 0

    "X Squared, Minus X, Minus 1"

    What i have to do is work out what x is to make 0 so say 3*3 - 3 - 1 etc. Does anyone know the answer or an program that will work out the answer. I have this:

    #include <iostream.h>

    void main (void)
    {
    float cur;
    float x;
    char *temp;

    cur = 0.0;

    do
    {
    cur = cur + 0.0000000000000000000000000000000000000001;

    x = (((cur * cur) - cur) - 1);

    cout << cur << "\t" << x << endl;

    }while (x != 0);

    cin >> temp;
    }

    but im not sure if thats working properly. It can be in vb or c++ but i just need to find what valuse X has to be so that X squared, minus X, minus 1 is equal to 0.

    Thanks

  2. #2
    Fanatic Member THEROB's Avatar
    Join Date
    Oct 2000
    Location
    I'm cold and there are wolves after me
    Posts
    575
    Why can't you use the formula:

    (-b(+or-) (srqt(b*b) - 4ac)) / 2a

    where aX*X + bX + c = 0


    the equation may be better writen as:
    -b±sqrt((b*b-4ac))
    ------------------------
    2a


    Need more info?

    Rob

  3. #3
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    x^2 - x - 1 = 0

    This gave me an answer of:

    x = 1.618033989
    or
    x = -0.618033988
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  4. #4
    New Member
    Join Date
    Feb 2001
    Location
    Argentina
    Posts
    1

    Exclamation 2nd degree equation

    A 2nd degree equation always return 2 results... you have to discard one of those results (or both) depending on the application of that equation...

    Example: If you are working just with natural numbers... then the negative result must be discarded.

    If you have none of those restrictions... then both results satisfy the equation

    Regards

    Rodrigo F. Uranga

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width