@@ -1745,34 +1745,41 @@ def to_sympy(self, expr: Expression, **kwargs):
17451745
17461746class Series (Builtin ):
17471747 """
1748- <url>:WMA link:https://reference.wolfram.com/language/ref/Series.html</url>
1748+ <url>:WMA link:https://reference.wolfram.com/language/ref/Series.html</url>
17491749
1750- <dl>
1751- <dt>'Series[$f$, {$x$, $x0$, $n$}]'
1752- <dd>Represents the series expansion around '$x$=$x0$' up to order $n$.
1753- </dl>
1750+ <dl>
1751+ <dt>'Series[$f$, {$x$, $x0$, $n$}]'
1752+ <dd>Represents the series expansion around '$x$=$x0$' up to order $n$.
1753+ </dl>
17541754
1755- For elementary expressions, 'Series' returns the explicit power series as a 'SeriesData' expression:
1756- >> Series[Exp[x], {x,0,2}]
1757- = 1 + x + 1 / 2 x ^ 2 + O[x] ^ 3
1758- >> % // FullForm
1759- = SeriesData[x, 0, {1,1,Rational[1, 2]}, 0, 3, 1]
1760- Replacing the variable by a value, the series will not be evaluated as
1761- an expression, but as a 'SeriesData' object:
1762- >> s = Series[Exp[x^2],{x,0,2}]
1763- = 1 + x ^ 2 + O[x] ^ 3
1764- >> s /. x->4
1765- = 1 + 4 ^ 2 + O[4] ^ 3
1766-
1767- 'Normal' transforms a 'SeriesData' expression into a polynomial:
1768- >> s // Normal
1769- = 1 + x ^ 2
1770- >> (s // Normal) /. x-> 4
1771- = 17
1772- >> Clear[s];
1773- We can also expand over multiple variables
1774- >> Series[Exp[x-y], {x, 0, 2}, {y, 0, 2}]
1775- = (1 - y + 1 / 2 y ^ 2 + O[y] ^ 3) + (1 - y + 1 / 2 y ^ 2 + O[y] ^ 3) x + (1 / 2 + (-1 / 2) y + 1 / 4 y ^ 2 + O[y] ^ 3) x ^ 2 + O[x] ^ 3
1755+ For elementary expressions, 'Series' returns the explicit power series as a 'SeriesData' expression:
1756+ >> series = Series[Exp[x^2], {x,0,2}]
1757+ = 1 + x ^ 2 + O[x] ^ 3
1758+
1759+ The expression created is a 'SeriesData' object:
1760+ >> series // FullForm
1761+ = SeriesData[x, 0, {1,0,1}, 0, 3, 1]
1762+
1763+ Replacing $x$ with does a value produces another 'SeriesData' object:
1764+ >> series /. x->4
1765+ = 1 + 4 ^ 2 + O[4] ^ 3
1766+
1767+ 'Normal' transforms a 'SeriesData' expression into a polynomial:
1768+ >> series // Normal
1769+ = 1 + x ^ 2
1770+ >> (series // Normal) /. x-> 4
1771+ = 17
1772+ >> Clear[series];
1773+
1774+ We can also expand over multiple variables:
1775+ >> Series[Exp[x-y], {x, 0, 2}, {y, 0, 2}]
1776+ = (1 - y + 1 / 2 y ^ 2 + O[y] ^ 3) + (1 - y + 1 / 2 y ^ 2 + O[y] ^ 3) x + (1 / 2 + (-1 / 2) y + 1 / 4 y ^ 2 + O[y] ^ 3) x ^ 2 + O[x] ^ 3
1777+
1778+ See also <url>
1779+ :'SeriesCoefficient':
1780+ /doc/reference-of-built-in-symbols/integer-and-number-theoretical-functions/calculus/seriescoefficient/</url> and <url>
1781+ :'SeriesData':
1782+ /doc/reference-of-built-in-symbols/integer-and-number-theoretical-functions/calculus/seriesdata/</url>.
17761783
17771784 """
17781785
@@ -1782,7 +1789,7 @@ class Series(Builtin):
17821789 "sspec" : "Series specification `1` is not a list with three elements." ,
17831790 }
17841791
1785- summary_text = "power series and asymptotic expansions"
1792+ summary_text = "compute power series and asymptotic expansions"
17861793
17871794 def eval_series (self , f , x , x0 , n , evaluation : Evaluation ):
17881795 """Series[f_, {x_Symbol, x0_, n_Integer}]"""
@@ -1810,13 +1817,24 @@ class SeriesCoefficient(Builtin):
18101817
18111818 <dl>
18121819 <dt>'SeriesCoefficient[$series$, $n$]'
1813- <dd>Find the $n$th coefficient in the given $series$
1820+ <dd>Find the $n$th coefficient in the given $series$.
1821+
1822+ <dt>'SeriesCoefficient[$f$, {$x$, $x0$, $n$}]'
1823+ <dd>Find the ($x$-$x0$)^n in the expansion of $f$ about the point $x$=$x0$.
18141824 </dl>
18151825
1816- >> SeriesCoefficient[Series[Exp[Sin[x]], {x, 0, 10}], 8]
1817- = 31 / 5760
1818- >> SeriesCoefficient[Exp[-x], {x, 0, 5}]
1819- = -1 / 120
1826+ First we list 5 terms of a series:
1827+ >> Series[Exp[Sin[x]], {x, 0, 5}]
1828+ = 1 + x + 1 / 2 x ^ 2 + (-1 / 8) x ^ 4 + (-1 / 15) x ^ 5 + O[x] ^ 6
1829+
1830+ Now get the $x$^4 coefficient:
1831+ >> SeriesCoefficient[%, 4]
1832+ = -1 / 8
1833+
1834+ Do the same thing, but without calling 'Series' first:
1835+ >> SeriesCoefficient[Exp[Sin[x]], {x, 0, 4}]
1836+ = -1 / 8
1837+
18201838 >> SeriesCoefficient[2x, {x, 0, 2}]
18211839 = 0
18221840
@@ -1826,14 +1844,19 @@ class SeriesCoefficient(Builtin):
18261844 = 0
18271845 >> SeriesCoefficient[SeriesData[x, c, Table[i^2, {i, 10}], 7, 17, 3], 17/3]
18281846 = Indeterminate
1847+
1848+ See also <url>
1849+ :'Series':
1850+ /doc/reference-of-built-in-symbols/integer-and-number-theoretical-functions/calculus/series/</url> and <url>
1851+ :'SeriesData':
1852+ /doc/reference-of-built-in-symbols/integer-and-number-theoretical-functions/calculus/seriesdata/</url>.
18291853 """
18301854
18311855 attributes = A_PROTECTED
1832- summary_text = "power series coefficient"
1833-
18341856 rules = {
18351857 "SeriesCoefficient[f_, {x_Symbol, x0_, n_Integer}]" : "SeriesCoefficient[Series[f, {x, x0, n}], n]"
18361858 }
1859+ summary_text = "compute power series coefficient"
18371860
18381861 def eval (self , series : Expression , n : Rational , evaluation : Evaluation ):
18391862 """SeriesCoefficient[series_SeriesData, n_]"""
@@ -1856,25 +1879,48 @@ class SeriesData(Builtin):
18561879 <url>:WMA link:https://reference.wolfram.com/language/ref/SeriesData.html</url>
18571880
18581881 <dl>
1859- <dt>'SeriesData[...]'
1860- <dd>Represents a series expansion.
1882+ <dt>'SeriesData[$x$, $x0$, {$a0$, $a1$, ...}, $nmin$, $nmax$, $den$]'
1883+ <dd>produces a power series in the variable $x$ about point $x0$. The \
1884+ $ai$ are the coefficients of the power series. The powers of ($x$-$x0$) that appear \
1885+ are $nmin$/$den$, ($nmin$+1)/$den$, ..., $nmax$/$den$.
18611886 </dl>
18621887
1863- Sum of two series:
1864- >> Series[Cosh[x],{x,0,2}] + Series[Sinh[x],{x,0,3}]
1888+ 'SeriesData' is the 'Head' of expressions generated by 'Series':
1889+
1890+ >> series = Series[Cosh[x],{x,0,2}]
1891+ = 1 + 1 / 2 x ^ 2 + O[x] ^ 3
1892+
1893+ >> Head[series]
1894+ = SeriesData
1895+
1896+ >> series // FullForm
1897+ = SeriesData[x, 0, {1,0,Rational[1, 2]}, 0, 3, 1]
1898+
1899+ You can apply certain mathematical operations to 'SeriesData' objects to get \
1900+ new 'SeriesData' objects truncated to the appropriate order.
1901+
1902+ >> series + Series[Sinh[x],{x,0,3}]
18651903 = 1 + x + 1 / 2 x ^ 2 + O[x] ^ 3
1904+
18661905 >> Series[f[x],{x,0,2}] * g[w]
18671906 = f[0] g[w] + g[w] f'[0] x + g[w] f''[0] / 2 x ^ 2 + O[x] ^ 3
1868- The product of two series on the same neighbourhood of the same variable are multiplied
1907+
1908+ The product of two series on the same neighborhood of the same variable are multiplied:
18691909 >> Series[Exp[-a x],{x,0,2}] * Series[Exp[-b x],{x,0,2}]
18701910 = 1 + (-a - b) x + (a ^ 2 / 2 + a b + b ^ 2 / 2) x ^ 2 + O[x] ^ 3
18711911 >> D[Series[Exp[-a x],{x,0,2}],a]
18721912 = -x + a x ^ 2 + O[x] ^ 3
1913+
1914+ See also <url>
1915+ :'Series':
1916+ /doc/reference-of-built-in-symbols/integer-and-number-theoretical-functions/calculus/series/</url> and <url>
1917+ :'SeriesCoefficient':
1918+ /doc/reference-of-built-in-symbols/integer-and-number-theoretical-functions/calculus/seriescoefficient/</url>.
18731919 """
18741920
18751921 # TODO: Implement sum, product and composition of series
18761922
1877- summary_text = "power series of a variable about a point"
1923+ summary_text = "compute power series of a variable about a point"
18781924
18791925 def eval_reduce (
18801926 self , x , x0 , data , nummin : Integer , nummax : Integer , den , evaluation : Evaluation
0 commit comments