Consider the relation
$t_{k}(n) = 2 t_{k-1}(\frac{n}{2}) + f(n)$
Where $t_{0}(n) = n^p$ and $f(n)=\alpha n^q$.
How can I get an arbitrary element $t_{k}(n)$ for example with $p=2,q=1,\alpha=1$ using Mathematica syntax?
Consider the relation
$t_{k}(n) = 2 t_{k-1}(\frac{n}{2}) + f(n)$
Where $t_{0}(n) = n^p$ and $f(n)=\alpha n^q$.
How can I get an arbitrary element $t_{k}(n)$ for example with $p=2,q=1,\alpha=1$ using Mathematica syntax?
Does this suit your needs?
p = 2; q = 1; α = 1;
f[n_] := α n^q
t[k_, n_] := 2 t[k - 1, n/2] + f[n]
t[0, n_] := x^p
t[5, n]
(* n + 2 (n/2 + 2 (n/4 + 2 (n/8 + 2 (n/16 + 2 x^2)))) *)
Using partial memoization:
f[n_] = α * n^q;
t[0] = Function[n, n^p];
t[k_] := t[k] = Function[n, Evaluate[2*t[k-1][n/2] + f[n]]]
Then define an abbreviation:
t[k_, n_] := t[k][n]
Test:
t[0, n]
(* n^p *)
t[10, n] // FullSimplify
(* 2^(-10 (-1 + p)) n^p + 2^(-9 q) (512 + 2^(8 + q) + 2^(7 + 2 q) + 2^(5 + 4 q) + 2^(4 + 5 q) + 2^(2 + 7 q) + 2^(1 + 8 q) + 8^(2 + q) + 8^(1 + 2 q) + 512^q) n^q α *)
The general (closed-form) solution is
ta[k_, n_] = 2^(k (1 - p)) n^p - ((2^k - 2^(q k)) 2^((1 - k) q) n^q α)/(2^q - 2)
Check:
ta[0, n] == n^p
(* True *)
ta[k, n] == 2ta[k-1, n/2] + f[n] // FullSimplify
( True *)
Hint.
First making a substitution $n=2^m$ we have
$$ t_k(2^m)=2t_{k-1}(2^{m-1})+f(2^m) $$
now calling $T_k(\cdot)=t_k\left(2^{(\cdot)}\right)$ and $F(\cdot) = f\left(2^{(\cdot)}\right)$ we follow with
$$ T_k(m)=2T_{k-1}(m-1)+F(m) $$
This recurrence can be handled directly with MATHEMATICA
RSolve[T[k, m] - 2 T[k - 1, m - 1] == F[m], T, {k, m}]
NOTE
After the initial conditions and assuming $F(m)=2^m$ we have
$$ T_k(m) = 2^k(2^{-p})^{k-m}+2^m k $$
now we can go backwards to $t_k(n)$...