Section 1.2 Intro to Sage
-1
https://doc.cocalc.com/sagews.html
2
jupyter.org/
3
doc.sagemath.org/html/en/reference/spkg/
1
https://doc.cocalc.com/sagews.html
2
jupyter.org/
3
doc.sagemath.org/html/en/reference/spkg/
Search Results:
True
. This is an example of a boolean value.[]
. If an object is mutable, the value can be changed after it is created.()
. If an object is immutable, the value cannot be changed after it is created.
sets()
with lowercase s
are built into Python. Python sets are collections of unique items within a pair of curly braces {}
.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:
@@ -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
+
+
+
+Chapter 4 Logic
+
+Logic introduction paragraph here
+
+
+
+
+
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
+
+
+
+Chapter 5 Relations
+
+Now that we’ve studied sets, its time to investigate the interrelationships between the elements of a set.
+
+
+
+
+
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:
+Chapter 4 Logic +
++Chapter 5 Relations +
+-
+
+
-
+
- +
- +
- +
-
+
-
+
+
-
+
- +
- +
+ -
+
+
-
+
- +
- +
- +
+ -
+
+
-
+
- +
- +
+
-
+
- +
- +
- +
- +
- +
diff --git a/creating-sets.html b/creating-sets.html
index 0e56b5f3..c6b8bbb8 100644
--- a/creating-sets.html
+++ b/creating-sets.html
@@ -173,12 +173,61 @@ Search Results:
-
+
+
-
+
- +
- +
- +
-
+
-
+
+
-
+
- +
- +
+ -
+
+
-
+
- +
- +
- +
+ -
+
+
-
+
- +
- +
+
-
+
- +
- +
- +
- +
- +
@@ -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.
Subsection 2.1.1 Sage Math Set
-Set()
function. We create a list with square brackets []
-=
and double equal sign ==
have different meanings.==
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.=
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.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
.
=
and double equal sign ==
have different meanings.==
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.=
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.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
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
-Subsets()
and list()
functions.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:
- letters (
a
-z
,A
-Z
) - digits (
0
-9
)
@@ -204,7 +253,7 @@
Search Results:
Search Results:
-
+
+
-
+
- +
- +
- +
-
+
-
+
+
-
+
- +
- +
+ -
+
+
-
+
- +
- +
- +
+ -
+
+
-
+
- +
- +
+
-
+
- +
- +
- +
- +
- +
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
+
+
+
+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:
+Section 5.4 Equivalence +
+-
+
- +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.
+
-
+
+
-
+
- +
- +
- +
-
+
-
+
+
-
+
- +
- +
+ -
+
+
-
+
- +
- +
- +
+ -
+
+
-
+
- +
- +
+
-
+
- +
- +
- +
- +
- +
diff --git a/frontmatter.html b/frontmatter.html
index 0c5ad3ee..466312c7 100644
--- a/frontmatter.html
+++ b/frontmatter.html
@@ -161,12 +161,61 @@ Search Results:
-
+
+
-
+
- +
- +
- +
-
+
-
+
+
-
+
- +
- +
+ -
+
+
-
+
- +
- +
- +
+ -
+
+
-
+
- +
- +
+
-
+
- +
- +
- +
- +
- +
@@ -176,7 +225,7 @@ Search Results:
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
+
+
+
+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
+
+
+
+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:
+Section 3.1 Combinatorics +
++Subsection 3.1.1 Factorial Function +
+factorial()
function computes this value, which is essential in permutations and combinations calculations.+Subsection 3.1.2 Binomial Coefficient +
+binomial()
function calculates this value, which is crucial for combinatorial problems.+Subsection 3.1.3 Permutations +
+Permutations()
function generates all possible permutations of a set. To list all sets in a permutation, you can convert the output to a list.+Section 4.1 Logical Operations +
++Subsection 4.1.1 Logical Operators +
+&
, OR |
, NOT ~
, conditional ->
, and biconditional <->
play crucial roles in constructing and evaluating logical expressions.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 +
+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.