Hi everyone,

I tried to create a loop for distributing the y coordinate of an array dipoles[20][20]
[code]double dy=1.0/(nd-1);    //set up dipoles under bar magnet
for(int i=0; i <nd; i+=2) {
dipoles[0][ i ]=-0.5+i*dy;
}[/code]

i am puzzled why it didn't draw like this picture [img]http://www.phy.ntnu.edu.tw/ntnujava/index.php?action=dlattach;topic=1582.0;attach=2197[/img]
i am trying to draw two lines vertically up to position the dipoles of the magnet, to create a upright distribution of the dipoles instead of the current horizontal distribution.

the code works for x coordinates distribution
[code]double dx=1.0/(nd-1);    //set up dipoles under bar magnet
for(int i=0; i< nd; i+=2) {
dipoles[ i ] [0]=-0.5+i*dx;   // x position of first line of dipoles bottom
dipoles[i+1][0]=-0.5+i*dx;   // x position of 2nd line of dipoles top

dipoles[ i ][1]=-0.04;         // y position move down by -0.04 of first line of dipoles bottom
dipoles[i+1][1]=0.04;       // y position move up by +0.04 of top line of dipoles bottom

}[/code][img]http://www.phy.ntnu.edu.tw/ntnujava/index.php?action=dlattach;topic=1582.0;attach=2201;image[/img]

when i make
[code]double dy=1.0/(nd-1);    //set up dipoles under bar magnet
for(int i=0; i < nd; i+=2) {
dipoles[i][0]=-0.5+i*dy;   // y position of first line of dipoles bottom
}
[/code] then it distribute left to right which i thought change it to dipoles[0][ i ]=-0.5+i*dy; should be y distribution.
what am i doing wrongly?
i tried to read up http://www.um.es/fem/EjsWiki/Main/ElementsArrow2D but it doesn't say much about the array
"Position [] The double[] array with the coordinates of the shape. A double array."