https://www.wolframcloud.com/obj/68428eed-0e9a-411b-a054-03d3c6aab0f7
On this, about halfway down, I define this gsum2 function....
gsum2[sort_,x_,y_,z_,b_]:=(
(*wells is passed as a function, this sorts the wells according to the current point*)
w=sort[x,y,z]; (* Print["at:",{x,y,z},":",w];*)
(* Add the deltas from well 1-9 (skip last which is furthest/closest) *)
r=gadd[Sum[gspot[w[[i]][[1]],w[[i]][[2]],w[[i]][[3]],x,y,z,b],{i,9}],{x,y,z}];
(*Finally, adjust the displaced spatial point by the last well... *)
fin = gadd[gspot[w[[10]][[1]],w[[10]][[2]],w[[10]][[3]],r[[1]],r[[2]],r[[3]],b],{x,y,z}];
(*fin is just the final delta *)
(*Print["r:", r, " del:", del , " fin:", fin, " xyz:",{x,y,z}, " W:", w[[10]]];*)
r
);
If I have fin= uncommented, then the result 'r' is different.
I actually want the final result to be 'fin', but it's not working right for some reason... and doing the expression breaks R, which otherwise is exactly the 'gsum' function above it essentially.
I just want to do the sum of 1-9 instead of all 10, then take that point and do the 10'th 'gspot' calculation.
'gspot' is the gravity displacement for that spot; that is, for a point, and a gravity well position, take the delta, and displace it an amount according to the relative position to that well. (I think I'm wandering into TMI territory)