# Singular

#### D.12.6.1 weierstrDiv

Procedure from library `weierstr.lib` (see weierstr_lib).

Usage:
weierstrDiv(g,f,d); g,f=poly, d=integer

Assume:
f must be general of finite order, say b, in the last ring variable, say T; if not use the procedure lastvarGeneral first

Purpose:
perform the Weierstrass division of g by f up to order d

Return:
- a list, say l, of two polynomials and an integer, such that
g = l[1]*f + l[2], deg_T(l[2]) < b, up to (including) total degree d
- l[3] is the number of iterations used
- if f is not T-general, return (0,g)

Note:
the procedure works for any monomial ordering

Theory:
the proof of Grauert-Remmert (Analytische Stellenalgebren) is used for the algorithm

Example:
 ```LIB "weierstr.lib"; ring R = 0,(x,y),ds; poly f = y - xy2 + x2; poly g = y; list l = weierstrDiv(g,f,10); l;""; ==> [1]: ==> 1+xy-x3+x2y2-2x4y+2x6+x3y3-3x5y2+5x7y+x4y4-5x9-4x6y3+9x8y2+x5y5 ==> [2]: ==> -x2+x5-2x8 ==> [3]: ==> 5 ==> l[1]*f + l[2]; //g = l[1]*f+l[2] up to degree 10 ==> y-5x11+14x10y2+5x7y5-9x9y4-x6y7 ```