开发者

Partitioning an interval geometrically

Given an integer n and a positive real number s,开发者_Python百科 how can I partition an interval [0..1] into n intervals such that L(i+1)=s L(i) where L(i) is length of i'th interval?

Looking for solution in Mathematica or self-contained C-like pseudo-code


Like this?

s = 2;
n = 10;
L1 = (s - 1)/(s^n - 1);
interval = L1 s^Range[0, n - 1]
Total@interval

You just need to work out the length of the first interval L1 (very easy) and you're done.


If first interval is a1, then sum of n intervals

         s^n - 1
  a1 * ----------- = 1,
          s - 1

         s - 1
a1 = -------------.
        s^n - 1
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜