|
|
|
last edited 7 years ago by Bill Page |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ||
|
Editor: Bill Page
Time: 2018/07/06 15:00:13 GMT+0 |
||
| Note: solve | ||
changed: -p1 := x::XDP * y::XDP -l1 := leftSubwords(p1) -r1 := rightSubwords(p1) -pe1 := factorizationPolynomial(p1) -fe1 := factorizationEquations(p1) -ve1 := members set concat map(variables,fe1) -s1 := solve(concat [fe1,[ve1.2-1]]) l1 := reduce(+,leftSubwords(p_1)) r1 := reduce(+,rightSubwords(p_1)) e1 := factorizationEquations(p_1) vars(p)==concat map(variables,coefficients(p)) concat(vars l1, rest vars r1) solve(e1,concat(vars l1, rest vars r1)) removed: - -\begin{axiom} -p1 := (x::XDP+1)^2 -pe1 := factorizationPolynomial(p1) -fe1 := factorizationEquations(p1) -ve1 := members set concat map(variables,fe1) -solve(concat [fe1,[ve1.1-1]]) -\end{axiom} - -\begin{axiom} -solve(factorizationEquations((x::XDP+y::XDP)^2)) -\end{axiom}
Konrad Schrempf
Since I never tried the ansatz (of Daniel Smertnig) and I needed something to warm up again (for programming in FriCAS?) I did it now ...
in the free associative algebra XDPOLY using an ansatz
Idea: Daniel Smertnig, January 26, 2017
Test: Konrad Schrempf, Mit 2018-07-04 10:33
--)read nc_ini03
ALPHABET := ['x,'y, 'z];
OVL ==> OrderedVariableList(ALPHABET)
OFM ==> FreeMonoid(OVL)
F ==> Fraction(Integer)
G ==> Fraction(Polynomial(Integer))
XDP ==> XDPOLY(OVL,F)
YDP ==> XDPOLY(OVL,G)
--NCP ==> NCPOLY(OVL,F) x := 'x::OFM;
y := 'y::OFM;
z := 'z::OFM;
OF ==> OutputForm
p_1 : XDP := x*(1-y*x);
leftSubwords(p:XDP) : List(YDP) ==
lst_wrd : List(OFM) := []
for mon in support(p) repeat
wrd := 1$OFM
for fct in factors(mon) repeat
for i in 1 .. fct.exp repeat
pos := position(wrd, lst_wrd)::NNI
if zero?(pos) then
lst_wrd := cons(wrd, lst_wrd)
wrd := wrd*(fct.gen)::OFM
lst_pol : List(YDP) := []
cnt_pol := #lst_wrd
for wrd in lst_wrd repeat
sym_tmp := (a[cnt_pol])::Symbol
lst_pol := cons(sym_tmp*wrd::YDP, lst_pol)
cnt_pol := (cnt_pol-1)::NNI
lst_pol
Function declaration leftSubwords : XDistributedPolynomial(
OrderedVariableList([x, y, z]), Fraction(Integer)) -> List(
XDistributedPolynomial(OrderedVariableList([x, y, z]), Fraction(
Polynomial(Integer)))) has been added to workspace.
rightSubwords(p:XDP) : List(YDP) ==
lst_wrd : List(OFM) := []
for mon in support(p) repeat
wrd := 1$OFM
for fct in reverse(factors(mon)) repeat
for i in 1 .. fct.exp repeat
pos := position(wrd, lst_wrd)::NNI
if zero?(pos) then
lst_wrd := cons(wrd, lst_wrd)
wrd := (fct.gen)::OFM*wrd
lst_pol : List(YDP) := []
cnt_pol := #lst_wrd
for wrd in lst_wrd repeat
sym_tmp := (b[cnt_pol])::Symbol
lst_pol := cons(sym_tmp*wrd::YDP, lst_pol)
cnt_pol := (cnt_pol-1)::NNI
lst_pol
Function declaration rightSubwords : XDistributedPolynomial(
OrderedVariableList([x, y, z]), Fraction(Integer)) -> List(
XDistributedPolynomial(OrderedVariableList([x, y, z]), Fraction(
Polynomial(Integer)))) has been added to workspace.
factorizationPolynomial(p:XDP) : YDP ==
lsw := leftSubwords(p)
rsw := rightSubwords(p)
fp := 0$YDP
for lw in lsw repeat
for rw in rsw repeat
fp := fp + lw*rw
fp
Function declaration factorizationPolynomial :
XDistributedPolynomial(OrderedVariableList([x, y, z]), Fraction(
Integer)) -> XDistributedPolynomial(OrderedVariableList([x, y, z]),
Fraction(Polynomial(Integer))) has been added to workspace.
factorizationEquations(p:XDP) : List(G) ==
lst_eqn : List(G) := []
fp := factorizationPolynomial(p)
for mon in support(fp) repeat
c_1 := coefficient(p, mon)
c_2 := coefficient(fp, mon)
lst_eqn := cons(c_2-c_1::G, lst_eqn)
for mon in support(p) repeat
if zero?(coefficient(fp, mon)) then
lst_eqn := []
break
lst_eqn
Function declaration factorizationEquations : XDistributedPolynomial
(OrderedVariableList([x, y, z]), Fraction(Integer)) -> List(Fraction
(Polynomial(Integer))) has been added to workspace.
p0 := factorizationEquations(x::XDP)
Compiling function leftSubwords with type XDistributedPolynomial(
OrderedVariableList([x, y, z]), Fraction(Integer)) -> List(
XDistributedPolynomial(OrderedVariableList([x, y, z]), Fraction(
Polynomial(Integer))))Compiling function rightSubwords with type XDistributedPolynomial(
OrderedVariableList([x, y, z]), Fraction(Integer)) -> List(
XDistributedPolynomial(OrderedVariableList([x, y, z]), Fraction(
Polynomial(Integer))))Compiling function factorizationPolynomial with type
XDistributedPolynomial(OrderedVariableList([x, y, z]), Fraction(
Integer)) -> XDistributedPolynomial(OrderedVariableList([x, y, z]),
Fraction(Polynomial(Integer)))Compiling function factorizationEquations with type
XDistributedPolynomial(OrderedVariableList([x, y, z]), Fraction(
Integer)) -> List(Fraction(Polynomial(Integer)))Compiling function G742 with type Integer -> Boolean
| (1) |
solve(p0)
>> Error detected within library code: No identity element for reduce of empty list using operation setUnion
shows that x is irreducible ;-).
l1 := reduce(+,leftSubwords(p_1))
| (2) |
r1 := reduce(+,rightSubwords(p_1))
| (3) |
e1 := factorizationEquations(p_1)
![]() | (4) |
vars(p)==concat map(variables,coefficients(p))
concat(vars l1,rest vars r1)
Compiling function vars with type XDistributedPolynomial(
OrderedVariableList([x, y, z]), Fraction(Polynomial(Integer))) ->
List(Symbol)| (5) |
solve(e1,concat(vars l1, rest vars r1))
| (6) |
Well for non-trivial polynomials solve does not work. One could try Groebner- Shirshov bases, etc.
In principle it should work with general base rings, for example the integers. But I do not know the capabilities of solve. Anyway, I hope that it could be useful within XDPOLY (at least for small polynomials, because the num- ber of non-linear equations is increasing exponentially).
The file in the attachment is meant to put on github for discussions.