can someone tell what is this question want actually?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zewl
    New Member
    • Oct 2009
    • 9

    can someone tell what is this question want actually?

    The following series summation is an approximation for computing the natural logarithm of a floatingpoint
    value x:

    logx=[(x-1)]–[[(x-1)^2]/2]+[[(x-1)^3]/3]–[[(x-1)^4]/4]+….+(-1)n+1(x-1)^n/n

    Where 2 >= x > 0 and n is a positive integer.
    Design and implement an interactive program that does the following:
    1. Prompts the user to enter a floating-point value for x and reads it.
    2. Ensures that x is in the proper range; if not, re prompts the user to enter another value.
  • zewl
    New Member
    • Oct 2009
    • 9

    #2
    i need to know how to start.

    Comment

    • whodgson
      Contributor
      • Jan 2007
      • 542

      #3
      1.
      It wants you to write a "prompt" like "Enter a floating point number" and it also wants the "cin>> ? " code to allow the user to input the floating point number.
      2.
      It wants code included which will reject a value for x which does not conform with the pre-invariant of 2>x>0. (x must be less than 2 and greater than 0)
      i.e if as a result of cin>>x; x evaluated to 2.36 a message would be printed such as "x too big" and return the user to the loop start to enter a valid input which respected the pre-invariant..

      Comment

      • Banfa
        Recognized Expert Expert
        • Feb 2006
        • 9067

        #4
        Stangely, as you can get by implication from whodgsons reply it gives the details of a power series but never asks you to put it into code. It almost looks like you have 1/2 the question.

        Comment

        • maiyappan
          New Member
          • Oct 2009
          • 4

          #5
          read d value for x,n.check wheather if(x>0&&x<=2) then if it true then claculate
          d logx in a for loop like given below
          if(x>0&&x<=2) {
          mul=1;logx=0;
          for(i=1;i<=n;i+ +)
          {
          mul*=(x-1);
          logx+=mul/(float)i;
          }}

          Comment

          • zewl
            New Member
            • Oct 2009
            • 9

            #6
            owh ic.. i'll try to do it.. any problem later i will post..
            thx...
            >.<

            Comment

            Working...