SatheeshJM
SatheeshJM

Reputation: 3643

Split an interval

Ok I need to split an interval into n number of unequal sub intervals, whose interval lengths are in increasing order.

Lets say I have an interval (10,90)

I need n sub intervals. Lets say n=4

The need sub intervals like (10,20), (20,35), (35,55), (55,90)

The sub interval lengths must be in increasing order

How do I do this??

Upvotes: 0

Views: 1556

Answers (2)

MBo
MBo

Reputation: 80325

You can use any monotonic increasing and convex function to build intervals. For example, quadratic function gives us such expression:

DividingValue[i=1..n-1] = A + Round(i^2 * (B-A)/(n^2))

where (A, B) is your interval.

Upvotes: 1

Xodarap
Xodarap

Reputation: 11859

You could, for example, choose intervals of length 1, 2, 3, .... So in your example of splitting [10, 90] you would have [[10], [11,12], [13,14,15], [16..90]].

Upvotes: 0

Related Questions