generated from PreTeXtBook/pretext-codespace
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from SageMathOER-CCC/boolean
Boolean
- Loading branch information
Showing
4 changed files
with
76 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<chapter xml:id="ch-boolean-algebra" xmlns:xi="http://www.w3.org/2001/XInclude"> | ||
<title>Boolean Algebra</title> | ||
|
||
<introduction> | ||
<p> Boolean algebra introduction paragraph here </p> | ||
</introduction> | ||
|
||
<!-- include sections --> | ||
<xi:include href="sec-boolean-definition.ptx" /> | ||
|
||
|
||
</chapter> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<section xml:id="sec-boolean-definition" xmlns:xi="http://www.w3.org/2001/XInclude"> | ||
<title>Definition</title> | ||
<p> | ||
Boolean algebra is a branch of algebra that deals with variables that can take two values: true or false. This form of algebra is foundational in fields such as digital electronics and computer science where binary systems are prevalent. | ||
</p> | ||
<p> | ||
In SageMath, Boolean algebra can be manipulated through various built-in functions designed for handling Boolean variables and expressions. | ||
</p> | ||
<sage> | ||
<input> | ||
B = BooleanPolynomialRing(3, 'x') | ||
f = B('x0 + x1 * x2') | ||
show(f) | ||
</input> | ||
<output> | ||
# Outputs the Boolean expression in polynomial form | ||
</output> | ||
</sage> | ||
<p> | ||
A common structure analyzed in Boolean algebra is the lattice. Below, we show how to work with a divisor lattice, which is a specific type of lattice useful in various mathematical computations. | ||
</p> | ||
<sage> | ||
<input> | ||
p = Posets.DivisorLattice(20) | ||
p.show() | ||
</input> | ||
<output> | ||
# This will display the lattice structure for divisors of the number 20. | ||
</output> | ||
</sage> | ||
<p> | ||
The following Sage cell checks whether the divisor lattice is distributive. A distributive lattice is one where the operations of join and meet distribute over each other. | ||
</p> | ||
<sage> | ||
<input> | ||
p = Posets.DivisorLattice(20) | ||
p.is_distributive(certificate='True') | ||
</input> | ||
<output> | ||
# Returns True if the lattice is distributive, along with a certificate if applicable. | ||
</output> | ||
</sage> | ||
<p> | ||
Another important property in Boolean algebra is the complemented lattice. A complemented lattice is one where every element has a complement in the lattice. | ||
</p> | ||
<sage> | ||
<input> | ||
p = Posets.DivisorLattice(20) | ||
p.is_complemented(certificate='True') | ||
</input> | ||
<output> | ||
# Returns True if the lattice is complemented, along with a certificate if applicable. | ||
</output> | ||
</sage> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters