Simple Standard Deviation Program without an Array

Discussion in 'Programming' started by davemoosehead, Feb 12, 2008.

  1. davemoosehead

    davemoosehead New Member

    Joined:
    Feb 12, 2008
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    I'm in an introductory Java course and our first assignment has me stumped. It will read a series of numeric scores (integers) until -1 is read, then calculate standard deviation. We also must determine the highest score, average, and other numbers. But the catch is no arrays. I don't know how to find standard deviation without recording down the set of numbers. :confused:

    Just to make sure I have the right concept of SD, don't I first have to find the mean, and then subtract it from each score? Square each number and add them up, divide by n-1, then find the square root.

    sqrt{ sigma[(x - xbar)^2] / n-1}
     
  2. davemoosehead

    davemoosehead New Member

    Joined:
    Feb 12, 2008
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    ok i figured it out. a different formula can be used...

    sqrt{ [ n(x1^2 + x2^2...) - (x1 + x2...)^2] / n(n-1) }

    no need for array, thanks!
     
  3. sandymalhotra

    sandymalhotra New Member

    Joined:
    Feb 6, 2008
    Messages:
    9
    Likes Received:
    1
    Trophy Points:
    0

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice