<p>One quick way to do this is through inverting a distribution c.d.f.. For example, the distribution Beta(alpha,beta) has density concentrated at small and large values when alpha and beta are less than one. Thus, you can first generate equally spaced grid, and then use the inverse function of Beta c.d.f to map the grid to unequally spaced grid. You can change the percentiles you want (60-70%, e.g.) by setting the appropriate alpha and beta. </p>

CC BY-SA 3.0
2015-02-02T21:26:29.927Z
Thanks for your response Justin. I've been messing with this idea this morning but haven't gotten it to work yet. Will keep at it and hopefully get it soon.
Cuedrah
CC BY-SA 3.0
2015-02-02T21:13:20.833Z
2015-02-02T21:13:20.833Z
Justin
<p>An alternative to the beta distribution mentioned by @Justin is the <a href="http://en.wikipedia.org/wiki/Kumaraswamy_distribution" rel="nofollow">Kumaraswamy distribution</a>, which has a similar degree of flexibility but a more tractable PDF:$$f(x)=abx^{a-1}(1-x^a)^{b-1}.$$ Setting, for example, $a=b=1/2$ will give you a concentration of points at ends of the unit interval.</p>

<p>Alternatively, you could just uniformly distribute the points in the intervals $[0,0.2)$, $[0.2,0.8]$, and $(0.8,1]$ in the ratio $0.15:0.7:0.15$.</p>

CC BY-SA 3.0
2015-02-03T21:58:31.790Z
Thanks for your response. I have never heard of this distribution before, so thank you for teaching me something new :)
Cuedrah
CC BY-SA 3.0
2015-02-03T22:05:47.957Z
I was actually able to make my grid using the CDF of the beta distribution relatively easily. I did speak with a professor in the applied math department and she showed me an alternative method utilizing the integral of tanh. The method she showed me is a bit more complicated but is much more flexible in making the grid conform more closely to a number of specifications (i.e. symmetry, degree of concentration etc.)
Cuedrah
CC BY-SA 3.0
2015-02-03T13:07:08.973Z
2015-02-03T13:07:08.973Z
Ubiquitous
<p>I want to make a grid [0,1] with 100 points but I want points to be concentrated at the edges close to 0 and 1. So I want 60-70% of the points to be in the intervals [0, 0.2] and [0.8, 1]. Any ideas on how I can do this? </p>

<computation><simulations>
How to make unequally spaced grid?
Cuedrah
# How to make unequally spaced grid?

(Asked by: username_0 on 2015-02-02)

I want to make a grid [0,1] with 100 points but I want points to be concentrated at the edges close to 0 and 1. So I want 60-70% of the points to be in the intervals [0, 0.2] and [0.8, 1]. Any ideas on how I can do this?

**Tags:** computation, simulations


---

## 2 answers

### Answer by username_1 on 2015-02-02. Score: 4

One quick way to do this is through inverting a distribution c.d.f.. For example, the distribution Beta(alpha,beta) has density concentrated at small and large values when alpha and beta are less than one. Thus, you can first generate equally spaced grid, and then use the inverse function of Beta c.d.f to map the grid to unequally spaced grid. You can change the percentiles you want (60-70%, e.g.) by setting the appropriate alpha and beta.

> **Comments:**
> **username_0**: Thanks for your response username_1. I've been messing with this idea this morning but haven't gotten it to work yet. Will keep at it and hopefully get it soon.  

---

### Answer by username_2 on 2015-02-03. Score: 2

An alternative to the beta distribution mentioned by @username_1 is the [Kumaraswamy distribution](http://en.wikipedia.org/wiki/Kumaraswamy_distribution), which has a similar degree of flexibility but a more tractable PDF:$$f(x)=abx^{a-1}(1-x^a)^{b-1}.$$ Setting, for example, $a=b=1/2$ will give you a concentration of points at ends of the unit interval.

Alternatively, you could just uniformly distribute the points in the intervals $[0,0.2)$, $[0.2,0.8]$, and $(0.8,1]$ in the ratio $0.15:0.7:0.15$.

> **Comments:**
> **username_0**: Thanks for your response. I have never heard of this distribution before, so thank you for teaching me something new :)  
> **username_0**: I was actually able to make my grid using the CDF of the beta distribution relatively easily. I did speak with a professor in the applied math department and she showed me an alternative method utilizing the integral of tanh. The method she showed me is a bit more complicated but is much more flexible in making the grid conform more closely to a number of specifications (i.e. symmetry, degree of concentration etc.)  

---

