Note 04-Apr-2021: This page is abandoned, it's new home is https://fricas.github.io/fricas-notebooks/FriCAS-TaylorSeries.html Example for multivariate Taylor series expansionUnivariate TaylorSeriesFriCAS can deal with power series in a simple manner. fricas (1) -> )version fricas x:=taylor 'x
fricas sinh(x)
However, sometimes one wants to be more precise with the domain that the object lives in. If, for example, we don't want power series over the general expression domain as exemplified above, we can give the coefficient domain explicitly. fricas Z ==> Integer Type: Void
fricas Q ==> Fraction Z Type: Void
fricas Ux ==> UnivariateTaylorSeries(Q, Type: Void
fricas ux: Ux := 'x
fricas sinh(ux)
Combination of univariate TaylorSeriesThe FriCAS interpreter is smart enough to create an appropriate type if two univariate Taylor series interact. However, as seen below, the resulting domain is something like fricas Uy ==> UnivariateTaylorSeries(Q, Type: Void
fricas uy: Uy := 'y
fricas cosh(uy)
fricas sinh(ux)*cosh(uy) As a general rule, the FriCAS interpreter tries to find a "better coefficient domain" if something does not fit into the type of the current object in order to construct a more general domain that can hold the result of the operation. In the case above that is probably not what we expected or wanted. Multivariate TaylorSeries in infinitely many variables There is a domain in FriCAS that is similar to the With that domain the input is as simple as for univariate power series. fricas T ==> TaylorSeries Q Type: Void
fricas tx:T := 'x
Type: TaylorSeries(Fraction(Integer))
fricas ty:T := 'y
Type: TaylorSeries(Fraction(Integer))
fricas sinh(tx)*cosh(ty)
Type: TaylorSeries(Fraction(Integer)) Multivariate TaylorSeries in two variablesFriCAS allows to be more precise with multivariate power series. It is possible to create multivariate power series in a given number of variables. Such a construction is, however, a bit more involved. The domain (named Thus we first have to create a bivariate polynomial domain. From this construction, it should be clear how to create multivariate series in three or more variables. fricas vl: List Symbol := ['x,
Type: List(Symbol)
fricas V ==> OrderedVariableList vl Type: Void
fricas P ==> SparseMultivariatePolynomial(Q, Type: Void
fricas M ==> SparseMultivariateTaylorSeries(Q, Type: Void
fricas X: M := monomial(1$M,
Type: SparseMultivariateTaylorSeries(Fraction(Integer),
fricas Y: M := monomial(1$M,
Type: SparseMultivariateTaylorSeries(Fraction(Integer),
fricas sinh(X)*cosh(Y)
Type: SparseMultivariateTaylorSeries(Fraction(Integer),
Multivariate Taylor series with unknown coefficientsWe want to generate taylor series with unknown coefficients. fricas )clear completely Type: List(Symbol)
fricas V ==> OrderedVariableList vl Type: Void
fricas Q ==> Expression Integer Type: Void
fricas P ==> SparseMultivariatePolynomial(Q, Type: Void
fricas M ==> SparseMultivariateTaylorSeries(Q, Type: Void
fricas X: M := monomial(1$M,
Type: SparseMultivariateTaylorSeries(Expression(Integer),
fricas Y: M := monomial(1$M,
Type: SparseMultivariateTaylorSeries(Expression(Integer),
fricas sx:M := recip(1-X)
Type: SparseMultivariateTaylorSeries(Expression(Integer),
fricas sy:M := recip(1-Y)
Type: SparseMultivariateTaylorSeries(Expression(Integer),
fricas s1 := sx*sy
Type: SparseMultivariateTaylorSeries(Expression(Integer), We can create power series with unknown coefficients. fricas a: Symbol := 'a; Type: Symbol
fricas fp(p:P):P == (pp:P := 0; e:=enumerate()$V; for m in monomials p repeat (l:=degree(m, Type: Void
fricas st1: Stream P := coefficients s1; fricas ast1: Stream P := map(fp, fricas Compiling function fp with type SparseMultivariatePolynomial( Expression(Integer), fricas a1: M := series ast1; Type: SparseMultivariateTaylorSeries(Expression(Integer),
fricas t:=(X+Y-1)*a1; Type: SparseMultivariateTaylorSeries(Expression(Integer),
fricas coefficient(t,
fricas c := concat [coefficients coefficient(t,
Type: List(Expression(Integer))
fricas variables first c
Type: List(Symbol)
fricas vars: List Symbol := concat [variables z for z in c]
Type: List(Symbol)
fricas v: List Symbol := [u for u in members set vars]
Type: List(Symbol)
fricas es:=cons(a[0,
Type: List(Expression(Integer)) Unfortunately, removing the semicolon from the end of the following command makes trouble for LaTeX. fricas result:=solve([e=0 for e in es], Type: List(List(Equation(Expression(Integer)))) Bill Page: It seems to be a problem with encoding a list of lists. fricas for i in result repeat outputAsTex(i)
Type: Void
|