Permalink
Browse files

Merge pull request #2271 from uzluisf/master

Add minor corrections
  • Loading branch information...
Altai-man committed Aug 18, 2018
2 parents 601d8c2 + c1e89ae commit f085b0988385ff98825dbcb8b0bbd62aa6f62bfb
Showing with 13 additions and 13 deletions.
  1. +12 −12 doc/Language/math.pod6
  2. +1 −1 doc/Language/numerics.pod6
View
@@ -4,7 +4,7 @@
=SUBTITLE Different mathematical paradigms and how they are implemented in this language
=head1 Sets.
=head1 Sets
Perl 6 includes the L<Set> data type, as well as support for
L<most set operations|/language/setbagmix#Set/Bag_Operators>.
@@ -49,14 +49,14 @@ say "Identity with ∅ ", so @id-empty.all; # OUTPUT: «Identity with ∅
=end code
In this code, which uses the L<empty set|/language/setbagmix#term_%E2%88%85>
which is already defined by Perl 6, not only we check if the equalities in the
which is already defined by Perl 6, not only do we check if the equalities in the
algebra of sets hold, we also use, via L<sigilless variables|/language/variables#index-entry-\_(sigilless_variables)> and the
Unicode form of the set operators, expressions that are as close as possible to
the original form; C<A ∪ U === U>, for example, except for the use of the
L<value identity operator <===>|/routine/===> is very close to the actual
mathematical expression in the L<Wikipedia entry|https://en.wikipedia.org/wiki/Algebra_of_sets>.
We can even test de Morgan's law, as in the code below:
We can even test De Morgan's law, as in the code below:
=begin code
my @alphabet = 'a'..'z';
@@ -76,21 +76,21 @@ say "2nd De Morgan is ", $de-Morgan2;
We declare C<> as the I<complement> operation, which computes the symmetrical
difference ⊖ between the Universal set C<U> and our set. Once that is declared,
it is relatively easy to express operations such as the complementary of the
union of A and B C<(A ∪ B)⁻>, with a notation that is very close to the original
union of A and B, C<(A ∪ B)⁻>, with a notation that is very close to the original
mathematical notation.
=head1 Arithmetic.
=head1 Arithmetic
Perl 6 can do arithmetic using different data types. L<Num>, L<Rat> and
L<Complex> can all operate as a L<field under the operations addition, subtraction, multiplication and division|https://en.wikipedia.org/wiki/Field_(mathematics)>.
L<Complex> can all operate as a L<field under the operations of addition, subtraction, multiplication and division|https://en.wikipedia.org/wiki/Field_(mathematics)>.
The equivalent mathematical fields are:
=begin table
Perl 6 class Field
============= ==============================================
C<Rat>
C<Num>
C<Complex>
Rat
Num
Complex
=end table
The C<Int>s, although technically corresponding to Z, is not really a
@@ -109,7 +109,7 @@ L<Num> if the number is too big:
Also strictly speaking, the Rational class that behaves like a mathematical
field is L<FatRat>. For efficiency reasons, operating with C<Rat>s will fall
back ton C<Num> when the numbers are big enough or when there is a big
back to C<Num> when the numbers are big enough or when there is a big
difference between numerator and denominator. C<FatRat> can work with arbitrary
precision, the same as the default C<Int> class.
@@ -152,8 +152,8 @@ L<≅|/language/operators#infix_=~=>
=head1 Sequences
A L<sequence|https://en.wikipedia.org/wiki/Sequence> is I<an enumerated>
collection of objects in which repetitions are allowed>, and also a first-class
A L<sequence|https://en.wikipedia.org/wiki/Sequence> is an I<enumerated>
collection of objects in which repetitions are allowed, and also a first-class
data type in Perl 6 called L<Seq>. C<Seq> is able to represent infinite
sequences, like the natural numbers:
@@ -48,7 +48,7 @@ say (5/2).narrow; # OUTPUT: «2.5␤»
say 1 / 10⁹⁹; # OUTPUT: «1e-99␤»
=end code
Perl 6 has L<FatRat> type that offers arbitrary precision fractions. How come
Perl 6 has a L<FatRat> type that offers arbitrary precision fractions. How come
a limited-precision L<Num> is produced instead of a L<FatRat> type in the
last example above? The reason is: performance. Most operations are fine
with a little bit of precision lost and so do not require the use of a more

0 comments on commit f085b09

Please sign in to comment.