0

"coords" is a list of coordinates in the 2D plane ordered in a specific way, with the 3rd (z-axis) positions left empty to be filled in with specific values, like temperature or concentration at the given point on the grid, so I can run ListDensityPlot on it. It looks like this:

 coords={{1,1,0},{1,2,0},...,{9,9,0}}. 

"current" is a list whose values I want to pass on to those 3rd coordinates in the coords list, and the following code is the most direct way of doing so:

nextState = coords;

For[j = 1, j <= Length[coords], j++,
 nextState[[j, 3]] = current[[j]]
 ]

I call the finished, filled in list nextState cause I'll be using it later on.

The lists start getting a little too big and this silly part of the code, which is only used in the visualization end of my project, is slowing everything down to a halt. Is there a faster, or smarter way to go about doing this?

Subquestion: Is it possible to ListDensityPlot the temperatures at every point in mathematica without having to build the coordinates myself and fill them in with the concentrations?

Any insight is appreciated!

Mike
  • 585
  • 3
  • 14

0 Answers0