Re: Series
- To: mathgroup at smc.vnet.net
- Subject: [mg14181] Re: Series
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Wed, 30 Sep 1998 19:42:16 -0400
- Organization: University of Western Australia
- References: <6ushsl$5on@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
MAvalosJr at aol.com wrote: > I know that merely giving a finite number of terms of a sequence or > series does not define a unique nth term. In fact, an infinite number > of nth terms are possible. However, any suggestions on how I could > write an nth term for a particular sequence using mathematica? For > example: 1/1! - 1/2! + 1/3! -1/4!+...... A neat way of finding patterns in numbers is to use Sloane's On-Line Encyclopedia of Integer Sequences at http://www.research.att.com/~njas/sequences/ See also the Notebook appended below and the Mathematica Journal 5(3): 33-35. Cheers, Paul ____________________________________________________________________ Paul Abbott Phone: +61-8-9380-2734 Department of Physics Fax: +61-8-9380-1014 The University of Western Australia Nedlands WA 6907 mailto:paul at physics.uwa.edu.au AUSTRALIA http://www.physics.uwa.edu.au/~paul God IS a weakly left-handed dice player ____________________________________________________________________ Notebook[{ Cell[CellGroupData[{ Cell["Automatic Summation", "Section"], Cell[TextData[{ "See The ", StyleBox["Mathematica", FontSlant->"Italic"], " Journal ", StyleBox["5", FontWeight->"Bold"], "(3): 33-35." }], "Text"], Cell["Suppose that you have the first few terms of a series, say:", "Text"], Cell[BoxData[ \(TraditionalForm\`\(\[ScriptS] = 1 - 2 x + 3 x\^2 - 4 x\^3 + 5\ x\^4; \)\)], "Input"], Cell[TextData[{ "Often you would like to obtain the ", StyleBox["n", FontSlant->"Italic"], "-th term of the series and a closed form expression, if possible. In \ general this is impossible as there are an infinite number of functions that \ have identical series expansions up to a given degree. However, if extra \ information is available (such as the recurrence relation), one general \ method for compacting such expressions is to use ", StyleBox["generating functions", FontSlant->"Italic"], ". After loading" }], "Text", CellTags->{ "n-th term of a series", "Closed form expression", "Generating function", "Recurrence relation"}], Cell[BoxData[ \(TraditionalForm\`Needs["\<DiscreteMath`RSolve`\>"]\)], "Input", CellTags->"DiscreteMath`RSolve`"], Cell["and providing the recurrence relation for the series:", "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(TraditionalForm \`RSolve({a(n + 1) == \(-\(a(n)\)\) - \((\(-1\))\)\^n, a(0) == 1}, a(n), n)\)], "Input"], Cell[BoxData[ \(TraditionalForm\`{{a(n) \[Rule] \((\(-1\))\)\^n\ \((n + 1)\)}}\)], "Output"] }, Open ]], Cell[TextData[{ "one finds that the ", StyleBox["n", FontSlant->"Italic"], "-th term is" }], "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(TraditionalForm\`\(a(n)\)\ x\^n /. First(%)\)], "Input"], Cell[BoxData[ \(TraditionalForm\`\((\(-1\))\)\^n\ \((n + 1)\)\ x\^n\)], "Output"] }, Open ]], Cell[TextData[{ "and a closed form for the infinite series can be obtained using ", StyleBox["PowerSum", FontFamily->"Courier", FontWeight->"Bold"], ":" }], "Text", CellTags->"PowerSum"], Cell[CellGroupData[{ Cell[BoxData[ \(TraditionalForm\`Simplify(PowerSum(a(n) /. First(%%), {x, n, 0}))\)], "Input"], Cell[BoxData[ \(TraditionalForm\`1\/\((x + 1)\)\^2\)], "Output"] }, Open ]], Cell[TextData[ "As a check, we expand this out into a Maclaurin series and compare with \ \[ScriptS]:"], "Text", CellTags->"Maclaurin series"], Cell[CellGroupData[{ Cell[BoxData[ \(TraditionalForm\`\[ScriptS] - % + \(O(x)\)\^5\)], "Input"], Cell[BoxData[ FormBox[ InterpretationBox[\(O(x\^5)\), SeriesData[ x, 0, {}, 5, 5, 1]], TraditionalForm]], "Output"] }, Open ]], Cell[TextData[{ "An alternative approach is to note that a large class of functions have ", StyleBox["hypergeometric", FontSlant->"Italic"], " series expansions:" }], "Text", CellTags->"hypergeometric series"], Cell[BoxData[ FormBox[ RowBox[{ TagBox[ RowBox[{\(\(\[ThinSpace]\_p\) F\_q\), "(", RowBox[{ TagBox[ TagBox[ RowBox[{ TagBox[\(a\_1\), (Editable -> True)], ",", TagBox[\(a\_2\), (Editable -> True)], ",", TagBox["\[Ellipsis]", (Editable -> True)], ",", TagBox[\(a\_p\), (Editable -> True)]}], InterpretTemplate[ { SlotSequence[ 1]}&]], (Editable -> False)], ";", TagBox[ TagBox[ RowBox[{ TagBox[\(b\_1\), (Editable -> True)], ",", TagBox[\(b\_2\), (Editable -> True)], ",", TagBox["\[Ellipsis]", (Editable -> True)], ",", TagBox[\(b\_q\), (Editable -> True)]}], InterpretTemplate[ { SlotSequence[ 1]}&]], (Editable -> False)], ";", TagBox["z", (Editable -> True)]}], ")"}], InterpretTemplate[ HypergeometricPFQ[ #, #2, #3]&]], "\[Equal]", FormBox[ RowBox[{\(\[Sum]\+\(n = 0\)\%\[Infinity]\), FractionBox[ RowBox[{\(\[Product]\+\(i = 1\)\%p\), RowBox[{ TagBox[\(\((a\_i)\)\_n\), Pochhammer], " ", \(z\^n\)}]}], RowBox[{\(\[Product]\+\(i = 1\)\%q\), RowBox[{ TagBox[\(\((b\_i)\)\_n\), Pochhammer], " ", \(n!\)}]}]]}], "TraditionalForm"]}], TraditionalForm]], "DisplayFormula"], Cell[TextData[{ "where ", Cell[BoxData[ FormBox[ RowBox[{\(\((a)\)\_n\), "==", StyleBox[\(Pochhammer[a, n]\), "Text"]}], TraditionalForm]]], " in ", Cell[BoxData[ FormBox[ StyleBox["TraditionalForm", "Input"], TraditionalForm]]], " notation. For example," }], "Text", CellTags->"Pochhammer"], Cell[CellGroupData[{ Cell[BoxData[ FormBox[ TagBox[ RowBox[{\(\(\[ThinSpace]\_0\) F\_0\), "(", RowBox[{ TagBox[ InterpretationBox["\[InvisibleSpace]", {}], (Editable -> False)], ";", TagBox[ InterpretationBox["\[InvisibleSpace]", {}], (Editable -> False)], ";", TagBox["z", (Editable -> True)]}], ")"}], InterpretTemplate[ HypergeometricPFQ[ #, #2, #3]&]], TraditionalForm]], "Input"], Cell[BoxData[ \(TraditionalForm\`\[ExponentialE]\^z\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ FormBox[ RowBox[{"z", " ", TagBox[ RowBox[{\(\(\[ThinSpace]\_2\) F\_1\), "(", RowBox[{ RowBox[{ TagBox["1", (Editable -> True)], ",", TagBox["1", (Editable -> True)]}], ";", TagBox["2", (Editable -> True)], ";", TagBox[\(-z\), (Editable -> True)]}], ")"}], InterpretTemplate[ Hypergeometric2F1[ #, #2, #3, #4]&]]}], TraditionalForm]], "Input"], Cell[BoxData[ \(TraditionalForm\`log(z + 1)\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ FormBox[ RowBox[{ RowBox[{"z", " ", TagBox[ RowBox[{\(\(\[ThinSpace]\_2\) F\_1\), "(", RowBox[{ RowBox[{ TagBox[\(1\/2\), (Editable -> True)], ",", TagBox[\(1\/2\), (Editable -> True)]}], ";", TagBox[\(3\/2\), (Editable -> True)], ";", TagBox[\(z\^2\), (Editable -> True)]}], ")"}], InterpretTemplate[ Hypergeometric2F1[ #, #2, #3, #4]&]]}], "//", "PowerExpand"}], TraditionalForm]], "Input"], Cell[BoxData[ \(TraditionalForm\`\(sin\^\(-1\)\)(z)\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ FormBox[ RowBox[{ TagBox[ RowBox[{\(\(\[ThinSpace]\_0\) F\_1\), "(", RowBox[{ TagBox[ InterpretationBox["\[InvisibleSpace]", {}], (Editable -> False)], ";", TagBox[ TagBox[ TagBox["1", (Editable -> True)], InterpretTemplate[ { SlotSequence[ 1]}&]], (Editable -> False)], ";", TagBox[\(-\(z\^2\/4\)\), (Editable -> True)]}], ")"}], InterpretTemplate[ HypergeometricPFQ[ #, #2, #3]&]], "//", "PowerExpand"}], TraditionalForm]], "Input"], Cell[BoxData[ \(TraditionalForm\`\(J\_0\)(z)\)], "Output"] }, Open ]], Cell[TextData[{ "In the Advanced Tutorial notes for the 1992 ", StyleBox["Mathematica", FontSlant->"Italic"], " Conferences, Kelly Roach outlines a simple algorithm for converting \ Maclaurin series into hypergeometric functions. Given the series expansion ", Cell[BoxData[ \(TraditionalForm \`y(x) == \[Sum]\+\(n = 0\)\%\[Infinity] y\_n\ x\^n\)]], ", then, if the ratios ", Cell[BoxData[ \(TraditionalForm\`y\_\(n + 1\)/y\_n\)]], " are rational functions in ", StyleBox["n", FontSlant->"Italic"], ", and we can write:" }], "Text", CellTags->{"Maclaurin series", "hypergeometric functions"}], Cell[BoxData[ FormBox[ RowBox[{\(r\_n\), "=", RowBox[{\((n + 1)\), FormBox[\(y\_\(n + 1\)\/y\_n = c\), "TraditionalForm"], FractionBox[ RowBox[{\(\[Product]\+\(i = 1\)\%p\), TagBox[\((n + a\_i)\), Pochhammer]}], \(\[Product]\+\(i = 1\)\%q\((n + b\_i)\)\)]}]}], TraditionalForm]], "DisplayFormula"], Cell[TextData[{ "for some ", Cell[BoxData[ \(TraditionalForm\`a\_i\)]], ", ", Cell[BoxData[ \(TraditionalForm\`b\_i\)]], ", and ", Cell[BoxData[ \(TraditionalForm\`c\)]], " independent of ", Cell[BoxData[ \(TraditionalForm\`n\)]], ", then" }], "Text"], Cell[BoxData[ FormBox[ RowBox[{\(y(x)\), "=", RowBox[{\(y\_0\), RowBox[{ TagBox[ RowBox[{\(\(\[ThinSpace]\_p\) F\_q\), "(", RowBox[{ TagBox[ TagBox[ RowBox[{ TagBox[\(a\_1\), (Editable -> True)], ",", TagBox[\(a\_2\), (Editable -> True)], ",", TagBox["\[Ellipsis]", (Editable -> True)], ",", TagBox[\(a\_p\), (Editable -> True)]}], InterpretTemplate[ { SlotSequence[ 1]}&]], (Editable -> False)], ";", TagBox[ TagBox[ RowBox[{ TagBox[\(b\_1\), (Editable -> True)], ",", TagBox[\(b\_2\), (Editable -> True)], ",", TagBox["\[Ellipsis]", (Editable -> True)], ",", TagBox[\(b\_q\), (Editable -> True)]}], InterpretTemplate[ { SlotSequence[ 1]}&]], (Editable -> False)], ";", TagBox[\(c\ x\), (Editable -> True)]}], ")"}], InterpretTemplate[ HypergeometricPFQ[ #, #2, #3]&]], "."}]}]}], TraditionalForm]], "DisplayFormula"], Cell[TextData[{ "For the series above, the ", Cell[BoxData[ \(TraditionalForm\`y\_n\)]], " are" }], "Text", CellTags->"CoefficientList"], Cell[CellGroupData[{ Cell[BoxData[ \(TraditionalForm\`CoefficientList(\[ScriptS], x)\)], "Input"], Cell[BoxData[ \(TraditionalForm\`{1, \(-2\), 3, \(-4\), 5}\)], "Output"] }, Open ]], Cell[TextData[{ "with ", StyleBox["r", FontSlant->"Italic"], StyleBox["n", FontSize->9, FontSlant->"Italic", FontVariations->{"CompatibilityType"->"Subscript"}] }], "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(TraditionalForm \`\(Rest(%\/\(RotateRight(%)\))\)\ \(Range(Length(%) - 1)\)\)], "Input"], Cell[BoxData[ \(TraditionalForm\`{\(-2\), \(-3\), \(-4\), \(-5\)}\)], "Output"] }, Open ]], Cell["The general term of this sequence is", "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(TraditionalForm \`InterpolatingPolynomial({%, Range(Length(%)) - 1}\^T, n)\)], "Input"], Cell[BoxData[ \(TraditionalForm\`\(-n\) - 2\)], "Output"] }, Open ]], Cell[TextData[{ "as the index ", Cell[BoxData[ \(TraditionalForm\`n\)]], " starts at 0. Reading off the ", Cell[BoxData[ \(TraditionalForm\`a\_i\)]], ", ", Cell[BoxData[ \(TraditionalForm\`b\_i\)]], ", and ", Cell[BoxData[ \(TraditionalForm\`c\)]], StyleBox[", ", FontSlant->"Italic"], "we have " }], "Text"], Cell[CellGroupData[{ Cell[BoxData[ FormBox[ TagBox[ RowBox[{\(\(\[ThinSpace]\_1\) F\_0\), "(", RowBox[{ TagBox[ TagBox[ TagBox["2", (Editable -> True)], InterpretTemplate[ { SlotSequence[ 1]}&]], (Editable -> False)], ";", TagBox[ InterpretationBox["\[InvisibleSpace]", {}], (Editable -> False)], ";", TagBox[\(-x\), (Editable -> True)]}], ")"}], InterpretTemplate[ HypergeometricPFQ[ #, #2, #3]&]], TraditionalForm]], "Input"], Cell[BoxData[ \(TraditionalForm\`1\/\((x + 1)\)\^2\)], "Output"] }, Open ]], Cell["which agrees with the result obtained above. ", "Text"], Cell[TextData[{ "To determine the ", Cell[BoxData[ \(TraditionalForm\`a\_i\)]], ", ", Cell[BoxData[ \(TraditionalForm\`b\_i\)]], ", and ", Cell[BoxData[ \(TraditionalForm\`c\)]], " in general we write" }], "Text"], Cell[BoxData[ FormBox[ RowBox[{ RowBox[{\(r\_n\), "=", FormBox[ RowBox[{\(\(P(n)\)\/\(Q(n)\)\), ",", RowBox[{\(P(n)\), "=", RowBox[{\(\[Sum]\+\(i = 0\)\%p\), TagBox[\(\(p\_i\) n\^i\), Pochhammer]}]}], ",", " ", RowBox[{\(Q(n)\), "=", RowBox[{"1", "+", RowBox[{\(\[Sum]\+\(i = 1\)\%q\), TagBox[\(\(q\_i\) n\^i\), Pochhammer]}]}]}]}], "TraditionalForm"]}], ","}], TraditionalForm]], "DisplayFormula"], Cell[TextData[{ "(since the denominator must not vanish). Since this identity must hold for \ all ", Cell[BoxData[ \(TraditionalForm\`n = 1, 2, \[Ellipsis], \)]], " one obtains a ", StyleBox["linear", FontSlant->"Italic"], " set of equations for the ", Cell[BoxData[ \(TraditionalForm\`p\_i\)]], " and ", Cell[BoxData[ \(TraditionalForm\`q\_i\)]], ":" }], "Text"], Cell[BoxData[ FormBox[ RowBox[{\(\(Q(n)\) r\_n\), "-", RowBox[{ FormBox[ RowBox[{\(P(n) \[Equal] 0 \[Implies] r\_n\), "=", RowBox[{ RowBox[{\(\[Sum]\+\(i = 0\)\%p\), TagBox[\(\(p\_i\) n\^i\), Pochhammer]}], "-", RowBox[{\(r\_n\), RowBox[{\(\[Sum]\+\(i = 1\)\%q\), TagBox[\(\(q\_i\) n\^i\), Pochhammer]}]}]}]}], "TraditionalForm"], "."}]}], TraditionalForm]], "DisplayFormula"], Cell[TextData[{ "For example, with ", Cell[BoxData[ \(TraditionalForm\`p = \(q = 2\)\)]], " we have to solve the matrix equation" }], "Text"], Cell[BoxData[ FormBox[ RowBox[{ RowBox[{ RowBox[{"(", GridBox[{ {"1", "1", "1", \(-r\_1\), \(-r\_1\)}, {"1", "2", "4", \(\(-2\)\ r\_2\), \(\(-4\)\ r\_2\)}, {"1", "3", "9", \(\(-3\)\ r\_3\), \(\(-9\)\ r\_3\)}, {"1", "4", "16", \(\(-4\)\ r\_4\), \(\(-16\)\ r\_4\)}, {"1", "5", "25", \(\(-5\)\ r\_5\), \(\(-25\)\ r\_5\)} }], ")"}], ".", RowBox[{"(", GridBox[{ {\(p\_0\)}, {\(p\_1\)}, {\(p\_2\)}, {\(q\_1\)}, {\(q\_2\)} }], ")"}]}], "\[Equal]", RowBox[{ RowBox[{"(", GridBox[{ {\(r\_1\)}, {\(r\_2\)}, {\(r\_3\)}, {\(r\_4\)}, {\(r\_5\)} }], ")"}], "."}]}], TraditionalForm]], "DisplayFormula"], Cell[TextData[{ "for ", Cell[BoxData[ \(TraditionalForm\`p\_i\)]], " and ", Cell[BoxData[ \(TraditionalForm\`q\_i\)]], ".This matrix can be used to exactly determine rational functions with \ numerator and denominator degree ", Cell[BoxData[ \(TraditionalForm\`\( \[LessEqual] 2\)\)]], ". It is straightforward to generalize the method to any degree." }], "Text", CellTags->"rational functions"], Cell["\<\ Let us apply this method to the truncated series (polynomial)\ \>", "Text"], Cell[BoxData[ \(TraditionalForm \`\(\[ScriptS] = 1 - x + x\^2\/\(2!\) - x\^3\/\(3!\) + x\^4\/\(4!\) - x\^5\/\(5!\); \)\)], "Input"], Cell[TextData[{ "Computing the ", Cell[BoxData[ \(TraditionalForm\`r\_n\)]], ":" }], "Text"], Cell[BoxData[ \(TraditionalForm \`ratios(\[ScriptS]_, x_) := With({\[ScriptC] = CoefficientList(\[ScriptS], x)}, \(Rest(\[ScriptC]\/\(RotateRight(\[ScriptC])\))\)\ \(Range(Length(\[ScriptC]) - 1)\))\)], "Input"], Cell[CellGroupData[{ Cell[BoxData[ \(TraditionalForm\`\[ScriptR] = ratios(\[ScriptS], x)\)], "Input"], Cell[BoxData[ \(TraditionalForm\`{\(-1\), \(-1\), \(-1\), \(-1\), \(-1\)}\)], "Output"] }, Open ]], Cell["then, after loading", "Text"], Cell[BoxData[ \(TraditionalForm\`Needs("\<LinearAlgebra`MatrixManipulation`\>")\)], "Input"], Cell["we can construct the above matrix as follows:", "Text"], Cell[BoxData[ \(TraditionalForm\`\(p = \(q = 2\); \)\)], "Input"], Cell[BoxData[ \(TraditionalForm \`\[ScriptCapitalP] := Table(n\^j, {n, p + q + 1}, {j, 0, p})\)], "Input"], Cell[BoxData[ \(TraditionalForm \`\[ScriptCapitalQ] := \(-\(Table( \[ScriptR]\[LeftDoubleBracket]n\[RightDoubleBracket]\ n\^j, {n, p + q + 1}, {j, q})\)\)\)], "Input"], Cell[CellGroupData[{ Cell[BoxData[ FormBox[ RowBox[{"BlockMatrix", "(", RowBox[{"(", GridBox[{ {"\[ScriptCapitalP]", "\[ScriptCapitalQ]"} }], ")"}], ")"}], TraditionalForm]], "Input"], Cell[BoxData[ FormBox[ RowBox[{"(", GridBox[{ {"1", "1", "1", "1", "1"}, {"1", "2", "4", "2", "4"}, {"1", "3", "9", "3", "9"}, {"1", "4", "16", "4", "16"}, {"1", "5", "25", "5", "25"} }, ColumnAlignments->{Decimal}], ")"}], TraditionalForm]], "Output"] }, Open ]], Cell[TextData[{ "One could use Solve to determine the ", Cell[BoxData[ \(TraditionalForm\`p\_i\)]], " and ", Cell[BoxData[ \(TraditionalForm\`q\_i\)]], " but, since we have a linear system of equations in matrix notation, ", Cell[BoxData[ FormBox[ StyleBox["LinearSolve", "Input"], TraditionalForm]]], " is more efficient:" }], "Text", CellTags->{"linear system of equations", "LinearSolve", "Solve"}], Cell[CellGroupData[{ Cell[BoxData[ \(TraditionalForm\`LinearSolve(%, \[ScriptR])\)], "Input"], Cell[BoxData[ \(TraditionalForm\`{\(-1\), 0, 0, 0, 0}\)], "Output"] }, Open ]], Cell["The rational function becomes", "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(TraditionalForm \`\(Take(%, p + 1)\) . \(Table(n\^i, {i, 0, p})\)\/\(\(Take(%, \(-q\))\) . \(Table(n\^i, {i, q})\) + 1\)\)], "Input"], Cell[BoxData[ \(TraditionalForm\`\(-1\)\)], "Output"] }, Open ]], Cell["\<\ This expression factorises (as required for the series to be \ hypergeometric):\ \>", "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(TraditionalForm \`Factor(%) /. b_. + n\ a_Integer \[Rule] a\ \((b\/a + n)\)\)], "Input"], Cell[BoxData[ \(TraditionalForm\`\(-1\)\)], "Output"] }, Open ]], Cell["with overall multiplicative constant", "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(TraditionalForm \`\[ScriptC] = \(% /. b_. + n\ a_Integer \[Rule] a\) /. n + b_. \[Rule] 1\)], "Input"], Cell[BoxData[ \(TraditionalForm\`\(-1\)\)], "Output"] }, Open ]], Cell["The ratio", "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(TraditionalForm\`%%\/\[ScriptC]\)], "Input"], Cell[BoxData[ \(TraditionalForm\`1\)], "Output"] }, Open ]], Cell["\<\ reveals that the general term of the (hypergeometric) series \ is\ \>", "Text"], Cell[CellGroupData[{ Cell[BoxData[ FormBox[ RowBox[{ RowBox[{"Simplify", "(", RowBox[{ RowBox[{\(1\/\(m!\)\), RowBox[{"(", RowBox[{"%", "/.", RowBox[{\(n\ a_. + b_. \), "\[Rule]", RowBox[{"a", " ", TagBox[\(\((b\/a + 1)\)\_m\), Pochhammer]}]}]}], ")"}], " ", \(\((\[ScriptC]\ x)\)\^m\)}], "/.", FormBox[\(m \[Rule] n\), "TraditionalForm"]}], ")"}], "//", "Factor"}], TraditionalForm]], "Input"], Cell[BoxData[ \(TraditionalForm\`\((\(-x\))\)\^n\/\(n!\)\)], "Output"] }, Open ]], Cell["The (infinite) series reduces to:", "Text"], Cell[CellGroupData[{ Cell[BoxData[ FormBox[ RowBox[{"Factor", "[", RowBox[{\(\[Sum]\+\(n = 0\)\%\[Infinity]\), FormBox["%", "TraditionalForm"]}], "]"}], TraditionalForm]], "Input"], Cell[BoxData[ \(TraditionalForm\`\[ExponentialE]\^\(-x\)\)], "Output"] }, Open ]], Cell["\<\ Alternatively, we can compute the sum directly as a hypergeometric \ function:\ \>", "Text"], Cell[CellGroupData[{ Cell[BoxData[ FormBox[ TagBox[ RowBox[{\(\(\[ThinSpace]\_0\) F\_0\), "(", RowBox[{ TagBox[ InterpretationBox["\[InvisibleSpace]", {}], (Editable -> False)], ";", TagBox[ InterpretationBox["\[InvisibleSpace]", {}], (Editable -> False)], ";", TagBox[\(-x\), (Editable -> True)]}], ")"}], InterpretTemplate[ HypergeometricPFQ[ #, #2, #3]&]], TraditionalForm]], "Input"], Cell[BoxData[ \(TraditionalForm\`\[ExponentialE]\^\(-x\)\)], "Output"] }, Open ]], Cell["As a check, we can expand this into a Maclaurin series:", "Text"], Cell[CellGroupData[{ Cell[BoxData[ FormBox[ RowBox[{"%", "-", " ", "\[ScriptS]", " ", "+", " ", FormBox[\(\(O(x)\)\^6\), "TraditionalForm"]}], TraditionalForm]], "Input"], Cell[BoxData[ FormBox[ InterpretationBox[\(O(x\^6)\), SeriesData[ x, 0, {}, 6, 6, 1]], TraditionalForm]], "Output"] }, Open ]], Cell["Note that this method is not restricted to numerical series:", "Text"], Cell[BoxData[ \(TraditionalForm \`\(\[ScriptS] = 1 - \(\[Alpha]\ x\)\/\(\[Alpha] + 1\) + \(\[Alpha]\ x\^2\)\/\(\(2!\)\ \((\[Alpha] + 2)\)\) - \(\[Alpha]\ x\^3\)\/\(\(3!\)\ \((\[Alpha] + 3)\)\); \)\)], "Input"], Cell["The successive ratios are simple:", "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(TraditionalForm\`\[ScriptR] = ratios(%, x)\)], "Input"], Cell[BoxData[ \(TraditionalForm \`{\(-\(\[Alpha]\/\(\[Alpha] + 1\)\)\), \(-\(\(\[Alpha] + 1\)\/\(\[Alpha] + 2\)\)\), \(-\(\(\[Alpha] + 2\)\/\(\[Alpha] + 3\)\)\)}\)], "Output"] }, Open ]], Cell["and with", "Text"], Cell[BoxData[ \(TraditionalForm\`\(p = \(q = 1\); \)\)], "Input"], Cell["the matrix reads", "Text"], Cell[CellGroupData[{ Cell[BoxData[ FormBox[ RowBox[{"BlockMatrix", "(", RowBox[{"(", GridBox[{ {"\[ScriptCapitalP]", "\[ScriptCapitalQ]"} }], ")"}], ")"}], TraditionalForm]], "Input"], Cell[BoxData[ FormBox[ RowBox[{"(", GridBox[{ {"1", "1", \(\[Alpha]\/\(\[Alpha] + 1\)\)}, {"1", "2", \(\(2\ \((\[Alpha] + 1)\)\)\/\(\[Alpha] + 2\)\)}, {"1", "3", \(\(3\ \((\[Alpha] + 2)\)\)\/\(\[Alpha] + 3\)\)} }], ")"}], TraditionalForm]], "Output"] }, Open ]], Cell["Solving the linear system of equations:", "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(TraditionalForm\`LinearSolve(%, \[ScriptR]) // Factor\)], "Input"], Cell[BoxData[ \(TraditionalForm \`{\(-\(\(\[Alpha] - 1\)\/\[Alpha]\)\), \(-\(1\/\[Alpha]\)\), 1\/\[Alpha]} \)], "Output"] }, Open ]], Cell["the rational function is", "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(TraditionalForm \`\(Take(%, p + 1)\) . \(Table(n\^i, {i, 0, p})\)\/\(\(Take(%, \(-q\))\) . \(Table(n\^i, {i, q})\) + 1\) // Factor\)], "Input"], Cell[BoxData[ \(TraditionalForm\`\(-\(\(n + \[Alpha] - 1\)\/\(n + \[Alpha]\)\)\)\)], "Output"] }, Open ]], Cell["and the general term of the series reads:", "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(TraditionalForm \`\[ScriptC] = \(% /. b_. + n\ a_Integer \[Rule] a\) /. n + b_. \[Rule] 1\)], "Input"], Cell[BoxData[ \(TraditionalForm\`\(-1\)\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ FormBox[ RowBox[{"Simplify", "(", FractionBox[ RowBox[{ RowBox[{"(", RowBox[{\(%%\/\[ScriptC]\), "/.", RowBox[{\(n\ a_. + b_. \), "\[Rule]", RowBox[{"a", " ", TagBox[\(\((b\/a + 1)\)\_n\), Pochhammer]}]}]}], ")"}], " ", \(\((\[ScriptC]\ x)\)\^n\)}], \(n!\)], ")"}], TraditionalForm]], "Input"], Cell[BoxData[ FormBox[ FractionBox[ RowBox[{\(\((\(-x\))\)\^n\), " ", TagBox[\(\((\[Alpha])\)\_n\), Pochhammer]}], RowBox[{\(n!\), " ", TagBox[\(\((\[Alpha] + 1)\)\_n\), Pochhammer]}]], TraditionalForm]], "Output"] }, Open ]], Cell["which leads to the hypergeometric function", "Text"], Cell[CellGroupData[{ Cell[BoxData[ FormBox[ TagBox[ RowBox[{\(\(\[ThinSpace]\_1\) F\_1\), "(", RowBox[{ TagBox[ TagBox[ TagBox["\[Alpha]", (Editable -> True)], InterpretTemplate[ { SlotSequence[ 1]}&]], (Editable -> False)], ";", TagBox[ TagBox[ TagBox[\(\[Alpha] + 1\), (Editable -> True)], InterpretTemplate[ { SlotSequence[ 1]}&]], (Editable -> False)], ";", TagBox[\(-x\), (Editable -> True)]}], ")"}], InterpretTemplate[ HypergeometricPFQ[ #, #2, #3]&]], TraditionalForm]], "Input"], Cell[BoxData[ \(TraditionalForm \`x\^\(-\[Alpha]\)\ \((\[CapitalGamma](\[Alpha] + 1) - \[Alpha]\ \(\[CapitalGamma](\[Alpha], x)\))\)\)], "Output"] }, Open ]], Cell["Alternatively, the infinite series yields", "Text"], Cell[CellGroupData[{ Cell[BoxData[ FormBox[ RowBox[{\(\[Sum]\+\(n = 0\)\%\[Infinity]\), FormBox[ FractionBox[ RowBox[{\(\((\(-x\))\)\^n\), " ", TagBox[\(\((\[Alpha])\)\_n\), Pochhammer]}], RowBox[{\(n!\), " ", TagBox[\(\((\[Alpha] + 1)\)\_n\), Pochhammer]}]], "TraditionalForm"]}], TraditionalForm]], "Input"], Cell[BoxData[ \(TraditionalForm \`\[Alpha]\ \((x\^\(-\[Alpha]\)\ \(\[CapitalGamma](\[Alpha])\) - x\^\(-\[Alpha]\)\ \(\[CapitalGamma](\[Alpha], x)\))\)\)], "Output"] }, Open ]], Cell["\<\ With some work this could be turned into a package for converting \ the first few terms of a (hypergeometric) series into the corresponding \ (minimal) hypergeometric function.\ \>", "Text"] }, Open ]] }]