#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    1
    Rep Power
    0

    Defining variables from arrays


    Thanks for your interest on this post. I'm trying to model the spread of a circular wave coming out from a point and return an array that gives the amplitude of the wave at certain points.

    So with a 4x4 grid, the centre of the wave would be at the centre where the middle lines cross, and in the centre of each space, the height of the wave will be shown by the array output in that position.

    The thing is, does anyone know how to use the position in the array as a variable so that I can put it in a function and work out how far that position is from the centre?

    Eternal love for you if you can put it in some fairly lay-man speak. Thanks so much
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Location
    39N 104.28W
    Posts
    158
    Rep Power
    3
    First of all, in a 4x4 array, the center, where the diagonals cross, is not a cell, so there is no value there.

    Now, let's start at the upper left cell, 0,0 (at least in 1970's conventions). We assume that each cell occupies "a" meters in x and "b" meters in y. So the center of cell, 0,1, being the adjacent cell to the right of the starting cell, is "a" meters from the center of the starting cell in the x-direction and 0 meters from the center of the starting cell in the y-direction. Generally, cell i,j is i*a meters in x and j*b meters in y from the starting cell.

    Is that what you were asking?
  4. #3
  5. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,904
    Rep Power
    481
    See post 4 in this (click here) thread.
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo