 AddFunction - Maple Help

MultiSeries

 add new function definition to MultiSeries
 RemoveFunction
 remove function definition from MultiSeries
 GetFunction
 get function definition from MultiSeries
 FunctionSupported
 check if a function definition is supported in MultiSeries Calling Sequence AddFunction(g, f) RemoveFunction(g) GetFunction(g) FunctionSupported(g) Parameters

 g - function name f - procedure Description

 • The AddFunction(g, f) command, a library extension mechanism, adds a definition related to the function g to MultiSeries, where f is a user-defined procedure which handles multiseries containing the function g.
 For example, let f be a user-defined function for g.  To add this information to the multiseries function, use AddFunction(g, eval(f,1)).
 • For example, after issuing AddFunction(g, f), the function call $\mathrm{multiseries}\left(f\left(x\right),x,3\right)$ will invoke $g\left(s,\mathrm{scale},\mathrm{varlist},3\right)$ to compute the multiseries. The arguments are the multiseries expansion of the argument of $f$, the scale in which the expansion is performed, the variable with respect to which the expansion is computed, and the order (see multiseries). Note that the function g must return a SERIES data structure or 0, not just a polynomial (see type[SERIES]).
 • The RemoveFunction(g) command removes a definition related to the function g from the multiseries function.
 For example, to remove the information from the multiseries function, use RemoveFunction(g).
 • The GetFunction(g) command returns a procedure related to the function g, provided that such a procedure exists. Otherwise, it returns NULL.
 • The FunctionSupported(g) command returns true if a definition of the function g is known to the multiseries function. It returns false otherwise. Examples

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

MultiSeries does not know about function mysin:

 > $\mathrm{series}\left(\mathrm{mysin}\left(x\right),x\right)$
 ${\mathrm{mysin}}{}\left({0}\right){+}{\mathrm{D}}{}\left({\mathrm{mysin}}\right){}\left({0}\right){}{x}{+}\frac{{1}}{{2}}{}{{\mathrm{D}}}^{\left({2}\right)}{}\left({\mathrm{mysin}}\right){}\left({0}\right){}{{x}}^{{2}}{+}\frac{{1}}{{6}}{}{{\mathrm{D}}}^{\left({3}\right)}{}\left({\mathrm{mysin}}\right){}\left({0}\right){}{{x}}^{{3}}{+}\frac{{1}}{{24}}{}{{\mathrm{D}}}^{\left({4}\right)}{}\left({\mathrm{mysin}}\right){}\left({0}\right){}{{x}}^{{4}}{+}\frac{{1}}{{120}}{}{{\mathrm{D}}}^{\left({5}\right)}{}\left({\mathrm{mysin}}\right){}\left({0}\right){}{{x}}^{{5}}{+}{O}{}\left({{x}}^{{6}}\right)$ (1)

Let the function mysin act as sin (using AddFunction and GetFunction):

 > $\mathrm{AddFunction}\left(\mathrm{mysin},\mathrm{eval}\left(\mathrm{GetFunction}\left(\mathrm{sin}\right)\right)\right)$

Try MultiSeries[series] on mysin

 > $\mathrm{series}\left(\mathrm{mysin}\left(x\right),x\right)$
 ${\mathrm{mysin}}{}\left({0}\right){+}{\mathrm{D}}{}\left({\mathrm{mysin}}\right){}\left({0}\right){}{x}{+}\frac{{1}}{{2}}{}{{\mathrm{D}}}^{\left({2}\right)}{}\left({\mathrm{mysin}}\right){}\left({0}\right){}{{x}}^{{2}}{+}\frac{{1}}{{6}}{}{{\mathrm{D}}}^{\left({3}\right)}{}\left({\mathrm{mysin}}\right){}\left({0}\right){}{{x}}^{{3}}{+}\frac{{1}}{{24}}{}{{\mathrm{D}}}^{\left({4}\right)}{}\left({\mathrm{mysin}}\right){}\left({0}\right){}{{x}}^{{4}}{+}\frac{{1}}{{120}}{}{{\mathrm{D}}}^{\left({5}\right)}{}\left({\mathrm{mysin}}\right){}\left({0}\right){}{{x}}^{{5}}{+}{O}{}\left({{x}}^{{6}}\right)$ (2)

Now remove the knowledge of sin from MultiSeries (using function RemoveFunction)

 > $\mathrm{FunctionSupported}\left(\mathrm{sin}\right)$
 ${\mathrm{true}}$ (3)
 > $\mathrm{RemoveFunction}\left(\mathrm{sin}\right)$
 > $\mathrm{FunctionSupported}\left(\mathrm{sin}\right)$
 ${\mathrm{false}}$ (4)

Get back to original state:

 > $\mathrm{AddFunction}\left(\mathrm{sin},\mathrm{eval}\left(\mathrm{GetFunction}\left(\mathrm{mysin}\right)\right)\right)$
 > $\mathrm{RemoveFunction}\left(\mathrm{mysin}\right)$
 > $\mathrm{FunctionSupported}\left(\mathrm{sin}\right)$
 ${\mathrm{true}}$ (5)
 > $\mathrm{FunctionSupported}\left(\mathrm{mysin}\right)$
 ${\mathrm{false}}$ (6)
 > $\mathrm{series}\left(\mathrm{sin}\left(x\right),x\right)$
 ${x}{-}\frac{{1}}{{6}}{}{{x}}^{{3}}{+}\frac{{1}}{{120}}{}{{x}}^{{5}}{+}{O}{}\left({{x}}^{{7}}\right)$ (7)
 > $\mathrm{series}\left(\mathrm{mysin}\left(x\right),x\right)$
 ${\mathrm{mysin}}{}\left({0}\right){+}{\mathrm{D}}{}\left({\mathrm{mysin}}\right){}\left({0}\right){}{x}{+}\frac{{1}}{{2}}{}{{\mathrm{D}}}^{\left({2}\right)}{}\left({\mathrm{mysin}}\right){}\left({0}\right){}{{x}}^{{2}}{+}\frac{{1}}{{6}}{}{{\mathrm{D}}}^{\left({3}\right)}{}\left({\mathrm{mysin}}\right){}\left({0}\right){}{{x}}^{{3}}{+}\frac{{1}}{{24}}{}{{\mathrm{D}}}^{\left({4}\right)}{}\left({\mathrm{mysin}}\right){}\left({0}\right){}{{x}}^{{4}}{+}\frac{{1}}{{120}}{}{{\mathrm{D}}}^{\left({5}\right)}{}\left({\mathrm{mysin}}\right){}\left({0}\right){}{{x}}^{{5}}{+}{O}{}\left({{x}}^{{6}}\right)$ (8)