 AddConversionRule - Maple Help

OreTools[Converters]

 FromOrePolyToLinearEquation
 convert an OrePoly structure to the corresponding linear functional equation
 FromLinearEquationToOrePoly
 convert a linear functional equation to the corresponding OrePoly structure
 FromOrePolyToPoly
 convert an OrePoly structure to the corresponding polynomial
 FromPolyToOrePoly
 convert a polynomial to the corresponding OrePoly structure Calling Sequence FromOrePolyToLinearEquation (Ore, f, A) FromLinearEquationToOrePoly (expr, f, A) AddConversionRule (CaseName, ConvertProc) FromOrePolyToPoly(Ore, x) FromPolyToOrePoly(P, x) Parameters

 Ore - Ore polynomial; to define an Ore polynomial, use the OrePoly structure. f - name; dependent variable A - Ore algebra; to define an Ore algebra, use the SetOreRing function. expr - expression; linear functional equation CaseName - name; labels the new conversion case ConvertProc - procedure; algorithm for converting a linear functional equation to an Ore polynomial x - name; noncommutative indeterminate P - polynomial Description

 • The FromOrePolyToLinearEquation(Ore, f, A) calling sequence converts the Ore polynomial Ore to the corresponding linear functional equation.
 • The FromLinearEquationToOrePoly(expr, f, A) calling sequence converts the linear functional equation expr to the corresponding Ore polynomial. The Ore polynomial is returned as an OrePoly structure.
 The FromLinearEquationToOrePoly command currently supports only the shift and differential cases.
 • The AddConversionRule(CaseName, ConvertProc) command adds a new conversion rule from a linear equation to an Ore polynomial to be used by the FromLinearEquationToOrePoly command.
 The ConvertProc procedure must accept three arguments: linear functional equation, name of dependent variable, and Ore algebra; and return an Ore polynomial as an OrePoly structure.
 • The FromOrePolyToPoly(Ore, x) calling sequence converts the Ore polynomial Ore to the corresponding polynomial.
 • The FromPolyToOrePoly(P, x) calling sequence converts the polynomial P to the corresponding Ore polynomial. The Ore polynomial is returned as an OrePoly structure. Examples

 > $\mathrm{with}\left(\mathrm{OreTools}\right):$
 > $\mathrm{with}\left(\mathrm{OreTools}\left[\mathrm{Converters}\right]\right):$

Define the differential algebra.

 > $A≔\mathrm{SetOreRing}\left(x,'\mathrm{differential}'\right)$
 ${A}{≔}{\mathrm{UnivariateOreRing}}{}\left({x}{,}{\mathrm{differential}}\right)$ (1)
 > $L≔\mathrm{OrePoly}\left(1,-x,{x}^{2}+Cx\right)$
 ${L}{≔}{\mathrm{OrePoly}}{}\left({1}{,}{-}{x}{,}{C}{}{x}{+}{{x}}^{{2}}\right)$ (2)
 > $\mathrm{eq}≔\mathrm{FromOrePolyToLinearEquation}\left(L,f,A\right)$
 ${\mathrm{eq}}{≔}{f}{}\left({x}\right){-}{x}{}\left(\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{f}{}\left({x}\right)\right){+}\left({C}{}{x}{+}{{x}}^{{2}}\right){}\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{x}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{f}{}\left({x}\right)\right)$ (3)
 > $\mathrm{FromLinearEquationToOrePoly}\left(\mathrm{eq},f,A\right)$
 ${\mathrm{OrePoly}}{}\left({1}{,}{-}{x}{,}{C}{}{x}{+}{{x}}^{{2}}\right)$ (4)

To convert a linear difference equation to an OrePoly structure, first define the difference polynomial ring.

 > A := SetOreRing(n, 'difference', 'sigma' = proc(p, x) eval(p, x=x+1) end, 'sigma_inverse' = proc(p, x) eval(p, x=x-1) end, 'delta' = proc(p, x) eval(p, x=x+1) - p end, 'theta1' = 0);
 ${A}{≔}{\mathrm{UnivariateOreRing}}{}\left({n}{,}{\mathrm{difference}}\right)$ (5)

Consider the following difference operator.

 > $L≔\mathrm{OrePoly}\left(\frac{{n}^{4}}{n-1},{n}^{4}-{n}^{3},\frac{n-1}{n+2}\right)$
 ${L}{≔}{\mathrm{OrePoly}}{}\left(\frac{{{n}}^{{4}}}{{n}{-}{1}}{,}{{n}}^{{4}}{-}{{n}}^{{3}}{,}\frac{{n}{-}{1}}{{n}{+}{2}}\right)$ (6)

Convert L to a linear difference equation.

 > $\mathrm{eq}≔\mathrm{FromOrePolyToLinearEquation}\left(L,s,A\right)$
 ${\mathrm{eq}}{≔}\frac{{{n}}^{{4}}{}{s}{}\left({n}\right)}{{n}{-}{1}}{+}\left({{n}}^{{4}}{-}{{n}}^{{3}}\right){}\left({s}{}\left({n}{+}{1}\right){-}{s}{}\left({n}\right)\right){+}\frac{\left({n}{-}{1}\right){}\left({s}{}\left({n}{+}{2}\right){-}{2}{}{s}{}\left({n}{+}{1}\right){+}{s}{}\left({n}\right)\right)}{{n}{+}{2}}$ (7)

The FromLinearEquationToOrePoly function cannot convert eq to the corresponding OrePoly structure.

 > $\mathrm{FromLinearEquationToOrePoly}\left(\mathrm{eq},s,A\right)$

You must define the rule for the difference case.

 > difference_case := proc(eq, func, A)      local reqn, info, fcn, E, receq, req, func_set, n, place, i, var;       var := OreTools[Properties][GetVariable](A);       # Do some argument checking and processing       reqn := LREtools['REcreate'](eq, func(var), {});       info := eval(op(4, reqn));       if info['linear']=false then           error "only linear equations are handled"       end if;       n := info['vars'];       if not (nops([n])=1 and type(n, name)) then           error "only single equations are handled"       end if;       fcn := op(2, reqn);       # locate n in arguments to fcn       for place to nops(fcn) while op(place, fcn) <> n do end do;       # Transform the equation from a difference equation to a       # difference operator       req := args;       func_set := indets(req, specfunc(anything, info['functions']));       receq := collect( subs( map( (x, y, z, i) -> x = (z+1)^(op(i, x)-y),           func_set, n, 'E', place), req), 'E', Normalizer);       'OrePoly'(seq(coeff(receq, 'E', i), i=0..degree(receq, 'E')))    end proc:

Add this rule to OreTools, and then use the FromOrePolyToLinearEquation function again.

 > $\mathrm{AddConversionRule}\left('\mathrm{difference}',\mathrm{difference_case}\right)$
 > $\mathrm{FromLinearEquationToOrePoly}\left(\mathrm{eq},s,A\right)$
 ${\mathrm{OrePoly}}{}\left(\frac{{{n}}^{{4}}}{{n}{-}{1}}{,}{{n}}^{{4}}{-}{{n}}^{{3}}{,}\frac{{n}{-}{1}}{{n}{+}{2}}\right)$ (8)
 > $\mathrm{Ore}≔\mathrm{OrePoly}\left(n,n-1,\frac{1}{n}\right)$
 ${\mathrm{Ore}}{≔}{\mathrm{OrePoly}}{}\left({n}{,}{n}{-}{1}{,}\frac{{1}}{{n}}\right)$ (9)
 > $q≔\mathrm{FromOrePolyToPoly}\left(\mathrm{Ore},S\right)$
 ${q}{≔}{n}{+}\left({n}{-}{1}\right){}{S}{+}\frac{{{S}}^{{2}}}{{n}}$ (10)
 > $\mathrm{FromPolyToOrePoly}\left(q,S\right)$
 ${\mathrm{OrePoly}}{}\left({n}{,}{n}{-}{1}{,}\frac{{1}}{{n}}\right)$ (11)