Formal power series: Difference between revisions
m
→{{header|Perl 6}}: Make FPS a role.
m (→{{header|Perl 6}}: Comment edits.) |
m (→{{header|Perl 6}}: Make FPS a role.) |
||
Line 1,099:
class IntFPS { ... }
method coeffs { ... }
method differentiate { DerFPS.new(:x(self)) }
Line 1,115:
}
class ExplicitFPS
class SumFPS
has FPS ($.x, $.y);
method coeffs { $.x.coeffs Z+ $.y.coeffs }
}
class DifFPS
has FPS ($.x, $.y);
method coeffs { $.x.coeffs Z- $.y.coeffs }
}
class ProFPS
has FPS ($.x, $.y);
method coeffs { (0..*).map: { [+] ($.x.coeffs[0..$_] Z* $.y.coeffs[$_...0]) } }
}
class InvFPS
has FPS $.x;
method coeffs {
Line 1,145:
}
class DerFPS
has FPS $.x;
method coeffs { (1..*).map: { $_ * $.x.coeffs[$_] } }
}
class IntFPS
has FPS $.x;
method coeffs { 0, (0..*).map: { $.x.coeffs[$_] / ($_+1) } }
}
class DeferredFPS
has FPS $.realized is rw;
method coeffs { $.realized.coeffs }
|