I gave an example where you have two points {a,b,c}
and {d,e,f}
in symbolic form so you could see the action of the function.
I mentioned that I make use of pure functions and the short form for Map
. Here is the documentation for Pure functions:
http://reference.wolfram.com/language/ref/Function.html
and here is the documentation for Map
:
http://reference.wolfram.com/language/ref/Map.html
Here is a different, roughly equivalent, approach:
uFunction[x : {_, _, _}, points : {{_, _, _} ..}] :=
Module[{nPoints},
nPoints = Length[points];
Sum[1/(Norm[x - points[[i]]]), {i, 1, nPoints}]
]
(it differs from the original one in that it ends up having explicit absolute value functions in the result because Norm
makes no assumptions as to whether the vector supplied to it has real components).