Hi there,
When trying to calculate the absolute value of a complex expression, I am reaching errors for 1/0 being an infinite expression. I know where in the code this error comes from but there are too many points for me to write each one individually. I am wanting to calculate the absolute value so that I can find the minimum points in an intensity distribution and plot it as a contour map. The function I run takes the input and evaluates it at all x,y,z points in the area I'm interested in. The code for the potential is;
uPWPhase[k_, d0_, l_, r_] := Module[{nk, u0, n0, n90, kLength, phi},
kLength = Sqrt[k.k];
nk = k/kLength;
u0 = d0 - d0.nk nk;
n0 = u0/Sqrt[
u0.u0];
n90 = Cross[n0, nk];
phi = ArcTan[r.n90/r.n0];
Exp[I (k.r - l*phi)]
]
uHP[x_, y_, z_] := Sum[ uPWPhase[
k[[j]] (*k vectors*),
k[[nn[[j, 1]]]] - k[[j]] (*d0 vector*),
Length[nn[[j]]],
{x, y, z} (*r vector*)],
{j, 1, Length[k]}]
vHP = uHP[x, y, z]
and gives a sum series of the form (I am only giving 1 term in the series for ease of reading, but there are 8 terms all of a similar form);
E^(I (-(x/2) - y/2 + z/2 - 3 ArcTan[(-(x/Sqrt[2]) + y/Sqrt[2])/(-(x/Sqrt[6]) - y/Sqrt[6] -Sqrt[2/3] z)]))
As you can see, it is the complex exponential of a location and an angle. The 1/0 error comes from the evaluation of the ArcTan for certain values of x,y,z. Is there a way to get Mathematica to evaluate this, or at least approximate it?
Thanks in advance