Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Is this actually a lot more complicated than I think

  • 23-01-2018 6:43am
    #1
    Registered Users, Registered Users 2 Posts: 17,154 ✭✭✭✭


    Suppose I have a group of integers:

    [-6 4 -5 -9]

    I want to find the number y, so that the average of the new array:

    [-6 4 -5 -9 y]

    is as close to zero as possible.... ?


Comments

  • Registered Users, Registered Users 2 Posts: 4,396 ✭✭✭whomitconcerns


    Y is 11 or 21 gives you an average of -1/1


  • Registered Users, Registered Users 2 Posts: 17,154 ✭✭✭✭Neil3030


    Thanks, so y can actually be a Real number if needed. Sorry, should have specified.


  • Registered Users, Registered Users 2 Posts: 17,154 ✭✭✭✭Neil3030


    OK so think I got it...

    You insert -ab, where a is the number of elements in the original array, and b is the original mean

    So in the above:
    mean of [-6 4 -5 -9 16] = 0


  • Registered Users, Registered Users 2 Posts: 3,498 ✭✭✭Lu Tze


    Neil3030 wrote: »
    Thanks, so y can actually be a Real number if needed. Sorry, should have specified.

    In that case:
    -6+4-5-9+y=0
    => y=16

    Or am I missing something? Average is sum divided by count, and if the average equals zero, then dividing by count is irrelevant I.e. also zero? Hence sum = zero?


Advertisement