Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Finding the index number on a stretched cartesian grid

  1. Nov 5, 2012 #1
    Imagine I have a set of discrete points equally spaced out and indexed from 1 to n (a 1D grid). On a cartesian grid if the spacing, dx, is constant the index can be obtained simply by:

    i = floor(x/dx)

    That was pretty simple, now if the cartesian grid is stretched (i.e. dx is not constant), it is not clear to me how to go about finding the index analytically. I am guessing that since we know the grid analytically we should be able to find the index analytically regardless if the grid is stretched or not. Any thoughts?

    Thanks in advance.
     
  2. jcsd
  3. Nov 5, 2012 #2

    haruspex

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    Not entirely certain of the question but....
    Suppose the grid points are given by xi = f(i), some suitably nice function f. Wouldn't the grid point next below x be floor(f-1(x))?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Finding the index number on a stretched cartesian grid
Loading...