How To Calculate Average Value Of A Function