Singular Manual: fareypoly

| #### D.4.9.1 fareypoly Procedure from library `ffmodstd.lib` (see ffmodstd_lib). Usage: fareypoly(f, g[, m]); f poly, g poly, m int Return: a list l where r/t (r:=l[1], t:=l[2]) is a univariate rational function such that r/t = g mod f, gcd(r,t)=gcd(f,t)=1 and deg(r) + deg(t) < deg(f) Note: An optional parameter m can be provided to define the way how t is normalized. If m = 0 (default), then the leading coefficient of t is 1. Otherwise, assuming the polynomial t has a non-zero constant term, the procedure returns the uniquely determined rational function r/t where the constant term in t is equal to 1. If the ground ring has n variables and f and g are in a polynomial ring k[var(i)] (k is a field) for some i<=n, then the function r/t is returned as an element in k(var(i)). In positive characteristic, the condition r/t = g mod f may not be satisfied. The degree deg(f) of f must be higher than the degree deg(g) of g. Example:
    LIB "ffmodstd.lib";
    ring rr=23,x,dp;
    poly g = 10x5-5x4+3x3+3x2-x-11;
    poly f = x6+2x5-9x4+x3-9x2+7x+7;
    fareypoly(g,f);
    ==> [1]:
    ==>    -11x3-7x2-3x+6
    ==> [2]:
    ==>    x-9
    fareypoly(g,f,1);
    ==> [1]:
    ==>    -9x3+11x2+8x+7
    ==> [2]:
    ==>    5x+1
    ring R = 0, x,dp;
    poly g = (24/1616615)*x6-(732/1616615)*x5+(9558/1616615)*x4-(14187/323323)*x3+
    (1148101/1616615)*x2+(4089347/1616615)*x+547356/230945;
    poly f = x7-28x6+322x5-1960x4+6769x3-13132x2+13068x-5040;
    fareypoly(g,f);
    ==> [1]:
    ==>    1/2x3+9/2x2+17/2x+6
    ==> [2]:
    ==>    x+5/2
    fareypoly(g,f,1);
    ==> [1]:
    ==>    1/5x3+9/5x2+17/5x+12/5
    ==> [2]:
    ==>    2/5x+1
    ring r = (499,a),x,dp;
    number N = (-113a4+170a3-29a2+226a+222)/(a7-56a6+114a5+144a4+171a3-64a2+192a);
    poly h1 = x4+(-55a5-18a4-141a3+233a2+66a-40)/(a4-28a3+40a2-2a+210)*x3;
    poly h2 = (107a6-221a5-68a4-93a3+112a2-54a+216)/(a4-28a3+40a2-2a+210)*x2;
    poly h3 = (-53a7+214a6+27a5+12a4+15a3+60a2-167a-83)/(a4-28a3+40a2-2a+210)*x;
    poly h4 = (10a6-75a5+47a4+246a3-20a2-217a+196)/(a4-28a3+40a2-2a+210);
    poly g = N*(h1+h2+h3+h4);
    poly f = x5+(-2a-119)*x4+(a2+237a+3437)*x3+(-118a2-6756a-29401)*x2+
    (3319a2+55483a+26082)*x+(-26082a2-26082a);
    fareypoly(g,f);
    ==> [1]:
    ==>    (a)*x+2
    ==> [2]:
    ==>    x2-3*x+(a)
See also: farey; polyInterpolation.

User manual for Singular version 4-2-1p3, 2021, generated by texi2html.