等比数列の和

Clear[a]

a[1] = a;

a[n_] := a[n - 1]*r

data1 = Table[a[n], {n, 1, 5}]

s[n_] := Sum[a[k], {k, 1, n}]

data2 = Table[s[n], {n, 1, 5}]

data3 = Expand[(data2 - a)/r]

Drop[data2, -1] == Drop[data3, 1]

Solve[s4 == (s4 + a5 - a)/r, s4]

Simplify[%]

例題

例題1

Clear[a, r, h]

a = 18/13; r = 19/17; h = 2520;

Log[r, h/a] + 1  // N

Table[a*r^(n - 1), {n, 68, 69}] // N

別解

Clear[a]

a[1] = 18/13

a[n_] := a[n - 1]*(19/17)

a[1]

a[2]

Clear[m]

m[N_] := Module[{n = 1}, While[a[n] < N, n = n + 1]; n]

m[19/13]

m[2520]

例題2

Clear[data]

data = {5, 6, 9, 16, 31, 62}

lp = ListPlot[data, PlotStyle  ->  Hue[0.0]];

fn2 = Fit[data, {1, n, n^2}, n]

Plot[fn2, {n, 1, 6}, PlotStyle  ->  Hue[0.6]];

fn3 = Fit[data, {1, n, n^2, n^3}, n]

Plot[fn3, {n, 1, 6}, PlotStyle  ->  Hue[0.3]];

Show[lp, %];

Clear[a]

Do[a[n] = data[[n]], {n, 6}]

Table[a[n], {n, 6}]

Clear[b]

Do[b[n] = a[n + 1] - a[n], {n, 5}]

Table[b[n], {n, 5}]

Table[b[n] + 1, {n, 5}]

Clear[a]

a[1] = 5;

a[n_] := a[1] + Sum[2^k - 1, {k, n - 1}]

Table[a[n], {n, 1, 10}]