Ore_algebra
rand_skew_poly
random skew polynomial generator
Calling Sequence
Parameters
Description
Examples
rand_skew_poly(vars, eqns, Alg)
vars
-
indeterminate or list or set of indeterminates
eqns
(optional) equations specifying properties where option=value
Alg
Ore algebra table
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.
with⁡Ore_algebra:
A≔diff_algebra⁡Dx,x:
rand_skew_poly⁡x,A
−7⁢x5+22⁢x4−55⁢x3−94⁢x2+87⁢x−56
rand_skew_poly⁡Dx,x,terms=20,A
−7⁢Dx5+−40⁢x−44⁢Dx4+42⁢x2+71⁢x−10⁢Dx3+−50⁢x3−17⁢x2+62⁢x⁢Dx2+23⁢x4−75⁢x3−82⁢x2−4⁢x+97⁢Dx+75⁢x5−10⁢x4+80⁢x3−83⁢x2−73⁢x−62
rand_skew_poly([Dx],coeffs=proc() randpoly(x) end proc,A);
−92⁢x5+6⁢x4+74⁢x3+72⁢x2+37⁢x−23⁢Dx5+87⁢x5+44⁢x4+29⁢x3+98⁢x2−23⁢x+10⁢Dx4+−61⁢x5−8⁢x4−29⁢x3+95⁢x2+11⁢x−49⁢Dx3+−47⁢x5+40⁢x4−81⁢x3+91⁢x2+68⁢x−10⁢Dx2+31⁢x5−51⁢x4+77⁢x3+95⁢x2+x+1⁢Dx+55⁢x5−28⁢x4+16⁢x3+30⁢x2−27⁢x−15
rand_skew_poly⁡Dx,x,dense,A
−59⁢Dx5+−96⁢x+72⁢Dx4+−87⁢x2+47⁢x−90⁢Dx3+43⁢x3+92⁢x2−91⁢x−88⁢Dx2+−48⁢x4+53⁢x3−28⁢x2+5⁢x+13⁢Dx−10⁢x5−82⁢x4+71⁢x3+16⁢x2+83⁢x+9
A≔shift_algebra⁡Sn,n:
rand_skew_poly(Sn,expons=rand(-5..5),coeffs=proc() randpoly(n) end proc,A);
−96⁢n5+50⁢n4−60⁢n3−42⁢n2+7⁢n−89+−53⁢n5+31⁢n4+81⁢n3−40⁢n2−128⁢n+12⁢Sn5+37⁢n5+5⁢n4+96⁢n3−17⁢n2+25⁢n+91Sn2+−60⁢n5−83⁢n4+98⁢n3−48⁢n2−19⁢n+62⁢Sn3+98⁢n5−64⁢n4+64⁢n3−90⁢n2−60⁢n−34⁢Sn
See Also
rand
randpoly
Download Help Document