Polynomial long division: Difference between revisions
Content added Content deleted
(→{{header|zkl}}: the rest of the bug fix) |
m (→{{header|zkl}}: update) |
||
Line 1,946: | Line 1,946: | ||
fcn polyString(terms){ // (a0,a1,a2...)-->"a0 + a1x + a2x^2 ..." |
fcn polyString(terms){ // (a0,a1,a2...)-->"a0 + a1x + a2x^2 ..." |
||
str:=[0..].zipWith('wrap(n,a){ if(a) "+ %sx^%s ".fmt(a,n) else "" },terms) |
str:=[0..].zipWith('wrap(n,a){ if(a) "+ %sx^%s ".fmt(a,n) else "" },terms) |
||
. |
.pump(String) |
||
.replace("x^0 "," ").replace(" 1x"," x").replace("x^1 ","x ") |
.replace("x^0 "," ").replace(" 1x"," x").replace("x^1 ","x ") |
||
.replace("+ -", "- "); |
.replace("+ -", "- "); |