Formal power series: Difference between revisions

Content added Content deleted
m (→‎{{header|Perl 6}}: Make coeffs a method in the base class.)
m (→‎{{header|Perl 6}}: delete extra newlines)
Line 1,096: Line 1,096:
=={{header|Perl 6}}==
=={{header|Perl 6}}==


<lang perl6>
<lang perl6>class DerFPS { ... }
class DerFPS { ... }
class IntFPS { ... }
class IntFPS { ... }


Line 1,180: Line 1,179:
say 'sin(x) ≈ ', $sin.pretty(10);
say 'sin(x) ≈ ', $sin.pretty(10);
say 'cos(x) ≈ ', $cos.pretty(10);
say 'cos(x) ≈ ', $cos.pretty(10);
say 'tan(x) ≈ ', $tan.pretty(10);
say 'tan(x) ≈ ', $tan.pretty(10);</lang>
</lang>


{{out}}
{{out}}
<pre>sin(x) ≈ 0 + 1/1∙x¹ - 1/6∙x³ + 1/120∙x⁵ - 1/5040∙x⁷ + 1/362880∙x⁹
<pre>
sin(x) ≈ 0 + 1/1∙x¹ - 1/6∙x³ + 1/120∙x⁵ - 1/5040∙x⁷ + 1/362880∙x⁹
cos(x) ≈ 1 - 1/2∙x² + 1/24∙x⁴ - 1/720∙x⁶ + 1/40320∙x⁸ - 1/3628800∙x¹⁰
cos(x) ≈ 1 - 1/2∙x² + 1/24∙x⁴ - 1/720∙x⁶ + 1/40320∙x⁸ - 1/3628800∙x¹⁰
tan(x) ≈ 0/1 + 1/1∙x¹ + 1/3∙x³ + 2/15∙x⁵ + 17/315∙x⁷ + 62/2835∙x⁹
tan(x) ≈ 0/1 + 1/1∙x¹ + 1/3∙x³ + 2/15∙x⁵ + 17/315∙x⁷ + 62/2835∙x⁹</pre>
</pre>


=={{header|PicoLisp}}==
=={{header|PicoLisp}}==