Hi, I wrote some code on a computer at school.(adsbygoogle = window.adsbygoogle || []).push({});

dim = 50;

Ediff = ConstantArray[0, {dim, dim}];

\[Lambda] = .5; steps = 10;

Ediff = ConstantArray[0, {dim, dim}];

L = 1;

For[xs = 1, xs <= dim, xs++,

For[ys = 1, ys <= dim, ys++,

Ediff[[xs, ys]] =

Ediff[[xs, ys]] +

NIntegrate[

Sqrt[(xa - xs)^2 + (ya - ys)^2]/((xa - xs)^2 + (ya - ys)^2 +

L^2) Exp[

I 2 \[Pi] / \[Lambda] Sqrt[(xa - xs)^2 + (ya - ys)^2 +

L^2]], {xa, dim/2 - steps, dim/2 + steps}, {ya, dim/2 - 1,

dim/2 + 1}, AccuracyGoal -> 2] +

NIntegrate[

Sqrt[(xa - xs)^2 + (ya - ys)^2]/((xa - xs)^2 + (ya - ys)^2 +

L^2) Exp[

I 2 \[Pi] / \[Lambda] Sqrt[(xa - xs)^2 + (ya - ys)^2 +

L^2]], {xa, dim/2 - 1.5, dim/2 + 1.5}, {ya, dim/2 - steps,

dim/2 - 1}, AccuracyGoal -> 2] +

NIntegrate[

Sqrt[(xa - xs)^2 + (ya - ys)^2]/((xa - xs)^2 + (ya - ys)^2 +

L^2) Exp[

I 2 \[Pi] / \[Lambda] Sqrt[(xa - xs)^2 + (ya - ys)^2 +

L^2]], {xa, dim/2 - 1.5, dim/2 + 1.5}, {ya, dim/2 + 1,

dim/2 + steps}, AccuracyGoal -> 2]

Idiff1 = ConstantArray[0, {dim, dim}];

For[xs = 1, xs <= dim, xs++,

For[ys = 1, ys <= dim, ys++,

Idiff1[[xs, ys]] = Ediff[[xs, ys]]*Conjugate[Ediff[[xs, ys]]]]]

ListPlot3D[Idiff1, PlotRange -> {0, .002}]

ArrayPlot[Idiff1]

My Toshiba Satellite computer will run all but the array plot. It gives a bell noise and then all saved variables go blue. The ListPlot3D will work, but something is weird about the array plot. Any ideas?

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Mathematica array plot won't plot and it erases all of my stored variables

**Physics Forums | Science Articles, Homework Help, Discussion**