Skip to content

Commit

Permalink
Merge pull request #52 from SageMathOER-CCC/add-notes
Browse files Browse the repository at this point in the history
Add notes
  • Loading branch information
Zune-Ahmed authored May 7, 2024
2 parents 71ec10b + 36341e6 commit a7ad668
Show file tree
Hide file tree
Showing 10 changed files with 129 additions and 104 deletions.
6 changes: 6 additions & 0 deletions source/boolean-algebra/sec-boolean-definition.ptx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
<p>
In SageMath, Boolean algebra can be manipulated through various built-in functions designed for handling Boolean variables and expressions.
</p>
<aside>
<title>Notes</title>
<p>
Boolean algebra is crucial in digital circuit design. For example, simplifying the expression of a digital circuit can minimize the number of gates used, which reduces cost and power consumption. Techniques such as Karnaugh maps and Boolean simplification are common in the industry.
</p>
</aside>
<sage>
<input>
B = BooleanPolynomialRing(3, 'x')
Expand Down
6 changes: 3 additions & 3 deletions source/combinatorics/sec-combinatorics.ptx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
The factorial of a non-negative integer <m>n</m>, denoted by <m>n!</m>, is the product of all positive integers less than or equal to <m>n</m>. In Sage, the <c>factorial()</c> function computes this value, which is essential in permutations and combinations calculations.
</p>
<aside>
<title>Tips!</title>
<title>Notes</title>
<p>
Factorials are widely used in probability problems, such as determining the number of possible ways a set of items can be arranged.
</p>
Expand All @@ -33,7 +33,7 @@
The combination <m>(n, k)</m> is an unordered selection of <m>k</m> objects from a set of <m>n</m> objects.
</p>
<aside>
<title>Tips!</title>
<title>Notes</title>
<p>
Combinations are useful in scenarios like determining the number of possible committees that can be formed from a larger group.
</p>
Expand Down Expand Up @@ -65,7 +65,7 @@
A permutation <m>(n, k)</m> is an ordered selection of <m>k</m> objects from a set of <m>n</m> objects.
</p>
<aside>
<title>Tips!</title>
<title>Notes</title>
<p>
Understanding permutations can help solve problems like scheduling where the order of tasks or events matters.
</p>
Expand Down
4 changes: 2 additions & 2 deletions source/functions/sec-functions.ptx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
A function from a set <m>A</m> into a set <m>B</m> is a relation from <m>A</m> into <m>B</m> such that each element of <m>A</m> is related to exactly one element of the set <m>B</m>. The set <m>A</m> is called the domain of the function, and the set <m>B</m> is called the co-domain. Functions are fundamental in both mathematics and computer science for describing mathematical relationships and implementing computational logic.
</p>
<aside>
<title>Tips!</title>
<title>Notes</title>
<p>
Defining functions in Sage is not only useful for mathematical calculations but also for creating complex algorithms, modeling data, and simulating real-world scenarios in various fields of science and engineering.
</p>
Expand All @@ -32,7 +32,7 @@
Sage provides powerful tools for visualizing functions, enabling you to explore the graphical representations of mathematical relationships. Graphs can be plotted directly from function definitions, offering insights into function behavior, such as continuity, limits, and extrema.
</p>
<aside>
<title>Tips!</title>
<title>Notes</title>
<p>
Utilizing graphical representations of functions can greatly aid in understanding complex concepts in calculus and analysis, such as differentiation and integration, by providing a visual context.
</p>
Expand Down
6 changes: 6 additions & 0 deletions source/graph-theory/sec-basics.ptx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
# A graphical representation of the graph with vertices A, B, C, D, E forming a pentagon and additional diagonals A-D and C-E.
</output>
</sage>
<aside>
<title>Notes</title>
<p>
Graph theory is pivotal in areas such as network routing and social networking. For example, in telecommunications, graphs are used to model and optimize routing of communications like telephone traffic or internet data packets through a network of nodes and links, ensuring efficient and fault-tolerant network design.
</p>
</aside>
<p>
Another way would be specifying the edges only, where each edge is defined by a pair of vertices:
</p>
Expand Down
17 changes: 11 additions & 6 deletions source/graph-theory/sec-paths.ptx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
# Retrieves the shortest path from vertex 1 to vertex 4, if it exists.
</output>
</sage>
<aside>
<title>Notes</title>
<p>
Pathfinding in graphs is a key algorithm in logistics to determine the most efficient route between locations. It's used in GPS navigation systems to find the quickest route for vehicles, and in network design to optimize data flow between servers, enhancing the efficiency of network infrastructures.
</p>
</aside>
<p>
A graph is said to be connected if there is a path between any two vertices in the graph.
</p>
Expand All @@ -46,10 +52,9 @@
</output>
</sage>
<p>
A connected component of a graph <m>G </m> is a maximal
connected subgraph of <m>G </m>. If the graph <m>G </m> is connected, then it has only one connected component.
</p>
<p>
A connected component of a graph <m>G </m> is a maximal connected subgraph of <m>G </m>. If the graph <m>G </m> is connected, then it has only one connected component.
</p>
<p>
For example, the following graph is not connected:
</p>
<sage>
Expand All @@ -61,7 +66,7 @@ connected subgraph of <m>G </m>. If the graph <m>G </m> is connected, then it ha
# Checks if the graph is connected, returning a boolean value.
</output>
</sage>
<p>
<p>
To identify all connected components of a graph, the <c>connected_components()</c> function can be utilized:
</p>
<sage>
Expand All @@ -83,7 +88,7 @@ connected subgraph of <m>G </m>. If the graph <m>G </m> is connected, then it ha
</input>
<output>
</output>
</sage>
</sage>
<p>
The diameter of a graph is the length of the longest shortest path between any two vertices.
</p>
Expand Down
98 changes: 53 additions & 45 deletions source/lattices/sec-definition.ptx
Original file line number Diff line number Diff line change
@@ -1,52 +1,60 @@
<section xml:id="sec-definition" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>Lattices</title>

<subsection xml:id="definition">
<title>Definition</title>
<p>
A lattice is defined as a partially ordered set (poset) in which any two elements have a least upper bound (also known as join) and greatest lower bound (also known as meet).
</p>
<p>
In Sage, a lattice can be represented as a poset using the <c>Poset()</c> function. This function takes a tuple as its argument, where the first element is the set of elements in the poset, and the second element is a list of ordered pairs representing the partial order relations between those elements.
</p>
<sage>
<input>
L = Poset((['a', 'b', 'c', 'd', 'e', 'f', 'g'],
[['a', 'b'], ['a', 'c'], ['b', 'd'], ['c', 'd'],
['c', 'e'], ['d', 'f'], ['e', 'f'], ['f', 'g']]))
L.plot()
</input>
<output>
# This will plot the poset that forms a lattice structure.
</output>
</sage>
<p>
We can also use <c>LatticePoset()</c> function to plot the lattice. The function <c>Poset()</c> can be used with any poset, even when the poset is not a lattice. The function <c>LatticePoset()</c> will give an error if the poset is not a lattice. The function is also more optimized and reduces the time needed when plotting complicated lattices.
</p>
<sage>
<input>
L = LatticePoset((['a', 'b', 'c', 'd', 'e', 'f', 'g'],
[['a', 'b'], ['a', 'c'], ['b', 'd'], ['c', 'd'],
['c', 'e'], ['d', 'f'], ['e', 'f'], ['f', 'g']]))
L.plot()
</input>
<output>
# This will plot the latticeposet that forms a lattice structure.
</output>
</sage>
<title>Definition</title>
<p>
A lattice is defined as a partially ordered set (poset) in which any two elements have a least upper bound (also known as join) and greatest lower bound (also known as meet).
</p>
<p>
In Sage, a lattice can be represented as a poset using the <c>Poset()</c> function. This function takes a tuple as its argument, where the first element is the set of elements in the poset, and the second element is a list of ordered pairs representing the partial order relations between those elements.
</p>
<sage>
<input>
L = Poset((['a', 'b', 'c', 'd', 'e', 'f', 'g'],
[['a', 'b'], ['a', 'c'], ['b', 'd'], ['c', 'd'],
['c', 'e'], ['d', 'f'], ['e', 'f'], ['f', 'g']]))
L.plot()
</input>
<output>
# This will plot the poset that forms a lattice structure.
</output>
</sage>
<p>
We can also use <c>LatticePoset()</c> function to plot the lattice. The function <c>Poset()</c> can be used with any poset, even when the poset is not a lattice. The function <c>LatticePoset()</c> will give an error if the poset is not a lattice. The function is also more optimized and reduces the time needed when plotting complicated lattices.
</p>
<sage>
<input>
L = LatticePoset((['a', 'b', 'c', 'd', 'e', 'f', 'g'],
[['a', 'b'], ['a', 'c'], ['b', 'd'], ['c', 'd'],
['c', 'e'], ['d', 'f'], ['e', 'f'], ['f', 'g']]))
L.plot()
</input>
<output>
# This will plot the latticeposet that forms a lattice structure.
</output>
</sage>
<p>
The function <c>is_lattice()</c> can be used to determine whether the poset is a lattice.
</p>
<sage>
<input>
L = Poset((['a', 'b', 'c', 'd', 'e', 'f', 'g'],
[['a', 'b'], ['a', 'c'], ['b', 'd'], ['c', 'd'],
['c', 'e'], ['d', 'f'], ['e', 'f'], ['f', 'g']]))
L.is_lattice()
</input>
<output>
# This will check if the poset is a lattice.
</output>
</sage>
<aside>
<title>Notes</title>
<p>
The function <c>is_lattice()</c> can be used to determine whether the poset is a lattice.
Lattices play a critical role in computer science, particularly in structuring hierarchical access control in security systems and databases. They help in managing permissions through role-based access control, where roles and data can be organized in a lattice to determine the propagation of access rights.
</p>
<sage>
<input>
L = Poset((['a', 'b', 'c', 'd', 'e', 'f', 'g'],
[['a', 'b'], ['a', 'c'], ['b', 'd'], ['c', 'd'],
['c', 'e'], ['d', 'f'], ['e', 'f'], ['f', 'g']]))
L.is_lattice()
</input>
<output>
# This will check if the poset is a lattice.
</output>
</sage>
</subsection>
</aside>
</subsection>


<subsection xml:id="join">
Expand Down
80 changes: 40 additions & 40 deletions source/logic/sec-logical-operation.ptx
Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>

<section xml:id="sec-logical-operation" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>Logical Operators</title>
<introduction>
<p>
In Sage, logical operations such as AND <c>&amp;</c>, OR <c>|</c>, NOT <c>~</c>, conditional <c>-&gt;</c>, and biconditional <c>&lt;-&gt;</c> play crucial roles in constructing and evaluating logical expressions.
</p>
<tabular>
<row>
<cell>Operator</cell>
<cell>Symbol</cell>
<cell>Mathematical Notation</cell>
</row>
<row>
<cell>AND</cell>
<cell>&amp;</cell>
<cell><m>\land</m></cell>
</row>
<row>
<cell>OR</cell>
<cell>|</cell>
<cell><m>\lor</m></cell>
</row>
<row>
<cell>NOT</cell>
<cell>~</cell>
<cell><m>\lnot</m></cell>
</row>
<row>
<cell>Conditional</cell>
<cell>-&gt;</cell>
<cell><m>\rightarrow</m></cell>
</row>
<row>
<cell>Biconditional</cell>
<cell>&lt;-&gt;</cell>
<cell><m>\leftrightarrow</m></cell>
</row>
<row>
<cell>Operator</cell>
<cell>Symbol</cell>
<cell>Mathematical Notation</cell>
</row>
<row>
<cell>AND</cell>
<cell>&amp;</cell>
<cell><m>\land</m></cell>
</row>
<row>
<cell>OR</cell>
<cell>|</cell>
<cell><m>\lor</m></cell>
</row>
<row>
<cell>NOT</cell>
<cell>~</cell>
<cell><m>\lnot</m></cell>
</row>
<row>
<cell>Conditional</cell>
<cell>-&gt;</cell>
<cell><m>\rightarrow</m></cell>
</row>
<row>
<cell>Biconditional</cell>
<cell>&lt;-&gt;</cell>
<cell><m>\leftrightarrow</m></cell>
</row>
</tabular>
<aside>
<title>Notes</title>
<p>
Logical operators are fundamental in digital circuit design. They are used to create complex circuits like ALUs (Arithmetic Logic Units) in computer processors, where operations such as addition, subtraction, and bit shifting rely on combinations of AND, OR, and NOT gates. Understanding these basics is essential for designing efficient electronic and software solutions.
</p>
</aside>

</introduction>

<!-- Logical Operations in Sage -->
<subsection>
<title>Boolean Formula</title>

<p>
Sage's <c>propcalc.formula()</c> function allows for the creation of Boolean formulas using variables and logical operators. We can then use <c>show</c> function to display the mathematical notations.
</p>
<aside>
<title>Tips!</title>
<p>
Logical operations can model decision-making processes in programming, such as determining whether a set of conditions are met before executing a particular block of code.
</p>
</aside>
<sage>
<input>
A = propcalc.formula('(p &amp; q) | (~p)')
show(A)
</input>
<output></output>
<output>
# Displays the Boolean formula (p AND q) OR (NOT p) in mathematical notation.
</output>
</sage>
</subsection>

Expand Down
2 changes: 1 addition & 1 deletion source/set-theory/sec-cardinality.ptx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
To find the cardinality of a set, we use the <c>cardinality()</c> function.
</p>
<aside>
<title>Tips!</title>
<title>Notes</title>
<p>
In social networks like Facebook or Twitter, cardinality can represent the number of friends or followers a user has. Understanding the cardinality of social connections can help in personalization, targeted advertising, and studying social influence.
</p>
Expand Down
2 changes: 1 addition & 1 deletion source/set-theory/sec-creating-sets.ptx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
Let's consider <m>A = \{1, 2, 3, 4, 5\}</m>. We can check if the number 3 is in set <m>A</m>:
</p>
<aside>
<title>Tips!</title>
<title>Notes</title>
<p>
For organizations such as clubs, gyms, or online subscription services, set membership checks can be used to validate if a user is a member or subscriber. This can help control access to facilities or content.
</p>
Expand Down
Loading

0 comments on commit a7ad668

Please sign in to comment.