calculation using arrays of x and y instead of sampless arrays