Finite Sum Table

This tool allows you to numerically explore finite sums of the form (∑_(k=whatever)^n)whatever.  It will give you the value of the sum for all n up to 100.  In addition, if you are expecting these sums to get closer to some number (as n gets bigger), you can enter your expected value and see the difference between your expected value and the actual sums.  (Note: the difference shown is the expected value minus the actual sum.)

To use this tool, just enter the sum you'd like to explore and then click the "Make Table" button.

Example:
Let's say you want to explore (∑_(k=1)^n)(1/k), and you guess that the sum is going to get closer to 10 as n gets bigger.  Enter (∑_(k=1)^n)1/k, check the box that says "Show difference from expected value", and enter 10 in the box.  Finally, click the "Make Table" button.

You will get a table; to understand what it gives you, take a look at the 3rd row.  The first column, 3, just tells you what n is.  The second column is (∑_(k=1)^3)(1/k), or 1 + (1/2) + (1/3) = 1.83333333333333333333333333333`10..  The third column shows you the next term that would be added ((1/4)).  Finally, the fourth column shows you 10 (your expected value) minus the sum 1.833333333.

DynamicModule[{showDiff,expression,table,header,k0,sum,expected},
Module[{errors},
(* initialization *)
showDiff=True;
expression=1/k;
k0=1;
table={{}};
expected=10;

header={{Style["n",FontSlant->"Italic"],Grid[{{Style["n",FontSlant->"Italic"],SpanFromLeft,"",""},{Style["Σ",FontSize->96],SpanFromLeft,InputField[Dynamic[expression],Expression,FieldSize->12]},{"k =",InputField[Dynamic[k0],Number,FieldSize->2]}},
Alignment->{Center,Center}], 
(*Style["Last term added",FontFamily->"Verdana",FontSize->12],*)
Style["Next term to be added",FontFamily->"Verdana",FontSize->12],Grid[{{Checkbox[Dynamic[showDiff]],Style["Show difference from expected value",FontFamily->"Verdana",FontSize->12]},{"",InputField[Dynamic[expected],FieldSize->6]}},Alignment->Left],

Button[Style["Make Table",FontFamily->"Verdana",FontSize->12],

(* first error check *)
errors={};
If[!IntegerQ[k0],AppendTo[errors,"   Lower bound of summation must be an integer."]];
If[Quiet[Check[expression/.k->k0,"divideby0",{Power::"infy"}]=="divideby0"],
AppendTo[errors,"    Invalid first term: you are dividing by 0"],
If[!NumericQ[expression/.k->k0]||!NumericQ[expression/.k->(k0+1)],
AppendTo[errors,"   Invalid summand -- perhaps you have a variable other than k?"]]];
If[showDiff&&!NumericQ[expected],
AppendTo[errors,"   Invalid expected value"]];

If[Length[errors]>0,

(* if there are errors, pop up a dialog box and don't
 do anything else *)
CreateDialog[Join[{"Error:"},errors,{DefaultButton[]}],Modal->True],

(* otherwise, make the table *)
Block[{$MaxExtraPrecision=1000},
If[showDiff,
table=Table[(sum=Sum[expression,{k,k0,n}];{n,N[sum,10](*,N[expression/.k->n,10]*),N[expression/.k->(n+1),10],N[expected-sum,10]}),{n,k0,100}],
table=Table[(sum=Sum[expression,{k,k0,n}];{n,N[sum,10],(*N[expression/.k->n,10],*)N[expression/.k->(n+1),10],""}),{n,k0,100}]]]],
ImageSize->Large]}};

(* show stuff *)
Panel[Dynamic[
Grid[Join[header,table],Dividers->{{2->True},{2->True}},Spacings->{2,0.25},Background->{None,{{White,GrayLevel[0.9]}}}]]
]
]
]