Results 1 to 7 of 7
  1. #1
    Ionos is offline Member
    Join Date
    Jun 2013
    Posts
    10
    Rep Power
    0

    Default numerical problem

    Hello!here is my question : how can i find the min x for this equation
    x+10^5=x

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,538
    Rep Power
    5

    Default Re: numerical problem

    First, what does this have to do with Java? Second, x does not exist. Subtract x from both sides and you get 10^5 = 0 which is false.

    Regards,
    Jim
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

  3. #3
    Ionos is offline Member
    Join Date
    Jun 2013
    Posts
    10
    Rep Power
    0

    Default Re: numerical problem

    Ok i have to explain more.This is an equation with the numerical analysis rules(computer epsilon)
    I type here my question because i want to make a programm in java that compute the min x
    thanks for anwser me.

  4. #4
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,538
    Rep Power
    5

    Default Re: numerical problem

    Well, unfortunately I am unable to help. I have had numerical analysis a long time ago but I am still not certain what you are asking. But there are lots of bright people on this forum so one of them should be able to help. However, no one here will write the code for you. They will only give you hints and point you in the right direction.

    Regards,
    Jim
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

  5. #5
    Ionos is offline Member
    Join Date
    Jun 2013
    Posts
    10
    Rep Power
    0

    Default Re: numerical problem

    Thanks jim.Of course i dont want the code from anyone.i have make something
    but i m not sure that this is correct:
    double e=2;
    while(e+10^6>e){
    e*=e;
    }
    So with the first look this is an infinity loop but for a big e its equals.so when we exit the loop the
    e is the min x?

  6. #6
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,331
    Rep Power
    25

    Default Re: numerical problem

    Strange that ( x + N > x ) can be false with N > 0. Is this some test of the limits of computers to hold a numeric value? For example large positive int values roll over to negative values when they reach their bit size limit. For example:
    Java Code:
            int x  = 0x7FFFFFFF;
            System.out.println(x > (x + 1));  // true
    If you don't understand my response, don't ignore it, ask a question.

  7. #7
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,538
    Rep Power
    5

    Default Re: numerical problem

    Well, looking at your loop I still say that e + 10^6 > e will always be true since e will never be negative from a pure mathematical sense. Now e *= e can approach infinity in Java. But your loop would stop earlier due to limitations of decimal computations. Perhaps that is what you are seeking.

    And it should be
    Java Code:
    while(e + 1_000_0000 > e) 
    //or
    double error = Math.pow(10,6);
    while (e + error > e)
    Regards,
    Jim
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

Similar Threads

  1. Validate user input (positive and numerical)
    By neveser in forum New To Java
    Replies: 1
    Last Post: 11-28-2012, 10:00 AM
  2. to print a letter grade for a numerical GPA
    By 4uAngelique in forum New To Java
    Replies: 16
    Last Post: 04-14-2012, 08:01 AM
  3. Allow only numerical input on JTextField
    By patriotsfan in forum AWT / Swing
    Replies: 3
    Last Post: 05-31-2011, 12:39 PM
  4. Defining numerical set in java
    By veronique in forum New To Java
    Replies: 8
    Last Post: 05-04-2011, 08:08 AM
  5. Reading Numerical Data
    By tyang in forum New To Java
    Replies: 1
    Last Post: 02-05-2010, 03:19 AM

Posting Permissions

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