This notebook is licenced under CC BY-SA 4.0.

# FriCAS Tutorial (Univariate and Multivariate Taylor Series)¶

## Ralf Hemmecke <ralf@hemmecke.org>¶

Sources at Github.

In [1]:
)set message type off
)set output algebra off
my: M := monomial(1$M, 'y, 1); sinh(mx)*cosh(my) Out[23]: Out[23]: Out[23]: Out[23]: Out[23]: Out[23]: Out[23]: $x+\left(\frac{1}{6}\, {x}^{3}+\frac{1}{2}\, {y}^{2}\, x\right)+\left(\frac{1}{120}\, {x}^{5}+\frac{1}{12}\, {y}^{2}\, {x}^{3}+\frac{1}{24}\, {y}^{4}\, x\right)+\left(\frac{1}{5040}\, {x}^{7}+\frac{1}{240}\, {y}^{2}\, {x}^{5}+\frac{1}{144}\, {y}^{4}\, {x}^{3}+\frac{1}{720}\, {y}^{6}\, x\right)+\left(\frac{1}{362880}\, {x}^{9}+\frac{1}{10080}\, {y}^{2}\, {x}^{7}+\frac{1}{2880}\, {y}^{4}\, {x}^{5}+\frac{1}{4320}\, {y}^{6}\, {x}^{3}+\frac{1}{40320}\, {y}^{8}\, x\right)+O\left(11\right)$ In [24]: t0 := 1 - mx - mx*my Out[24]: $1-x-y\, x$ In [25]: t1: M := 1/t0 Out[25]: $1+x+\left({x}^{2}+y\, x\right)+\left({x}^{3}+2\, y\, {x}^{2}\right)+\left({x}^{4}+3\, y\, {x}^{3}+{y}^{2}\, {x}^{2}\right)+\left({x}^{5}+4\, y\, {x}^{4}+3\, {y}^{2}\, {x}^{3}\right)+\left({x}^{6}+5\, y\, {x}^{5}+6\, {y}^{2}\, {x}^{4}+{y}^{3}\, {x}^{3}\right)+\left({x}^{7}+6\, y\, {x}^{6}+10\, {y}^{2}\, {x}^{5}+4\, {y}^{3}\, {x}^{4}\right)+\left({x}^{8}+7\, y\, {x}^{7}+15\, {y}^{2}\, {x}^{6}+10\, {y}^{3}\, {x}^{5}+{y}^{4}\, {x}^{4}\right)+\left({x}^{9}+8\, y\, {x}^{8}+21\, {y}^{2}\, {x}^{7}+20\, {y}^{3}\, {x}^{6}+5\, {y}^{4}\, {x}^{5}\right)+\left({x}^{10}+9\, y\, {x}^{9}+28\, {y}^{2}\, {x}^{8}+35\, {y}^{3}\, {x}^{7}+15\, {y}^{4}\, {x}^{6}+{y}^{5}\, {x}^{5}\right)+O\left(11\right)$ In [26]: t2: M := 1/t1 Out[26]: $1-x-y\, x+O\left(11\right)$ ## Multivariate Taylor series with unknown coefficients¶ We want to generate taylor series with unknown coefficients. In [33]: vl: List Symbol := ['x, 'y]; V ==> OrderedVariableList vl E ==> Expression Integer R ==> SparseMultivariatePolynomial(E, V) S ==> SparseMultivariateTaylorSeries(E, V, R) X: S := monomial(1$R, 'x, 1);
Y: S := monomial(1$R, 'y, 1); Out[33]: Out[33]: Out[33]: Out[33]: Out[33]: Out[33]: Out[33]: In [34]: sx:S := recip(1-X) Out[34]: $1+x+{x}^{2}+{x}^{3}+{x}^{4}+{x}^{5}+{x}^{6}+{x}^{7}+{x}^{8}+{x}^{9}+{x}^{10}+O\left(11\right)$ In [35]: sy:S := recip(1-Y) Out[35]: $1+y+{y}^{2}+{y}^{3}+{y}^{4}+{y}^{5}+{y}^{6}+{y}^{7}+{y}^{8}+{y}^{9}+{y}^{10}+O\left(11\right)$ In [36]: s1 := sx*sy Out[36]: $1+\left(x+y\right)+\left({x}^{2}+y\, x+{y}^{2}\right)+\left({x}^{3}+y\, {x}^{2}+{y}^{2}\, x+{y}^{3}\right)+\left({x}^{4}+y\, {x}^{3}+{y}^{2}\, {x}^{2}+{y}^{3}\, x+{y}^{4}\right)+\left({x}^{5}+y\, {x}^{4}+{y}^{2}\, {x}^{3}+{y}^{3}\, {x}^{2}+{y}^{4}\, x+{y}^{5}\right)+\left({x}^{6}+y\, {x}^{5}+{y}^{2}\, {x}^{4}+{y}^{3}\, {x}^{3}+{y}^{4}\, {x}^{2}+{y}^{5}\, x+{y}^{6}\right)+\left({x}^{7}+y\, {x}^{6}+{y}^{2}\, {x}^{5}+{y}^{3}\, {x}^{4}+{y}^{4}\, {x}^{3}+{y}^{5}\, {x}^{2}+{y}^{6}\, x+{y}^{7}\right)+\left({x}^{8}+y\, {x}^{7}+{y}^{2}\, {x}^{6}+{y}^{3}\, {x}^{5}+{y}^{4}\, {x}^{4}+{y}^{5}\, {x}^{3}+{y}^{6}\, {x}^{2}+{y}^{7}\, x+{y}^{8}\right)+\left({x}^{9}+y\, {x}^{8}+{y}^{2}\, {x}^{7}+{y}^{3}\, {x}^{6}+{y}^{4}\, {x}^{5}+{y}^{5}\, {x}^{4}+{y}^{6}\, {x}^{3}+{y}^{7}\, {x}^{2}+{y}^{8}\, x+{y}^{9}\right)+\left({x}^{10}+y\, {x}^{9}+{y}^{2}\, {x}^{8}+{y}^{3}\, {x}^{7}+{y}^{4}\, {x}^{6}+{y}^{5}\, {x}^{5}+{y}^{6}\, {x}^{4}+{y}^{7}\, {x}^{3}+{y}^{8}\, {x}^{2}+{y}^{9}\, x+{y}^{10}\right)+O\left(11\right)$ In [37]: a: Symbol := 'a; Out[37]: We create a function that turns each monomial with exponent vector$l$into a monomial with unknown coefficient$a(l)$. In [38]: fr(r:R):R == rr: R := 0; e := enumerate()$V;
for m in monomials r repeat
l := degree(m, e); -- List Integer
rr := rr + a(l)*m -- L is turned into List(OutputForm) here.
rr
Function declaration fr : SparseMultivariatePolynomial(Expression(Integer),
OrderedVariableList([x,y])) -> SparseMultivariatePolynomial(Expression(
Integer),OrderedVariableList([x,y])) has been added to workspace.
Out[38]:
In [39]:
st1: Stream R := coefficients s1
Out[39]:
$\left[1, x+y, {x}^{2}+y\, x+{y}^{2}, {x}^{3}+y\, {x}^{2}+{y}^{2}\, x+{y}^{3}, {x}^{4}+y\, {x}^{3}+{y}^{2}\, {x}^{2}+{y}^{3}\, x+{y}^{4}, {x}^{5}+y\, {x}^{4}+{y}^{2}\, {x}^{3}+{y}^{3}\, {x}^{2}+{y}^{4}\, x+{y}^{5}, {x}^{6}+y\, {x}^{5}+{y}^{2}\, {x}^{4}+{y}^{3}\, {x}^{3}+{y}^{4}\, {x}^{2}+{y}^{5}\, x+{y}^{6}, {x}^{7}+y\, {x}^{6}+{y}^{2}\, {x}^{5}+{y}^{3}\, {x}^{4}+{y}^{4}\, {x}^{3}+{y}^{5}\, {x}^{2}+{y}^{6}\, x+{y}^{7}, {x}^{8}+y\, {x}^{7}+{y}^{2}\, {x}^{6}+{y}^{3}\, {x}^{5}+{y}^{4}\, {x}^{4}+{y}^{5}\, {x}^{3}+{y}^{6}\, {x}^{2}+{y}^{7}\, x+{y}^{8}, {x}^{9}+y\, {x}^{8}+{y}^{2}\, {x}^{7}+{y}^{3}\, {x}^{6}+{y}^{4}\, {x}^{5}+{y}^{5}\, {x}^{4}+{y}^{6}\, {x}^{3}+{y}^{7}\, {x}^{2}+{y}^{8}\, x+{y}^{9}, \ldots \right]$
In [40]:
ast1: Stream R := map(fr, st1)
Compiling function fr with type SparseMultivariatePolynomial(Expression(
Integer),OrderedVariableList([x,y])) -> SparseMultivariatePolynomial(
Expression(Integer),OrderedVariableList([x,y]))
Out[40]:
$\left[{a}_{0, 0}, {a}_{1, 0}\, x+{a}_{0, 1}\, y, {a}_{2, 0}\, {x}^{2}+{a}_{1, 1}\, y\, x+{a}_{0, 2}\, {y}^{2}, {a}_{3, 0}\, {x}^{3}+{a}_{2, 1}\, y\, {x}^{2}+{a}_{1, 2}\, {y}^{2}\, x+{a}_{0, 3}\, {y}^{3}, {a}_{4, 0}\, {x}^{4}+{a}_{3, 1}\, y\, {x}^{3}+{a}_{2, 2}\, {y}^{2}\, {x}^{2}+{a}_{1, 3}\, {y}^{3}\, x+{a}_{0, 4}\, {y}^{4}, {a}_{5, 0}\, {x}^{5}+{a}_{4, 1}\, y\, {x}^{4}+{a}_{3, 2}\, {y}^{2}\, {x}^{3}+{a}_{2, 3}\, {y}^{3}\, {x}^{2}+{a}_{1, 4}\, {y}^{4}\, x+{a}_{0, 5}\, {y}^{5}, {a}_{6, 0}\, {x}^{6}+{a}_{5, 1}\, y\, {x}^{5}+{a}_{4, 2}\, {y}^{2}\, {x}^{4}+{a}_{3, 3}\, {y}^{3}\, {x}^{3}+{a}_{2, 4}\, {y}^{4}\, {x}^{2}+{a}_{1, 5}\, {y}^{5}\, x+{a}_{0, 6}\, {y}^{6}, {a}_{7, 0}\, {x}^{7}+{a}_{6, 1}\, y\, {x}^{6}+{a}_{5, 2}\, {y}^{2}\, {x}^{5}+{a}_{4, 3}\, {y}^{3}\, {x}^{4}+{a}_{3, 4}\, {y}^{4}\, {x}^{3}+{a}_{2, 5}\, {y}^{5}\, {x}^{2}+{a}_{1, 6}\, {y}^{6}\, x+{a}_{0, 7}\, {y}^{7}, {a}_{8, 0}\, {x}^{8}+{a}_{7, 1}\, y\, {x}^{7}+{a}_{6, 2}\, {y}^{2}\, {x}^{6}+{a}_{5, 3}\, {y}^{3}\, {x}^{5}+{a}_{4, 4}\, {y}^{4}\, {x}^{4}+{a}_{3, 5}\, {y}^{5}\, {x}^{3}+{a}_{2, 6}\, {y}^{6}\, {x}^{2}+{a}_{1, 7}\, {y}^{7}\, x+{a}_{0, 8}\, {y}^{8}, {a}_{9, 0}\, {x}^{9}+{a}_{8, 1}\, y\, {x}^{8}+{a}_{7, 2}\, {y}^{2}\, {x}^{7}+{a}_{6, 3}\, {y}^{3}\, {x}^{6}+{a}_{5, 4}\, {y}^{4}\, {x}^{5}+{a}_{4, 5}\, {y}^{5}\, {x}^{4}+{a}_{3, 6}\, {y}^{6}\, {x}^{3}+{a}_{2, 7}\, {y}^{7}\, {x}^{2}+{a}_{1, 8}\, {y}^{8}\, x+{a}_{0, 9}\, {y}^{9}, \ldots \right]$
In [41]:
a1: S := series ast1
Out[41]:
${a}_{0, 0}+\left({a}_{1, 0}\, x+{a}_{0, 1}\, y\right)+\left({a}_{2, 0}\, {x}^{2}+{a}_{1, 1}\, y\, x+{a}_{0, 2}\, {y}^{2}\right)+\left({a}_{3, 0}\, {x}^{3}+{a}_{2, 1}\, y\, {x}^{2}+{a}_{1, 2}\, {y}^{2}\, x+{a}_{0, 3}\, {y}^{3}\right)+\left({a}_{4, 0}\, {x}^{4}+{a}_{3, 1}\, y\, {x}^{3}+{a}_{2, 2}\, {y}^{2}\, {x}^{2}+{a}_{1, 3}\, {y}^{3}\, x+{a}_{0, 4}\, {y}^{4}\right)+\left({a}_{5, 0}\, {x}^{5}+{a}_{4, 1}\, y\, {x}^{4}+{a}_{3, 2}\, {y}^{2}\, {x}^{3}+{a}_{2, 3}\, {y}^{3}\, {x}^{2}+{a}_{1, 4}\, {y}^{4}\, x+{a}_{0, 5}\, {y}^{5}\right)+\left({a}_{6, 0}\, {x}^{6}+{a}_{5, 1}\, y\, {x}^{5}+{a}_{4, 2}\, {y}^{2}\, {x}^{4}+{a}_{3, 3}\, {y}^{3}\, {x}^{3}+{a}_{2, 4}\, {y}^{4}\, {x}^{2}+{a}_{1, 5}\, {y}^{5}\, x+{a}_{0, 6}\, {y}^{6}\right)+\left({a}_{7, 0}\, {x}^{7}+{a}_{6, 1}\, y\, {x}^{6}+{a}_{5, 2}\, {y}^{2}\, {x}^{5}+{a}_{4, 3}\, {y}^{3}\, {x}^{4}+{a}_{3, 4}\, {y}^{4}\, {x}^{3}+{a}_{2, 5}\, {y}^{5}\, {x}^{2}+{a}_{1, 6}\, {y}^{6}\, x+{a}_{0, 7}\, {y}^{7}\right)+\left({a}_{8, 0}\, {x}^{8}+{a}_{7, 1}\, y\, {x}^{7}+{a}_{6, 2}\, {y}^{2}\, {x}^{6}+{a}_{5, 3}\, {y}^{3}\, {x}^{5}+{a}_{4, 4}\, {y}^{4}\, {x}^{4}+{a}_{3, 5}\, {y}^{5}\, {x}^{3}+{a}_{2, 6}\, {y}^{6}\, {x}^{2}+{a}_{1, 7}\, {y}^{7}\, x+{a}_{0, 8}\, {y}^{8}\right)+\left({a}_{9, 0}\, {x}^{9}+{a}_{8, 1}\, y\, {x}^{8}+{a}_{7, 2}\, {y}^{2}\, {x}^{7}+{a}_{6, 3}\, {y}^{3}\, {x}^{6}+{a}_{5, 4}\, {y}^{4}\, {x}^{5}+{a}_{4, 5}\, {y}^{5}\, {x}^{4}+{a}_{3, 6}\, {y}^{6}\, {x}^{3}+{a}_{2, 7}\, {y}^{7}\, {x}^{2}+{a}_{1, 8}\, {y}^{8}\, x+{a}_{0, 9}\, {y}^{9}\right)+\left({a}_{10, 0}\, {x}^{10}+{a}_{9, 1}\, y\, {x}^{9}+{a}_{8, 2}\, {y}^{2}\, {x}^{8}+{a}_{7, 3}\, {y}^{3}\, {x}^{7}+{a}_{6, 4}\, {y}^{4}\, {x}^{6}+{a}_{5, 5}\, {y}^{5}\, {x}^{5}+{a}_{4, 6}\, {y}^{6}\, {x}^{4}+{a}_{3, 7}\, {y}^{7}\, {x}^{3}+{a}_{2, 8}\, {y}^{8}\, {x}^{2}+{a}_{1, 9}\, {y}^{9}\, x+{a}_{0, 10}\, {y}^{10}\right)+O\left(11\right)$
In [42]:
t:=(X+Y-1)*a1
Out[42]:
$-{a}_{0, 0}+\left(\left(-{a}_{1, 0}+{a}_{0, 0}\right)\, x+\left(-{a}_{0, 1}+{a}_{0, 0}\right)\, y\right)+\left(\left(-{a}_{2, 0}+{a}_{1, 0}\right)\, {x}^{2}+\left(-{a}_{1, 1}+{a}_{1, 0}+{a}_{0, 1}\right)\, y\, x+\left(-{a}_{0, 2}+{a}_{0, 1}\right)\, {y}^{2}\right)+\left(\left(-{a}_{3, 0}+{a}_{2, 0}\right)\, {x}^{3}+\left(-{a}_{2, 1}+{a}_{2, 0}+{a}_{1, 1}\right)\, y\, {x}^{2}+\left(-{a}_{1, 2}+{a}_{1, 1}+{a}_{0, 2}\right)\, {y}^{2}\, x+\left(-{a}_{0, 3}+{a}_{0, 2}\right)\, {y}^{3}\right)+\left(\left(-{a}_{4, 0}+{a}_{3, 0}\right)\, {x}^{4}+\left(-{a}_{3, 1}+{a}_{3, 0}+{a}_{2, 1}\right)\, y\, {x}^{3}+\left(-{a}_{2, 2}+{a}_{2, 1}+{a}_{1, 2}\right)\, {y}^{2}\, {x}^{2}+\left(-{a}_{1, 3}+{a}_{1, 2}+{a}_{0, 3}\right)\, {y}^{3}\, x+\left(-{a}_{0, 4}+{a}_{0, 3}\right)\, {y}^{4}\right)+\left(\left(-{a}_{5, 0}+{a}_{4, 0}\right)\, {x}^{5}+\left(-{a}_{4, 1}+{a}_{4, 0}+{a}_{3, 1}\right)\, y\, {x}^{4}+\left(-{a}_{3, 2}+{a}_{3, 1}+{a}_{2, 2}\right)\, {y}^{2}\, {x}^{3}+\left(-{a}_{2, 3}+{a}_{2, 2}+{a}_{1, 3}\right)\, {y}^{3}\, {x}^{2}+\left(-{a}_{1, 4}+{a}_{1, 3}+{a}_{0, 4}\right)\, {y}^{4}\, x+\left(-{a}_{0, 5}+{a}_{0, 4}\right)\, {y}^{5}\right)+\left(\left(-{a}_{6, 0}+{a}_{5, 0}\right)\, {x}^{6}+\left(-{a}_{5, 1}+{a}_{5, 0}+{a}_{4, 1}\right)\, y\, {x}^{5}+\left(-{a}_{4, 2}+{a}_{4, 1}+{a}_{3, 2}\right)\, {y}^{2}\, {x}^{4}+\left(-{a}_{3, 3}+{a}_{3, 2}+{a}_{2, 3}\right)\, {y}^{3}\, {x}^{3}+\left(-{a}_{2, 4}+{a}_{2, 3}+{a}_{1, 4}\right)\, {y}^{4}\, {x}^{2}+\left(-{a}_{1, 5}+{a}_{1, 4}+{a}_{0, 5}\right)\, {y}^{5}\, x+\left(-{a}_{0, 6}+{a}_{0, 5}\right)\, {y}^{6}\right)+\left(\left(-{a}_{7, 0}+{a}_{6, 0}\right)\, {x}^{7}+\left(-{a}_{6, 1}+{a}_{6, 0}+{a}_{5, 1}\right)\, y\, {x}^{6}+\left(-{a}_{5, 2}+{a}_{5, 1}+{a}_{4, 2}\right)\, {y}^{2}\, {x}^{5}+\left(-{a}_{4, 3}+{a}_{4, 2}+{a}_{3, 3}\right)\, {y}^{3}\, {x}^{4}+\left(-{a}_{3, 4}+{a}_{3, 3}+{a}_{2, 4}\right)\, {y}^{4}\, {x}^{3}+\left(-{a}_{2, 5}+{a}_{2, 4}+{a}_{1, 5}\right)\, {y}^{5}\, {x}^{2}+\left(-{a}_{1, 6}+{a}_{1, 5}+{a}_{0, 6}\right)\, {y}^{6}\, x+\left(-{a}_{0, 7}+{a}_{0, 6}\right)\, {y}^{7}\right)+\left(\left(-{a}_{8, 0}+{a}_{7, 0}\right)\, {x}^{8}+\left(-{a}_{7, 1}+{a}_{7, 0}+{a}_{6, 1}\right)\, y\, {x}^{7}+\left(-{a}_{6, 2}+{a}_{6, 1}+{a}_{5, 2}\right)\, {y}^{2}\, {x}^{6}+\left(-{a}_{5, 3}+{a}_{5, 2}+{a}_{4, 3}\right)\, {y}^{3}\, {x}^{5}+\left(-{a}_{4, 4}+{a}_{4, 3}+{a}_{3, 4}\right)\, {y}^{4}\, {x}^{4}+\left(-{a}_{3, 5}+{a}_{3, 4}+{a}_{2, 5}\right)\, {y}^{5}\, {x}^{3}+\left(-{a}_{2, 6}+{a}_{2, 5}+{a}_{1, 6}\right)\, {y}^{6}\, {x}^{2}+\left(-{a}_{1, 7}+{a}_{1, 6}+{a}_{0, 7}\right)\, {y}^{7}\, x+\left(-{a}_{0, 8}+{a}_{0, 7}\right)\, {y}^{8}\right)+\left(\left(-{a}_{9, 0}+{a}_{8, 0}\right)\, {x}^{9}+\left(-{a}_{8, 1}+{a}_{8, 0}+{a}_{7, 1}\right)\, y\, {x}^{8}+\left(-{a}_{7, 2}+{a}_{7, 1}+{a}_{6, 2}\right)\, {y}^{2}\, {x}^{7}+\left(-{a}_{6, 3}+{a}_{6, 2}+{a}_{5, 3}\right)\, {y}^{3}\, {x}^{6}+\left(-{a}_{5, 4}+{a}_{5, 3}+{a}_{4, 4}\right)\, {y}^{4}\, {x}^{5}+\left(-{a}_{4, 5}+{a}_{4, 4}+{a}_{3, 5}\right)\, {y}^{5}\, {x}^{4}+\left(-{a}_{3, 6}+{a}_{3, 5}+{a}_{2, 6}\right)\, {y}^{6}\, {x}^{3}+\left(-{a}_{2, 7}+{a}_{2, 6}+{a}_{1, 7}\right)\, {y}^{7}\, {x}^{2}+\left(-{a}_{1, 8}+{a}_{1, 7}+{a}_{0, 8}\right)\, {y}^{8}\, x+\left(-{a}_{0, 9}+{a}_{0, 8}\right)\, {y}^{9}\right)+\left(\left(-{a}_{10, 0}+{a}_{9, 0}\right)\, {x}^{10}+\left(-{a}_{9, 1}+{a}_{9, 0}+{a}_{8, 1}\right)\, y\, {x}^{9}+\left(-{a}_{8, 2}+{a}_{8, 1}+{a}_{7, 2}\right)\, {y}^{2}\, {x}^{8}+\left(-{a}_{7, 3}+{a}_{7, 2}+{a}_{6, 3}\right)\, {y}^{3}\, {x}^{7}+\left(-{a}_{6, 4}+{a}_{6, 3}+{a}_{5, 4}\right)\, {y}^{4}\, {x}^{6}+\left(-{a}_{5, 5}+{a}_{5, 4}+{a}_{4, 5}\right)\, {y}^{5}\, {x}^{5}+\left(-{a}_{4, 6}+{a}_{4, 5}+{a}_{3, 6}\right)\, {y}^{6}\, {x}^{4}+\left(-{a}_{3, 7}+{a}_{3, 6}+{a}_{2, 7}\right)\, {y}^{7}\, {x}^{3}+\left(-{a}_{2, 8}+{a}_{2, 7}+{a}_{1, 8}\right)\, {y}^{8}\, {x}^{2}+\left(-{a}_{1, 9}+{a}_{1, 8}+{a}_{0, 9}\right)\, {y}^{9}\, x+\left(-{a}_{0, 10}+{a}_{0, 9}\right)\, {y}^{10}\right)+O\left(11\right)$
In [43]:
coefficient(t,3)
Out[43]:
$\left(-{a}_{3, 0}+{a}_{2, 0}\right)\, {x}^{3}+\left(-{a}_{2, 1}+{a}_{2, 0}+{a}_{1, 1}\right)\, y\, {x}^{2}+\left(-{a}_{1, 2}+{a}_{1, 1}+{a}_{0, 2}\right)\, {y}^{2}\, x+\left(-{a}_{0, 3}+{a}_{0, 2}\right)\, {y}^{3}$
In [44]:
c := concat [coefficients coefficient(t, n) for n in 0..4]
Out[44]:
$\left[-{a}_{0, 0}, -{a}_{1, 0}+{a}_{0, 0}, -{a}_{0, 1}+{a}_{0, 0}, -{a}_{2, 0}+{a}_{1, 0}, -{a}_{1, 1}+{a}_{1, 0}+{a}_{0, 1}, -{a}_{0, 2}+{a}_{0, 1}, -{a}_{3, 0}+{a}_{2, 0}, -{a}_{2, 1}+{a}_{2, 0}+{a}_{1, 1}, -{a}_{1, 2}+{a}_{1, 1}+{a}_{0, 2}, -{a}_{0, 3}+{a}_{0, 2}, -{a}_{4, 0}+{a}_{3, 0}, -{a}_{3, 1}+{a}_{3, 0}+{a}_{2, 1}, -{a}_{2, 2}+{a}_{2, 1}+{a}_{1, 2}, -{a}_{1, 3}+{a}_{1, 2}+{a}_{0, 3}, -{a}_{0, 4}+{a}_{0, 3}\right]$
In [45]:
variables first c
Out[45]:
$\left[{a}_{0, 0}\right]$
In [46]:
vars: List Symbol := concat [variables z for z in c]
Out[46]:
$\left[{a}_{0, 0}, {a}_{0, 0}, {a}_{1, 0}, {a}_{0, 0}, {a}_{0, 1}, {a}_{1, 0}, {a}_{2, 0}, {a}_{0, 1}, {a}_{1, 0}, {a}_{1, 1}, {a}_{0, 1}, {a}_{0, 2}, {a}_{2, 0}, {a}_{3, 0}, {a}_{1, 1}, {a}_{2, 0}, {a}_{2, 1}, {a}_{0, 2}, {a}_{1, 1}, {a}_{1, 2}, {a}_{0, 2}, {a}_{0, 3}, {a}_{3, 0}, {a}_{4, 0}, {a}_{2, 1}, {a}_{3, 0}, {a}_{3, 1}, {a}_{1, 2}, {a}_{2, 1}, {a}_{2, 2}, {a}_{0, 3}, {a}_{1, 2}, {a}_{1, 3}, {a}_{0, 3}, {a}_{0, 4}\right]$
In [47]:
v: List Symbol := [u for u in members set vars]
Out[47]:
$\left[{a}_{0, 0}, {a}_{0, 1}, {a}_{0, 2}, {a}_{0, 3}, {a}_{0, 4}, {a}_{1, 0}, {a}_{1, 1}, {a}_{1, 2}, {a}_{1, 3}, {a}_{2, 0}, {a}_{2, 1}, {a}_{2, 2}, {a}_{3, 0}, {a}_{3, 1}, {a}_{4, 0}\right]$
In [48]:
es:=cons(a[0,0]-1, rest c)
Out[48]:
$\left[{a}_{0, 0}-1, -{a}_{1, 0}+{a}_{0, 0}, -{a}_{0, 1}+{a}_{0, 0}, -{a}_{2, 0}+{a}_{1, 0}, -{a}_{1, 1}+{a}_{1, 0}+{a}_{0, 1}, -{a}_{0, 2}+{a}_{0, 1}, -{a}_{3, 0}+{a}_{2, 0}, -{a}_{2, 1}+{a}_{2, 0}+{a}_{1, 1}, -{a}_{1, 2}+{a}_{1, 1}+{a}_{0, 2}, -{a}_{0, 3}+{a}_{0, 2}, -{a}_{4, 0}+{a}_{3, 0}, -{a}_{3, 1}+{a}_{3, 0}+{a}_{2, 1}, -{a}_{2, 2}+{a}_{2, 1}+{a}_{1, 2}, -{a}_{1, 3}+{a}_{1, 2}+{a}_{0, 3}, -{a}_{0, 4}+{a}_{0, 3}\right]$
In [49]:
result:=solve([e=0 for e in es], v)
Out[49]:
$\left[\left[{a}_{0, 0}=1, {a}_{0, 1}=1, {a}_{0, 2}=1, {a}_{0, 3}=1, {a}_{0, 4}=1, {a}_{1, 0}=1, {a}_{1, 1}=2, {a}_{1, 2}=3, {a}_{1, 3}=4, {a}_{2, 0}=1, {a}_{2, 1}=3, {a}_{2, 2}=6, {a}_{3, 0}=1, {a}_{3, 1}=4, {a}_{4, 0}=1\right]\right]$

## Univariate Taylor series with unknown coefficients¶

In [52]:
a: Symbol := 'a
st: Stream E := [a[i::OutputForm] for i in 0..]

series(st)\$SparseUnivariateTaylorSeries(E,'x,0)
Compiled code for fr has been cleared.
Out[52]:
$a$
Out[52]:
$\left[{a}_{0}, {a}_{1}, {a}_{2}, {a}_{3}, {a}_{4}, {a}_{5}, {a}_{6}, {a}_{7}, {a}_{8}, {a}_{9}, \ldots \right]$
Out[52]:
${a}_{0}+{a}_{1}\, x+{a}_{2}\, {x}^{2}+{a}_{3}\, {x}^{3}+{a}_{4}\, {x}^{4}+{a}_{5}\, {x}^{5}+{a}_{6}\, {x}^{6}+{a}_{7}\, {x}^{7}+{a}_{8}\, {x}^{8}+{a}_{9}\, {x}^{9}+{a}_{10}\, {x}^{10}+O\left({x}^{11}\right)$