theme | class | highlighter | colorSchema | download | info |
---|---|---|---|---|---|
./simple |
text-center |
prism |
light |
true |
## Simple-slidev-sample
Simple Slidev Sample
|
Gregory M. Kapfhammer
How do I connect mathematical terminology (e.g., mapping, function, number, sequence, and set), to the implementation of Python programs that declare and call functions and declare and manipulate variables?
Let's learn more about how the use of precise mathematical terms and concepts helps to effectively communicate and perform Python programming tasks! 🚀
# declare multiple variables
hello = "hello"
world = "world"
space = " "
value = .50
message = world + space + hello
print(f"The message is: {message}")
print(f"The value is: {value}")
Can you predict the output of this program?
What is the purpose of f"The message is: {message}"
?
def square(value: int):
return value * value
def mapper(f, sequence):
result = ( )
for element in sequence:
result += ( f(element), )
return result
squared_range = mappper(square, range(10))
print(squared_range)
-
A monoid is an ordered pair
$(S, \otimes)$ for a set$S$ and any binary operator$\otimes$ that satisfies the following conditions:-
Type Preservation:
$\forall s_1, s_2 \in S$ ,$s_1 \otimes s_2 \in S$ -
Associative Property:
$\forall s_1, s_2, s_3 \in S$ ,$(s_1 \otimes s_2) \otimes s_3 = s_1 \otimes (s_2 \otimes s_3)$ -
Identity Element:
$\exists \epsilon \in S$ , such that$\forall s \in S, \epsilon \otimes s = s$ and$s \otimes \epsilon = s$
-
-
We often say that
$S$ is a monoid under$\otimes$ with identity$\epsilon$ -
If this is confusing, a monoid is a generalization of strings and integers!
-
If you know how strings behave in Python or Java then you understand the monoid --- monoid describes
string-like
structures!
<style> p { font-size: 25px; } </style>
What is the meaning of
Where does this exist in Python code?
Explore the use of the sum
function in Python!
<style> p { font-size: 25px; } </style>
What is the meaning of
Where does this exist in Python code?
Explore the use of the sum
function in Python!
-
What is the connection between the discrete mathematical structures and the Python programs?
-
Connections between discrete mathematics and Python
-
Generic file: a sequence of sequences
-
Names in the file: a set of strings
-
Emails in the file: a set of ordered pairs forming a relation
-
Temperatures in the file: a multiset of integers
-
-
When might the emails in the file be a mapping? When might the temperatures in the file be a sequence?
-
Item 1
- Sub list
- Sub list again
-
Item 2
-
Item 3
-
Item 4
We often say that "$S$ is a monoid under
graph LR
B[Text] --> C{Decision}
C -->|One| D[Result 1]
C -->|Two| E[Result 2]
graph LR
id1(Start)-->id2(Stop)
style id1 fill:#f9f,stroke:#333,stroke-width:4px,font size: 1px
style id2 fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5
graph LR
id1(Origination)-->id2(Entrance Examination)
id1(Entrance Examination)-->id2(Examination)
style id1 fill:#f9f,stroke:#333,stroke-width:4px
style id2 fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5
graph LR
A["Something"]:::someclass --> B
B --> C
A --> C
D --> C
classDef someclass fill:#f96;
graph LR
SensorOne:::process --> SequenceOne("Data Sequence"):::process
SequenceOne --> AnalysisOne["Data Analysis"]:::process
AnalysisOne --> AverageOne("Computed Average"):::process
AnalysisOne --> GraphOne("Data Graph"):::process
classDef process fill:#9E9E9E,stroke-width:2px,stroke:#212121;
- What happens when I am typing a long message and I see some
$f(x)$
graph LR
Sensor:::process --> Sequence("Data Sequence"):::process
Sequence --> Analysis["Data Analysis"]:::process
Analysis --> Average("Computed Average"):::process
Analysis --> Graph("Data Graph"):::process
classDef process fill:#9E9E9E,stroke-width:2px,stroke:#212121;
- What happens when I am typing a long message and I see some
$f(x)$
graph LR
Sensor:::process --> Sequence("Data Sequence"):::process
Sequence --> Analysis["Data Analysis"]:::process
Analysis --> Average("Computed Average"):::process
Analysis --> Graph("Data Graph"):::process
classDef process fill:#9E9E9E,stroke-width:2px,stroke:#212121;
- What happens when I am typing a long message and I see some
$f(x)$