rand_skew_poly - Maple Help

Ore_algebra

 rand_skew_poly
 random skew polynomial generator

 Calling Sequence rand_skew_poly(vars, eqns, Alg)

Parameters

 vars - indeterminate or list or set of indeterminates eqns - (optional) equations specifying properties where option=value Alg - Ore algebra table

Description

 • A rand_skew_poly command generates a random polynomial in the variables vars from the algebra Alg. It is useful for generating test problems for debugging, testing and demonstration purposes.  Several options can be specified, determining the form of the polynomial.  This allows for general expressions with certain properties.
 • The syntax of rand_skew_poly (described below) mimics that of randpoly.
 • The first argument vars specifies the variables in which the polynomial is to be generated.  If vars is a single variable, a univariate polynomial in that variable is generated.  If vars is a list or set of variables, then a multivariate polynomial is generated.
 • The remaining arguments eqns are equations of the form option=value.
 • The possible options (and their default values) are:

 Option Use Default Value coeffs generate the coefficients rand(-99..99) expons generate the exponents rand(6) terms number of terms generated $6$ degree total degree for a dense polynomial $5$ dense the polynomial is to be dense

 Important: The terms option is intended for specifying sparse polynomials, where the number of terms is often significantly smaller than the degree of the polynomial.  The terms option will be overridden by the degree option.  A call rand_skew_poly(x, terms=7) will return a polynomial with 6 terms, since the default degree is five.  If you want a dense polynomial, use the dense option.

Examples

 > $\mathrm{with}\left(\mathrm{Ore_algebra}\right):$
 > $A≔\mathrm{diff_algebra}\left(\left[\mathrm{Dx},x\right]\right):$
 > $\mathrm{rand_skew_poly}\left(x,A\right)$
 ${-}{7}{}{{x}}^{{5}}{+}{22}{}{{x}}^{{4}}{-}{55}{}{{x}}^{{3}}{-}{94}{}{{x}}^{{2}}{+}{87}{}{x}{-}{56}$ (1)
 > $\mathrm{rand_skew_poly}\left(\left[\mathrm{Dx},x\right],\mathrm{terms}=20,A\right)$
 ${-}{7}{}{{\mathrm{Dx}}}^{{5}}{+}\left({-}{40}{}{x}{-}{44}\right){}{{\mathrm{Dx}}}^{{4}}{+}\left({42}{}{{x}}^{{2}}{+}{71}{}{x}{-}{10}\right){}{{\mathrm{Dx}}}^{{3}}{+}\left({-}{50}{}{{x}}^{{3}}{-}{17}{}{{x}}^{{2}}{+}{62}{}{x}\right){}{{\mathrm{Dx}}}^{{2}}{+}\left({23}{}{{x}}^{{4}}{-}{75}{}{{x}}^{{3}}{-}{82}{}{{x}}^{{2}}{-}{4}{}{x}{+}{97}\right){}{\mathrm{Dx}}{+}{75}{}{{x}}^{{5}}{-}{10}{}{{x}}^{{4}}{+}{80}{}{{x}}^{{3}}{-}{83}{}{{x}}^{{2}}{-}{73}{}{x}{-}{62}$ (2)
 > rand_skew_poly([Dx],coeffs=proc() randpoly(x) end proc,A);
 $\left({-}{92}{}{{x}}^{{5}}{+}{6}{}{{x}}^{{4}}{+}{74}{}{{x}}^{{3}}{+}{72}{}{{x}}^{{2}}{+}{37}{}{x}{-}{23}\right){}{{\mathrm{Dx}}}^{{5}}{+}\left({87}{}{{x}}^{{5}}{+}{44}{}{{x}}^{{4}}{+}{29}{}{{x}}^{{3}}{+}{98}{}{{x}}^{{2}}{-}{23}{}{x}{+}{10}\right){}{{\mathrm{Dx}}}^{{4}}{+}\left({-}{61}{}{{x}}^{{5}}{-}{8}{}{{x}}^{{4}}{-}{29}{}{{x}}^{{3}}{+}{95}{}{{x}}^{{2}}{+}{11}{}{x}{-}{49}\right){}{{\mathrm{Dx}}}^{{3}}{+}\left({-}{47}{}{{x}}^{{5}}{+}{40}{}{{x}}^{{4}}{-}{81}{}{{x}}^{{3}}{+}{91}{}{{x}}^{{2}}{+}{68}{}{x}{-}{10}\right){}{{\mathrm{Dx}}}^{{2}}{+}\left({31}{}{{x}}^{{5}}{-}{51}{}{{x}}^{{4}}{+}{77}{}{{x}}^{{3}}{+}{95}{}{{x}}^{{2}}{+}{x}{+}{1}\right){}{\mathrm{Dx}}{+}{55}{}{{x}}^{{5}}{-}{28}{}{{x}}^{{4}}{+}{16}{}{{x}}^{{3}}{+}{30}{}{{x}}^{{2}}{-}{27}{}{x}{-}{15}$ (3)
 > $\mathrm{rand_skew_poly}\left(\left[\mathrm{Dx},x\right],\mathrm{dense},A\right)$
 ${-}{59}{}{{\mathrm{Dx}}}^{{5}}{+}\left({-}{96}{}{x}{+}{72}\right){}{{\mathrm{Dx}}}^{{4}}{+}\left({-}{87}{}{{x}}^{{2}}{+}{47}{}{x}{-}{90}\right){}{{\mathrm{Dx}}}^{{3}}{+}\left({43}{}{{x}}^{{3}}{+}{92}{}{{x}}^{{2}}{-}{91}{}{x}{-}{88}\right){}{{\mathrm{Dx}}}^{{2}}{+}\left({-}{48}{}{{x}}^{{4}}{+}{53}{}{{x}}^{{3}}{-}{28}{}{{x}}^{{2}}{+}{5}{}{x}{+}{13}\right){}{\mathrm{Dx}}{-}{10}{}{{x}}^{{5}}{-}{82}{}{{x}}^{{4}}{+}{71}{}{{x}}^{{3}}{+}{16}{}{{x}}^{{2}}{+}{83}{}{x}{+}{9}$ (4)
 > $A≔\mathrm{shift_algebra}\left(\left[\mathrm{Sn},n\right]\right):$
 > rand_skew_poly(Sn,expons=rand(-5..5),coeffs=proc() randpoly(n) end proc,A);
 ${-}{96}{}{{n}}^{{5}}{+}{50}{}{{n}}^{{4}}{-}{60}{}{{n}}^{{3}}{-}{42}{}{{n}}^{{2}}{+}{7}{}{n}{-}{89}{+}\left({-}{53}{}{{n}}^{{5}}{+}{31}{}{{n}}^{{4}}{+}{81}{}{{n}}^{{3}}{-}{40}{}{{n}}^{{2}}{-}{128}{}{n}{+}{12}\right){}{{\mathrm{Sn}}}^{{5}}{+}\left({-}{60}{}{{n}}^{{5}}{-}{83}{}{{n}}^{{4}}{+}{98}{}{{n}}^{{3}}{-}{48}{}{{n}}^{{2}}{-}{19}{}{n}{+}{62}\right){}{{\mathrm{Sn}}}^{{3}}{+}\frac{{37}{}{{n}}^{{5}}{+}{5}{}{{n}}^{{4}}{+}{96}{}{{n}}^{{3}}{-}{17}{}{{n}}^{{2}}{+}{25}{}{n}{+}{91}}{{{\mathrm{Sn}}}^{{2}}}{+}\left({98}{}{{n}}^{{5}}{-}{64}{}{{n}}^{{4}}{+}{64}{}{{n}}^{{3}}{-}{90}{}{{n}}^{{2}}{-}{60}{}{n}{-}{34}\right){}{\mathrm{Sn}}$ (5)