# Trying to figure out someone else's code and can't understand how this plot works (or rather, doesn't) [closed]

The person before me created a system to create a x,y plot of ellipses according to certain data. She was able to create a list of these plots, but somehow, the code became unusable and I can't contact her. I won't give the full code since it's quite long with a lot of math involved, but I can give the error code and hopefully you can help me with that.

I am not very familiar with Mathematica since I generally so much with modelling or graph-making, so it is likely that there is a simple mistake I failed to consider or I couldn't find.

Here is the code for the field

Efield2 =
ParallelTable[
Efieldxpol[x, y, z], {x, -xrange, xrange, xstep}, {y, -yrange,
yrange, ystep}, {z, -zrange, zrange, zstep}];


The Efieldxpol

Efieldxpol[x_, y_, z_] :=
I k f/2 Sqrt[n1/n2] E0 Exp[-I k f] With[{rho = Abs[x + I y], phi = Arg[x + I y]},
{I00[rho, z, ArcSin[NA/n2]] + I02[rho, z, ArcSin[NA/n2]] Cos[2 phi],
I02[rho, z, ArcSin[NA/n2]] Sin[2 phi], -2 I I01[rho, z, ArcSin[NA/n2]] Cos[phi]}];


Where each IXX are a set of integrals which I have checked are mathematically correct

and here is the code for the plot

PlotEllipses2D[Efield2[[All, All, 1, 1 ;; 2]], 2]
(*The first "All" is corresponds to the x axis, the second to the y axis*)


This gives the following error: However when I give the following information

PlotEllipses2D[Efield2[[1, 1, 1, 1 ;; 2]], 2]


I can enter each coordinate individually and it will give me the correct information for that coordinate, but I can't figure out how to associate the calculation of every coordinate with its equivalent x/y value.

If you need the PlotEllipses2D code, I can give it here as well.

• the first bunch of error messages you get are related to Norm but there's nothing in the provided code that calls Norm; perhaps it would help if you could provide a code snippet that uses Norm. – yosimitsu kodanuri Jan 14 at 16:27