Thread: interperting a question

  1. #1
    Registered User
    Join Date
    Sep 2005
    Posts
    84

    interperting a question

    Hello, I'm working on a problem in C. I was wondering if someone could tell me what they think this statement is asking for:

    "The search function should begin at x = 1.0001 and proceed in increments of dx = 2 until an interval [a,b] is found where f(a)* f(b) <= 0 or x > 50. The function should return a value of "a", so that a+2 will be the other starting point for secant."

    I read it and I think it looks like to me that x = a and that it wants me to keep adding 2 to a and that b = a + 2.

    I've writtin this code to apply it:

    Code:
    double search ( double theta_12, double theta_23 ) {
                           
                double a, b, low_a ;
                
                a = 1.001 ;
                
                b = a + 2 ;
               
                while ((f(a,theta_12,theta_23) * f(b,theta_12,theta_23))> 0 && a < 50)
                      {
                         a = a+2;
                         b = a+2;  }
    
                return (a) ;
                
                printf("%f",a);
                
                }

    I'm just wondering if anyone who reads the problem intreprets it any different than I have? I'm not sure about the (x = a) part, I'm kind of just assuming that.

    thank you

  2. #2
    Ultraviolence Connoisseur
    Join Date
    Mar 2004
    Posts
    555
    Quote Originally Posted by panfilero
    "The search function should begin at x = 1.0001 and proceed in increments of dx = 2 until an interval [a,b] is found where f(a)* f(b) <= 0 or x > 50. The function should return a value of "a", so that a+2 will be the other starting point for secant."

    This is a calculus question, you have to figure out the function definition that producues the result f(somenumber)*f(somenumber) <= 0 OR somenumber > 50. X is just a place holder (as is A and B) which basically means the "argument" in C.

    ie in c:

    int foo(int bar); the "int bar" is the exact same as the X in f(x), thats how math functions are syntaxed.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Alice....
    By Lurker in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 06-20-2005, 02:51 PM
  2. Debugging question
    By o_0 in forum C Programming
    Replies: 9
    Last Post: 10-10-2004, 05:51 PM
  3. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 12:52 PM
  4. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 01:47 AM