Message Boards Message Boards

0
|
5969 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

[?]  Can this expression be written in closed form?

Posted 6 years ago

Observe the following Wolfram Mathematica expression which results in a table of integer sequences:

b[n_, k_] := b[n, k] = If[n == 0, 1, If[n == 1, If[k > 0, 1, 0], Sum[Binomial[n-1, r-1]*b[r-1, k-1]*b[n-r, k-1], {r, 1, n}] ] ]; t [n_, k_] := b[n, k] - If[k > 0, b[n, k-1], 0]; Table[Table[t[n, k], {k, 0, n}], {n, 0, 10}]

I'm struggling to interpret what this is actually doing. Clearly it's quite a complicated mess of if statements, but I'm not entirely sure if they are necessary or not. I obtained the expression from here:

https://oeis.org/A195581

Because I wanted to determine an expression (dependent on the two variables n and k) which would result in table of integers seen there. Would somebody please write the Mathematica code above in closed form so that it's easier to understand? If this is not possible, can you at least try to explain what's going on, and perhaps give an expression which models the above in most situations?

POSTED BY: John Travolski
2 Replies

Hi John,

I would write the code generating this sequence like so:

ClearAll["Global`*"]

b[0, _] = 1;
b[1, 0] = 0;
b[1, k_] := If[k > 0, 1, 0];
b[n_, k_] := b[n, k] = Sum[Binomial[n - 1, r - 1]*b[r - 1, k - 1]*b[n - r, k - 1], {r, 1, n}]
t[n_, k_] := b[n, k] - b[n, k - 1]

sequence = Flatten@Table[t[n, k], {n, 0, 10}, {k, 0, n}]

which - I think - is much easier to read (even though there surely might be simpler ways!). As a brute force method for getting a closed form FindSequenceFunction can be helpful - but unfortunately not here! Maybe one gets a little "understanding" on what is going on with this:

logData = Flatten[Table[{n, k, Log[1. + t[n, k]]}, {n, 0, 10}, {k, 0, n}], 1];
route = Flatten[Table[{n, k, 14}, {n, 0, 10}, {k, 0, n}], 1];
Show[ListPlot3D[logData, ImageSize -> Large], Graphics3D[{Thick, Line[route]}]]

which gives:

enter image description here

Hope this helps a little, regards -- Henrik

POSTED BY: Henrik Schachner

The code isn't pretty. That's mostly because it's been directly translated from the Maple code.

The first step is to write this out as a recurrence equation. Once you've done that you can use RSolve to see if Mathematica knows a closed form for the reccurence you're looking at. For more examples, see the documentation under "tutorial/SolvingRecurrenceEquations".

POSTED BY: Sean Clarke
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract