MultivariatePowerSeries/Copy - Maple Help

MultivariatePowerSeries

 Copy
 Copy a power series or univariate polynomial over power series

 Calling Sequence Copy(p) Copy(u)

Parameters

 p - power series generated by this package u - univariate polynomial over power series generated by this package

Description

 • Copy(p) returns a copy of p. If p is subsequently modified (for example by computing extra coefficients, or modifying the display style), these changes are not reflected in p, and vice versa.  Note that p and its copy may share ancestors, that is, power series from which p was computed.
 • Copy(u) returns a copy of u, constructed from copies of the coefficients of u. The coefficients of u and its copy may share ancestors.
 • When using the MultivariatePowerSeries package, do not assign anything to the variables occurring in the power series and univariate polynomials over power series. If you do, you may see invalid results.

Examples

 > $\mathrm{with}\left(\mathrm{MultivariatePowerSeries}\right):$

We create two power series, $a$ and $b$.

 > $a≔\mathrm{Inverse}\left(\mathrm{PowerSeries}\left(1+x-y\right)\right):$
 > $b≔\mathrm{Inverse}\left(\mathrm{PowerSeries}\left({y}^{2}-x+1\right)\right):$

The power series $c$ keeps a record of $a$ and $b$ as its ancestors.

 > $c≔a+b$
 ${c}{≔}\left[{PowⅇrSⅇriⅇs of}\frac{{1}}{{1}{+}{x}{-}{y}}{+}\frac{{1}}{{{y}}^{{2}}{-}{x}{+}{1}}{:}{2}{+}{\dots }\right]$ (1)
 > $d≔\mathrm{Copy}\left(c\right)$
 ${d}{≔}\left[{PowⅇrSⅇriⅇs of}\frac{{1}}{{1}{+}{x}{-}{y}}{+}\frac{{1}}{{{y}}^{{2}}{-}{x}{+}{1}}{:}{2}{+}{\dots }\right]$ (2)

We can set the display styles for $c$ and $d$ independently. We ensure that enough terms are computed to show the difference.

 > $\mathrm{SetDisplayStyle}\left(c,\left['\mathrm{precision}'=7\right]\right)$
 $\left[{\mathrm{precision}}{=}{7}\right]$ (3)
 > $\mathrm{SetDisplayStyle}\left(d,\left['\mathrm{precision}'=4\right]\right)$
 $\left[{\mathrm{precision}}{=}{4}\right]$ (4)
 > $\mathrm{UpdatePrecision}\left(c,7\right):$$\mathrm{UpdatePrecision}\left(d,7\right):$
 > $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{4}}{-}{4}{}{{x}}^{{3}}{}{y}{+}{3}{}{{x}}^{{2}}{}{{y}}^{{2}}{-}{4}{}{x}{}{{y}}^{{3}}{+}{2}{}{{y}}^{{4}}{+}{\dots }\right]$ (6)

The power series $d$ is a copy of $c$, however, they share $a$ and $b$, therefore when more terms of $c$ are computed, the precision of $a$ and $b$ will be updated too. Consequently, the computation of new terms of $d$ must be cheaper as it does not involve computing the coefficients of $a$ and $b$.

 > $\mathrm{gc}\left(\right):$
 > $\mathrm{CodeTools}:-\mathrm{Usage}\left(\mathrm{HomogeneousPart}\left(c,500\right)\right):$
 memory used=143.48MiB, alloc change=115.65MiB, cpu time=2.41s, real time=2.23s, gc time=408.37ms
 > $\mathrm{Precision}\left(a\right)$
 ${500}$ (7)
 > $\mathrm{Precision}\left(b\right)$
 ${500}$ (8)
 > $\mathrm{Precision}\left(c\right)$
 ${500}$ (9)
 > $\mathrm{Precision}\left(d\right)$
 ${7}$ (10)
 > $\mathrm{gc}\left(\right):$
 > $\mathrm{CodeTools}:-\mathrm{Usage}\left(\mathrm{HomogeneousPart}\left(d,500\right)\right):$
 memory used=6.70MiB, alloc change=0 bytes, cpu time=45.00ms, real time=46.00ms, gc time=0ns
 > $\mathrm{Precision}\left(d\right)$
 ${500}$ (11)

Compatibility

 • The MultivariatePowerSeries[Copy] command was introduced in Maple 2021.