Skip to main content
Discrete Math with SageMath:
Learn math with open-source software
Zunaid Ahmed, Hellen Colman, Samuel Lubliner
Contents
Index
Search Book
close
Search Results:
No results.
Prev
Up
Next
\(\newcommand{\N}{\mathbb N} \newcommand{\Z}{\mathbb Z} \newcommand{\Q}{\mathbb Q} \newcommand{\R}{\mathbb R} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} \definecolor{fillinmathshade}{gray}{0.9} \newcommand{\fillinmath}[1]{\mathchoice{\colorbox{fillinmathshade}{$\displaystyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\textstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptscriptstyle\phantom{\,#1\,}$}}} \)
Front Matter
Preface
Acknowledgements
From the Student Authors
Authors and Contributors
Colophon
1
Getting Started
1.1
Intro to Sage
1.1.1
Sage as a Calculator
1.1.2
Variables and Names
1.2
Display Values
1.3
Object-Oriented Programming
1.4
Data Types
1.5
Iteration
1.6
Debugging
1.7
Defining Functions
1.8
Documentation
1.9
Run Sage in the browser
2
Set Theory
2.1
Creating Sets
2.1.1
Set Definitions
2.1.2
Set Builder Notation
2.1.3
Subsets
2.1.4
Set Membership Check
2.2
Cardinality
2.3
Operations on Sets
2.3.1
Union of Sets
2.3.2
Intersection of Sets
2.3.3
Difference of Sets
2.3.4
Multiple Sets
2.3.5
Complement of Sets
2.3.6
Cartesian Product of Sets
2.3.7
Power Sets
2.3.8
Viewing Power Sets
3
Combinatorics
3.1
Combinatorics
3.1.1
Factorial Function
3.1.2
Combinations
3.1.3
Permutations
4
Logic
4.1
Logical Operators
4.1.1
Boolean Formula
4.2
Truth Tables
4.3
Analyzing Logical Equivalences
4.3.1
Equivalent Statements
4.3.2
Tautologies
4.3.3
Contradictions
5
Relations
5.1
Introduction to Relations
5.2
Relations on a set
5.3
Digraphs
5.4
Properties
5.4.1
Reflexive
5.4.2
Symmetric
5.4.3
Antisymmetric
5.4.4
Transitive
5.5
Equivalence
5.6
Partial Order
6
Functions
6.1
Functions
6.1.1
Graphical Representations
6.2
Recursion
6.2.1
Recursion in Sequences
6.2.2
Recursion with Binomial Coefficients
7
Graph Theory
7.1
Basics
7.1.1
Graph Definition
7.1.2
Weighted Graphs
7.1.3
Graph Characteristics
7.1.4
Graphs and Matrices
7.1.5
Manipulating Graphs in Sage
7.2
Plot Options
7.2.1
Size
7.2.2
Edge Labels
7.2.3
Color
7.2.4
Layout
7.2.5
View in a New Tab
7.2.6
Edge Style
7.2.7
3-Dimensional
7.3
Paths
7.4
Isomorphism
7.5
Euler and Hamilton
7.5.1
Euler
7.5.2
Hamilton
7.6
Graphs in Action
7.6.1
Bike Courier Delivery Route Problem
7.6.2
Locations
7.6.3
Graph
8
Trees
8.1
Definitions and Theorems
8.2
Search Algorithms
8.3
Trees in Action
8.3.1
Railway Problem
8.3.2
Location Distances
8.3.3
Graph
8.3.4
Railway
8.3.5
Conclusion
9
Lattices
9.1
Lattices
9.1.1
Definition
9.1.2
Join
9.1.3
Meet
9.1.4
Divisor Lattice
9.2
Tables of Operations
9.2.1
Meet Operation Table
9.2.2
Join Operation Table
10
Boolean Algebra
10.1
Boolean Algebra
10.2
Boolean functions
11
Logic Gates
11.1
Basic Logic GatesNOT GateDerived Gates
11.2
Combinations of Logic Gates
11.3
Logic Gates in Action
11.3.1
Vote Encoder
11.3.2
Vote Counter
11.3.3
Majority Decider
11.3.4
Combining Everything: The Complete Voting Machine
12
Finite State Machines
12.1
Definitions and Components
12.1.1
Mealy State Machine
12.1.2
Other Types of Finite State Machines
12.1.2.1
Moore Machine
12.1.2.2
Finite-State Automaton
12.1.2.3
Deterministic Finite Automaton (DFA)
12.1.2.4
Nondeterministic Finite Automaton (NFA)
12.1.2.5
Turing Machine
12.2
Finite State Machines in Sage
12.2.1
The Elevator State Machine
12.2.1.1
Description of the Elevator FSM
12.2.1.2
Elements of the Elevator FSM
12.2.1.3
Graph Model of the Elevator FSM
12.2.1.4
Run the Elevator State Machine
12.2.2
The Traffic Light State Machine
12.2.2.1
Description of the Traffic Light FSM
12.2.2.2
Using `FiniteStateMachine’ Module
12.2.2.3
Using `Transducer’ Module
12.3
State Machine in Action
12.3.1
Traffic Light Controller: Problem Overview
12.3.2
Elements of the FSM Model
12.3.3
Construct the FSM
12.3.4
Display the State Transition Graph
12.3.5
Simulate a Full Cycle Run of the FSM
Back Matter
References
Colophon
Index
Chapter
9
Lattices
This chapter builds on the partial order sets introduced earlier and explains how to ask Sage to decide whether a given poset is a lattice. Then, we show how to calculate the meet and join tables using built-in and customized Sage functions.
9.1
Lattices
9.2
Tables of Operations