views:

62

answers:

2

Given an integer n and a positive real number s, 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

+1  A: 

If first interval is a1, then sum of n intervals

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

         s - 1
a1 = -------------.
        s^n - 1
alxx
+2  A: 

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.

Koantig