Commit 876de2ef authored by Hynek Baran's avatar Hynek Baran

`resolve/nonlin/combine` works properly using `resolve/nonlin/combine/2/tool`...

`resolve/nonlin/combine` works properly using `resolve/nonlin/combine/2/tool` := `resolve/nonlin/combine/2/rem`: on quadratic polynomials (fixed?)
using linderive() disabled
parent ae550865
......@@ -134,17 +134,17 @@ printf("\nUsing the new implementation of resolve (not well tested yet!) \n");
ans := `resolve/lin/r`(convert(AE, set), ForceFail=ff, keepfails);
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, keepfails);
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, keepfails);
###fi;
DoReports(resolve, [ans],comment=" resolve output");
if ans = FAIL then `resolve/fails/print`(); fi;
......@@ -180,7 +180,7 @@ end:
"degree"=0,
"LC"=a,
"LM"=1,
#"LV"=LV,
"LV"=1,
"price"=0,
"size"=size(a),
"source"=source,
......@@ -411,7 +411,7 @@ end:
#BUG: musíme použít
resdata := `resolve/data/collect` (res, source='procname');
#resdata:-divcoeff := LCg;
lprint(resdata);
#lprint(resdata);
`resolve/fails/collect`('remainder', resdata); ############# !!!!!!!!!!!
return NULL;
fi;
......@@ -683,8 +683,10 @@ end:
RESOLVE := [op(RESOLVE), [r:-LC, r:-LV, r:-rest]]
elif r:-kind='nonlinear' then
RESOLVE := [op(RESOLVE), [r:-expr, r:-LV]]
elif r:-kind='unknownless' then
lprint("Warning, `resolve/fails/collect` of unknownless expression", r);
else
error "unknown kind %1", r:-kind;
error "unknown kind %1 of record %2", r:-kind, r;
fi;
# central fail storage
`resolve/fails/table`[i] := r;
......@@ -702,12 +704,14 @@ end:
if T['solvable']=true then printf(" (solvable) ") fi;
tail := T['expr'] - T['LC']*T['LV'];
print (smash(T['LC'])*T['LV'] = -smash(tail));
elif kind ='remainder' then
elif kind = 'remainder' then
if T['solvable']=true then printf(" (solvable) ") fi;
printf(" on %a", T['divcoeff']);
print (smash(T['LC'])*T['LV'] = -smash(tail));
elif kind = 'nonlinear' then
printf("^%a", T['deg']);
printf("^%a", T['degree']);
print(smash(T['expr']));
elif kind = 'unknownless' then
print(smash(T['expr']));
else
error "Wrong kind %1", kind;
......
This diff is collapsed.
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