Commit 7ccd7d0a authored by Hynek Baran's avatar Hynek Baran

linderive uses divideout@numer

parent abec9d90
......@@ -17,7 +17,7 @@ printf("Jets.newresolve v 0.4 as of Nov 06 2018 (%s)\n",
`resolve/opts/postproc` := {'nonlinear', 'linear'}:
`resolve/1` := proc()
local as,bs,as1, as2, cs, ds, vl,i,ans, A, AL, AN, A1, A0, A1S, A1H, AE, APD, B, ff, old, old1, new, new1, cstep;
local as,bs,as1, as2, cs, ds, vl,i,ans, A, AL, AN, A1, A0, A1S, A1H, AE, APD, B, ff, old, old1, new, new1, all, aux, cstep;
global `resolve/nonresrat`, `resolve/reduce`;
Report(2, cat(`input `, nops([args])));
as := MaP(numer,{args}) minus {0};
......@@ -135,16 +135,32 @@ printf("Jets.newresolve v 0.4 as of Nov 06 2018 (%s)\n",
Reportf(1, ["Resolving %a (of %a input) eqs given %a results.", nops(B), nops(A), nops(ans)]);
else
Reportf(1, ["Resolving %a (of %a input) eqs failed.", nops(B), nops(A)]);
fi;
# if no usable results, lets try to generate pseudoremainders of polynomial pairs
if has(`resolve/opts/postproc`, 'nonlinear') and ans = FAIL then
old := convert(A,set);
fi;
if ans = FAIL and nops(AN)>0 then
Reportf(2, ["No solvable linear eqs found, trying to linearize %a eqs by linderive", nops(aux)]);
APD := linderive(op(AN));
Reportf(1, ["Deriving %a nonlinear eqs given %a linear results", nops(AN), nops(APD)]);
Reportf(2, ["...witch properties are [price, size, VarL, LC]:\n%s",
StringTools:-Join(map(a -> sprintf("%q\n",[a:-price,a:-size,a:-Vars, a:-LC]), convert(APD,list)))]);
ans := `resolve/lin/r`(APD, ForceFail=ff);
Reportf(0, ["Resolving %a linearized eqs (generated by linderive from %a nonliner eqs) given %a results.", nops(APD), nops(AN), nops(ans)]);
else
APD := {};
fi;
if not(has(`resolve/opts/postproc`, 'nonlinear')) or ans <> FAIL then
all := convert(A, set) union APD;
else
# if no usable results, lets try to generate pseudoremainders of polynomial pairs
old := convert(A,set) union APD;
all := old;
# try to reduce all input eqs
Reportf(0, ["No solvable eqs found, trying to reduce input %a eqs...", nops(old)]);
new := `resolve/nonlin/reduce/1`(old);
new := new minus old;
all := all union new;
Reportf(1, ["Reducing %a eqs given %a new results", nops(old), nops(new)]);
Reportf(2, ["...whitch properties are [price, size, LM, Vars, size(LC)]:\n%s",
StringTools:-Join(map(a -> sprintf("%q\n",[a:-price,a:-size,a:-LM, a:-Vars, size(a:-LC)]), [op(new)]))]);
......@@ -166,7 +182,8 @@ printf("Jets.newresolve v 0.4 as of Nov 06 2018 (%s)\n",
new1 := `resolve/nonlin/reduce/2`(old1, new);
new1 := new1 minus (old union new);
all := all union new1;
Reportf(0, ["Reducing %a (of %a) by %a eqs (step %a) given %a new results.", nops(old1), nops(old), nops(new), cstep, nops(new1)]);
if nops(new1)>0 then
......@@ -187,17 +204,20 @@ printf("Jets.newresolve v 0.4 as of Nov 06 2018 (%s)\n",
od;
fi;
#### if still no usable results, lets try to linearize nonlinear eqs by pd (linderive)
###if ans = FAIL and nops(AN)>0 then
### Reportf(2, ["No solvable linear eqs found, trying to linearize eqs by linderive"]);
### # APD := convert(`resolve/nonlin/pd`(convert(AN,set)), list);
### APD := convert(linderive(op(AN)), list);
### Reportf(1, ["Deriving %a nonlinear eqs given %a linear results", nops(AN), nops(APD)]);
### Reportf(2, ["...witch properties are [price, size, VarL, LC]:\n%s",
### StringTools:-Join(map(a -> sprintf("%q\n",[a:-price,a:-size,a:-Vars, a:-LC]), APD))]);
### Reportf(0, ["Derived %a linear eqs from %a nonlinear", nops(APD), nops(AN)]);
### ans := `resolve/lin/r`(convert(APD, set), ForceFail=ff);
###fi;
## if still no usable results, lets try to linearize nonlinear eqs by pd (linderive)
#if ans = FAIL then
# aux := select(a->a:-kind = 'nonlinear', all);
# if nops(aux) > 0 then
# Reportf(2, ["No solvable linear eqs found, trying to linearize %a eqs by linderive", nops(aux)]);
# #APD := convert(linderive(op(aux)), list);
# APD := linderive(op(aux));
# Reportf(0, ["Deriving %a nonlinear eqs given %a linear results", nops(aux), nops(APD)]);
# Reportf(2, ["...witch properties are [price, size, VarL, LC]:\n%s",
# StringTools:-Join(map(a -> sprintf("%q\n",[a:-price,a:-size,a:-Vars, a:-LC]), APD))]);
# #ans := `resolve/lin/r`(convert(APD, set), ForceFail=ff);
# ans := `resolve/lin/r`(APD, ForceFail=ff);
# fi;
#fi;
DoReports(resolve, [ans],comment=" resolve output");
if ans = FAIL then `resolve/fails/print`(); fi;
......@@ -355,7 +375,7 @@ end:
map(`resolve/data/collect/detect`@simpl, `linderive/1`(r:-expr, (r:-Vars)[1]))
end,
proc (a::algebraic, LV := LVar(a))
map2(pd, a, vars(LV, forceError=true))
map(divideout@numer, map2(pd, a, vars(LV, forceError=true)))
end
]):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment