1
$\begingroup$

I am a beginner in Mathematica and stuck on a problem. I want to generate a series using a recurrence relation, however, I am facing the problem while feeding previous values.

b[0] == 1
b[n+1] == b[n] + n/x^n

I need the following result,

b[0] + b[1] + b[2] + b[3] .....
$\endgroup$
  • 1
    $\begingroup$ Did you try anything? You'll get more answers if you show some effort from your side. Also, try to search (this site, google, and the documentation center) for a solution to your problem. Very rarely are you the first to face a particular issue ;) $\endgroup$ – Lukas Lang Jun 1 '18 at 11:14
  • 4
    $\begingroup$ see RecurrenceTable $\endgroup$ – kglr Jun 1 '18 at 11:15
  • 1
    $\begingroup$ If you're looking for the infinite sum, it's divergent, at least for $x > 0$. Proof: $b_{n} > b_{n-1}$ by the recurrence relation, which means $b_n > b_0 = 1$ for all $n$. $\endgroup$ – Michael Seifert Jun 1 '18 at 12:47
  • $\begingroup$ (I'm pretty sure that the sum of the series diverges for $x < 0$ as well, but I haven't been able to find a similarly simple proof.) $\endgroup$ – Michael Seifert Jun 1 '18 at 13:04
  • 1
    $\begingroup$ What have you tried? $\endgroup$ – Daniel Lichtblau Jun 1 '18 at 15:44
4
$\begingroup$

By advice from @kglr in comments:

Total@RecurrenceTable[{b[n + 1] == b[n] + n/x^n, b[0] == 1}, b, {n, 0, 10}]

$\frac{9}{x^9}+\frac{16}{x^8}+\frac{21}{x^7}+\frac{24}{x^6}+\frac{25}{x^5}+\frac{24}{x^4}+\frac{21}{x^3}+\frac{16}{x^2}+\frac{9}{x}+11$

Another way:

sol = RSolve[{b[n + 1] == b[n] + n/x^n, b[0] == 1}, b[n], n]

$\left\{\left\{b(n)\to \frac{x^{-n} \left(-x+n x-n x^2+x^n-x^{1+n}+x^{2+n}\right)}{(-1+x)^2}\right\}\right\}$

Total@Table[b[n] /. sol[[1]], {n, 0, 10}] // FullSimplify // Expand

give the same answer what is above.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.