added function integrate
3d works, also changed everything to double precision
minor change
3d works, also changed everything to double precision