# Plotting smoothly inverse squared force fields

I would like to plot a DensityPlot of two 1/r^2 functions on a 2D plane (this is supposed to visualize the inverse squared force field law between two points). If I plot the code below I get only two big 'blobs' instead of two points (or at least two smaller blobs) with a smooth decreasing intensity shading, because Mathematica cuts the top of the z values which obviously go to infinity. How can I extend the plotting range in the third z-coordinate two make these blobs appear smaller. I tried with PlotRange and PlotRegion but nothing works. Using PlotRange --> All does not work because in this case it is a function which diverges (not just a sin/cos^n function as asked elsewhere). Then the opposite problem occurs, just two tiny points appear (see second image), no in between solution could I find. It needs a much more finer color gradient. Can this be done? Thanks in advance.

x1 = -1; y1 = 0; x2 = 1; y2 = 0; Dist = 2.5*x2;
f = ColorData["LakeColors"];
DensityPlot[
1/((x1 - x)^2 + (y1 - y)^2) + 1/((x2 - x)^2 + (y2 - y)^2), {x, -Dist,
Dist}, {y, -Dist, Dist}, ColorFunction -> ColorData["SolarColors"]]


• Add PlotRange -> All. Thus: With[{Dist = 2.5}, DensityPlot[Sum[1/SquaredEuclideanDistance[{x, y}, pt], {pt, {{-1, 0}, {1, 0}}}], {x, -Dist, Dist}, {y, -Dist, Dist}, ColorFunction -> "SolarColors", PlotRange -> All]] – J. M. will be back soon Apr 13 '18 at 6:16
• I did, but since it is a 'spiked' function, the divergence points just appear as two tiny points and nothing else. It does not work as with a sin/cos^n function. It would be nice to have something in between, i.e. a larger color gradient which goes from infinity to zero with more shades (logarithmically? or something of the sort?) Is this possible? – Mark Apr 13 '18 at 6:38
• What you can try is to manually perform a logarithmic (or some other) rescaling of the color function: ColorFunction -> (ColorData["SolarColors", Log10[#]] &), ColorFunctionScaling -> False. – J. M. will be back soon Apr 13 '18 at 6:47
• Ah... ok, that could be an option. Will see if that can be optimzed. Thanks so far. – Mark Apr 13 '18 at 6:52