Jump to content

Polynomial derivative: Difference between revisions

m
→‎{{header|Raku}}: trap an edge condition for exponents > 9 (doesn't matter here)
(→‎{{header|Raku}}: Add a Raku example)
m (→‎{{header|Raku}}: trap an edge condition for exponents > 9 (doesn't matter here))
Line 135:
sub pretty (@poly) {
my $p = join '+', (^@poly).reverse.map: { @poly[$_] ~ "x{.&super}" }
$p.=subst(/['+'|'-']'0x'<[⁰¹²³⁴⁵⁶⁷⁸⁹]>*/, '-', :g).subst(/^'+'/,<?before '').subst(/'x<-[⁰¹'²³⁴⁵⁶⁷⁸⁹]>>/, 'x').subst(/'x⁰'/, '')\
.subst(/['+x⁰'|$/, '-']).subst(/'0x+-'<[⁰¹²³⁴⁵⁶⁷⁸⁹]>*/, '-', :g).subst(/(['+'|'-'|^])'1x'/, {"$0x"}, :g) || 0
}
 
10,333

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.