diff --git a/.mapping.json b/.mapping.json index 588f81d1..14482cbc 100644 --- a/.mapping.json +++ b/.mapping.json @@ -1 +1 @@ -{"source/main.ptx": ["Discrete-Math-with-SageMath"], "source/frontmatter.ptx": ["frontmatter"], "source/getting-started/ch-getting-started.ptx": ["ch-getting-started"], "source/getting-started/sec-sage-browser.ptx": ["sage-browser"], "source/getting-started/sec-about-sage.ptx": ["about-sage"], "source/getting-started/sec-debugging.ptx": ["debugging"], "source/getting-started/sec-documentation.ptx": ["documentation"], "source/set-theory/ch-set-theory.ptx": ["ch-set-theory"], "source/set-theory/sec-creating-sets.ptx": ["creating-sets"], "source/set-theory/sec-cardinality.ptx": ["cardinality"], "source/set-theory/sec-operation-on-sets.ptx": ["sec-operation-on-sets"], "source/backmatter.ptx": ["backmatter"]} \ No newline at end of file +{"source/main.ptx": ["Discrete-Math-with-SageMath"], "source/frontmatter.ptx": ["frontmatter"], "source/getting-started/ch-getting-started.ptx": ["ch-getting-started"], "source/getting-started/sec-sage-browser.ptx": ["sage-browser"], "source/getting-started/sec-about-sage.ptx": ["about-sage"], "source/getting-started/sec-debugging.ptx": ["debugging"], "source/getting-started/sec-documentation.ptx": ["documentation"], "source/set-theory/ch-set-theory.ptx": ["ch-set-theory"], "source/set-theory/sec-creating-sets.ptx": ["creating-sets"], "source/set-theory/sec-cardinality.ptx": ["cardinality"], "source/set-theory/sec-operation-on-sets.ptx": ["sec-operation-on-sets"], "source/combinatorics/ch-combinatorics.ptx": ["ch-combinatorics"], "source/combinatorics/sec-combinatorics.ptx": ["sec-combinatorics"], "source/logic/ch-logic.ptx": ["ch-logic"], "source/logic/sec-logical-operation.ptx": ["sec-logical-operation"], "source/logic/sec-truth-table.ptx": ["sec-truth-table"], "source/logic/sec-tautology.ptx": ["sec-tautology"], "source/relations/ch-relations.ptx": ["ch-relations"], "source/relations/sec-intro-relations.ptx": ["intro-relations"], "source/relations/sec-relations-on-a-set.ptx": ["relations-on-a-set"], "source/relations/sec-properties.ptx": ["properties"], "source/relations/sec-equivalence.ptx": ["equivalence"], "source/relations/sec-partial-order.ptx": ["partial-order"], "source/backmatter.ptx": ["backmatter"]} \ No newline at end of file diff --git a/Discrete-Math-with-SageMath.html b/Discrete-Math-with-SageMath.html index ab259bb8..b9b63c09 100644 --- a/Discrete-Math-with-SageMath.html +++ b/Discrete-Math-with-SageMath.html @@ -173,18 +173,70 @@

Search Results:

  • 2.3.2 Set Union
  • 2.3.3 Set Intersection
  • 2.3.4 Set Difference
  • -
  • 2.3.5 Set Complement
  • -
  • 2.3.6 Cartesian Product of Sets
  • +
  • 2.3.5 Multiple Sets
  • +
  • 2.3.6 Set Complement
  • +
  • 2.3.7 Cartesian Product of Sets
  • +
  • +
    3 Conbinatorics
    + +
  • +
  • +
    4 Logic
    + +
  • +
  • +
    5 Relations
    + +
  • Backmatter
  • Section 1.2 Intro to Sage

    -
    Fell free to copy and paste the code snippets we provide and run them in your own Sage Worksheet
     1 
    https://doc.cocalc.com/sagews.html
    or Jupyter Notebook
     2 
    jupyter.org/
    . You can also edit the code and run the cells directly from this page. All the cells on the same page share the same memory, so be sure to run them in order. Sage integrates various
     3 
    doc.sagemath.org/html/en/reference/spkg/
    open-source mathematics software packages. Sage shares many features and syntax with python.
    +
    Feel free to copy and paste the code snippets we provide and run them in your own Sage Worksheet
     1 
    https://doc.cocalc.com/sagews.html
    or Jupyter Notebook
     2 
    jupyter.org/
    . You can also edit the code and run the cells directly from this page. All the cells on the same page share the same memory, so be sure to run them in order. Sage integrates various
     3 
    doc.sagemath.org/html/en/reference/spkg/
    open-source mathematics software packages. Sage shares many features and syntax with Python.
    Let’s do some math
    @@ -209,15 +258,15 @@

    Search Results:

    This might not mean too much right now and it will be more clear as we explore what is known as object-oriented programming. Just know that SageMath has different ways of representing and working with data. We can create an object by typing something into our Sage Worksheet or the cells on this page.
    Dot notation is a feature in object-oriented programming. Here is an example of dot notation. There are many more examples of this in Sage. Dot notation is used to access attributes and methods of an object. We can also pass in arguments to this method to specify the number of digits we want to round to.
    -
    Sage supports different ways of accomplishing the same task.
    Let’s introduce some more types and classes!
    -
    Look like this returns True. This is an example of a boolean value.
    -Lists: Ordered mutable collections of items. If an object is mutable, the value can be changed after it is created.
    +Lists: Ordered mutable collections of items within a pair of square brackets []. If an object is mutable, the value can be changed after it is created.
    -Tuples: Ordered, immutable collections. If an object is immutable, the value cannot be changed after it is created.
    +Tuples: Ordered, immutable collections within a pair of parenthesis (). If an object is immutable, the value cannot be changed after it is created.
    +set: sets() with lowercase s are built into Python. Python sets are collections of unique items within a pair of curly braces {}.
    +
    +
    +Set is a built-in Sage class. It is similar to a Python set, with added functionality for mathematical operations.
    +
    +
    Dictionaries: Collections of key-value pairs.
    -
    -
    +
    Strings: Sequence of characters used for text. You can use single or double quotes.
    -
    diff --git a/backmatter-2.html b/backmatter-2.html index 57b9c9b0..298ba06e 100644 --- a/backmatter-2.html +++ b/backmatter-2.html @@ -161,12 +161,61 @@

    Search Results:

  • -
  • -
  • +
  • +
  • +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • diff --git a/backmatter.html b/backmatter.html index ff4a07ff..7d703e30 100644 --- a/backmatter.html +++ b/backmatter.html @@ -123,7 +123,7 @@

    Search Results:

      -PrevUpNext

      @@ -194,13 +243,13 @@

      Search Results:

      len(A)
      In many cases, using Sage classes and functions will provide more functionality.
      -

      diff --git a/ch-logic.html b/ch-logic.html new file mode 100644 index 00000000..d42daf5c --- /dev/null +++ b/ch-logic.html @@ -0,0 +1,249 @@ + + + + + + + + + + +Logic + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to main content
      +
      +

      Discrete Math with SageMath: Learn math with open-source software

      + +
      +
      + + + + diff --git a/ch-relations.html b/ch-relations.html new file mode 100644 index 00000000..fe393435 --- /dev/null +++ b/ch-relations.html @@ -0,0 +1,251 @@ + + + + + + + + + + +Relations + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to main content
      +
      +

      Discrete Math with SageMath: Learn math with open-source software

      + +
      +
      + + + + diff --git a/ch-set-theory.html b/ch-set-theory.html index d7c85e90..c5772613 100644 --- a/ch-set-theory.html +++ b/ch-set-theory.html @@ -173,12 +173,61 @@

      Search Results:

    1. -
    2. -
    3. +
    4. +
    5. +
    6. +
    7. + + +
    8. +
    9. + + +
    10. +
    11. + + +
    12. @@ -187,42 +236,34 @@

      Search Results:

      Subsection 2.1.1 Sage Math Set

      -
      We can create a set by inserting a list within a Set() function. We create a list with square brackets [] -
      -
      -
      It looks like Sage has its own class for sets.
      -
      Also notice when we print the set, the elements are ordered and the duplicates are ignored.
      -
      -
      -
      Since Sage Sets remove duplicates, the two sets are equal. A single equal sign = and double equal sign == have different meanings.
      -
      The equality operator == is used to ask Sage if two values are the same. Sage compares the values on each side of the operator and returns the boolean value, True if they are equal, and False if they are not.
      -
      The assignment operator = is used to assign a value to a variable. The value on the right side of the operator is assigned to the variable on the left side.
      -
      If you are familiar with Python, you may have used a Python set with a lower case s. Even though Sage supports Python sets, we will be using Sage Sets for the added features. Be sure to define Sets() with an upper case S -

      +
      Since sets remove duplicates, the two sets are equal. A single equal sign = and double equal sign == have different meanings.
      +
      The equality operator == is used to ask Sage if two values are the same. Sage compares the values on each side of the operator and returns the boolean value, True if they are equal, and False if they are not.
      +
      The assignment operator = is used to assign a value to a variable. The value on the right side of the operator is assigned to the variable on the left side.
      +
      If you are familiar with Python, you may have used a Python set with a lower case s. Even though Sage supports Python sets, we will be using Sage Set for the added features. Be sure to define Sets() with an upper case S.

      Subsection 2.1.2 Set Builder Notation

      Instead of explicitly listing the elements of a set, we can use a set builder notation to define a set. The set builder notation is a way to define a set by describing the properties of its elements.
      Here we are introducing a new programming concept iteration. Iteration is a way to repeat a block of code multiple times and can be used to automate repetitive tasks. We could have created the same set by typing evens = Set([2, 4, 6, 8, 10]). Imagine if we wanted to create a set of even numbers between 1 and 100. It would be much easier to use iteration.
      -

      Subsection 2.1.3 Subsets

      -
      Assume we have a Set A = {1, 2, 3, 4, 5}, to list all the subsets included in this set, we can use the Subsets() and list() functions.
      +
      Assume we have A = {1, 2, 3, 4, 5}, to list all the subsets included in this set, we can use the Subsets() function to generate all the subsets and then use the Set() function to show us all the subsets.

      @@ -194,9 +243,9 @@

      Search Results:

      Rules for naming identifiers in Python:
      • Identifiers cannot start with a digit.
      • -
      • Identifiers are case-sensitive
      • +
      • Identifiers are case-sensitive.
      • -
        Identifiers can include
        +
        Identifiers can include:
        • letters (a - z, A - Z)
        • digits (0 - 9)
        • @@ -204,7 +253,7 @@

          Search Results:

      -
    13. Do not use spaces, punctuation or special characters when naming identifiers
    14. +
    15. Do not use spaces, punctuation or special characters when naming identifiers.
    16. Keywords cannot be used as identifiers.
    17. diff --git a/documentation.html b/documentation.html index 2d1f47a2..e551a665 100644 --- a/documentation.html +++ b/documentation.html @@ -161,12 +161,61 @@

      Search Results:

    18. -
    19. -
    20. +
    21. +
    22. +
    23. +
    24. + + +
    25. +
    26. + + +
    27. +
    28. + + +
    29. diff --git a/equivalence.html b/equivalence.html new file mode 100644 index 00000000..b82d558d --- /dev/null +++ b/equivalence.html @@ -0,0 +1,267 @@ + + + + + + + + + + +Equivalence + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to main content
      +
      +

      Discrete Math with SageMath: Learn math with open-source software

      + +
      +
      +
      + +

      +Section 5.4 Equivalence +

      +
      A relation is called an equivalence relation if the relation satisfies the following properties: reflexive symmetric and transitive.
      +
      +
      +Class of equivalence is defined by
      +
      +\begin{equation*} +[a] = \{x \in A | aRx\} +\end{equation*} +
      +
      +
      The class of equivalence of a is the set of all elements in A that are related to a.
      +
      +\begin{equation*} +\text{Let A } = \{x | x \text{ is a person living in USA} \} +\end{equation*} +
      +
      Let R be the following relation on A:
      +
      x R y if and only if x and y live in the same building.
      +
        +
      • +Reflexive: A person lives in the same building as himself. This is true for everybody living in USA.
      • +
      • +Symmetric: If person x lives in the same building as person y, then person y lives in the same building as person x.
      • +
      • +Transitive: If person x lives in the same building as person y and person y lives in the same building as person z, then person x lives in the same building as person z.
      • +
      +
      +
      Class of equivalence
      +
      +\begin{equation*} +\text{person } a = \{ x \in A | x R a \} = +\text{all people living in the same building as person } a +\end{equation*} +
      +
      +
      +
      + + + diff --git a/frontmatter-2.html b/frontmatter-2.html index 442a4149..76c4effa 100644 --- a/frontmatter-2.html +++ b/frontmatter-2.html @@ -161,12 +161,61 @@

      Search Results:

    30. -
    31. -
    32. +
    33. +
    34. +
    35. +
    36. + + +
    37. +
    38. + + +
    39. +
    40. + + +
    41. @@ -176,7 +225,7 @@

      Search Results:

      Zunaid Ahmed, Hellen Colman, Samuel Lubliner
      Math Department
      City Colleges of Chicago
      -
      February 13, 2024
      +
      February 19, 2024

      diff --git a/sec-combinatorics.html b/sec-combinatorics.html new file mode 100644 index 00000000..50931701 --- /dev/null +++ b/sec-combinatorics.html @@ -0,0 +1,267 @@ + + + + + + + + + + +Combinatorics + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to main content
      +
      +

      Discrete Math with SageMath: Learn math with open-source software

      + +
      +
      +
      + +

      +Section 3.1 Combinatorics +

      +

      +Subsection 3.1.1 Factorial Function +

      +
      The factorial of a non-negative integer \(n\text{,}\) denoted by \(n!\text{,}\) is the product of all positive integers less than or equal to \(n\text{.}\) In SageMath, the factorial() function computes this value, which is essential in permutations and combinations calculations.
      +
      For example, to compute the factorial of 5:
      +

      +Subsection 3.1.2 Binomial Coefficient +

      +
      The binomial coefficient \(\binom{n}{k}\) represents the number of ways to choose \(k\) elements out of a set of \(n\) elements without considering the order. In SageMath, the binomial() function calculates this value, which is crucial for combinatorial problems.
      +
      For instance, to calculate the number of ways to choose 3 elements from a set of 5:
      +

      +Subsection 3.1.3 Permutations +

      +
      A permutation of a set is an arrangement of its members into a sequence or linear order. SageMath’s Permutations() function generates all possible permutations of a set. To list all sets in a permutation, you can convert the output to a list.
      +
      To illustrate, generating all permutations of the set {1, 2, 3}:
      +
      +
      +
      + + + diff --git a/sec-logical-operation.html b/sec-logical-operation.html new file mode 100644 index 00000000..c2e3ab01 --- /dev/null +++ b/sec-logical-operation.html @@ -0,0 +1,259 @@ + + + + + + + + + + +Logical Operations + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to main content
      +
      +

      Discrete Math with SageMath: Learn math with open-source software

      + +
      +
      +
      + +

      +Section 4.1 Logical Operations +

      +

      +Subsection 4.1.1 Logical Operators +

      +
      In SageMath, logical operations such as AND &, OR |, NOT ~, conditional ->, and biconditional <-> play crucial roles in constructing and evaluating logical expressions.
      +
      AND, OR, and NOT operations correspond to basic logical functions: conjunction, disjunction, and negation, respectively. The conditional operation represents implication, where p -> q means if p then q. The biconditional operation, symbolized as p <-> q, denotes equivalence, asserting that p and q are either both true or both false.

      +Subsection 4.1.2 Logical Operations in SageMath +

      +
      SageMath’s propcalc.formula() function allows for the creation of logical formulas using variables and logical operators. This is especially useful in defining and manipulating logical statements.
      +
      +
      +
      + + + diff --git a/sec-operation-on-sets.html b/sec-operation-on-sets.html index b9b44a38..93a77c66 100644 --- a/sec-operation-on-sets.html +++ b/sec-operation-on-sets.html @@ -135,7 +135,7 @@

      Search Results:

        -PrevUpNext