Skip to content

Latest commit

 

History

History
357 lines (234 loc) · 7.06 KB

slides.md

File metadata and controls

357 lines (234 loc) · 7.06 KB
theme class highlighter colorSchema download info
./simple
text-center
prism
light
true
## Simple-slidev-sample Simple Slidev Sample

Simple Slidev Sample

Slides that Illustrate Slidev's Features

Gregory M. Kapfhammer

Press Space for next page


Technical Question



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! 🚀


Hello World with Highlighting

# 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}" ?


Using a mapper with a Sequence


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)


Understanding the Monoid

  • 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!


Average Computation with Multisets

<style> p { font-size: 25px; } </style>

$$O = ((o_1, \ldots, o_n))$$

$$S = \sum_{o_i \in O} o_i$$

$$A = \frac{S}{|O|}$$

What is the meaning of $o_i \in O$?

Where does this exist in Python code?

Explore the use of the sum function in Python!


Average Computation with Multisets

<style> p { font-size: 25px; } </style>

$$O = ((o_1, \ldots, o_n))$$

$$S = \sum_{o_i \in O} o_i$$

$$A = \frac{S}{|O|}$$

What is the meaning of $o_i \in O$?

Where does this exist in Python code?

Explore the use of the sum function in Python!


Summary of the Abstraction Jumping

  • 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?


Simpler Slide with Bulleted List

  • Item 1

    • Sub list
    • Sub list again
  • Item 2

  • Item 3

  • Item 4


class: text-center

Simple slid with some math

We often say that "$S$ is a monoid under $\otimes$ with identity $\epsilon$"

graph LR

B[Text] --> C{Decision}
C -->|One| D[Result 1]
C -->|Two| E[Result 2]
Loading

Sample Diagrams in Mermaid

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
Loading
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
Loading
graph LR
    A["Something"]:::someclass --> B
    B --> C
    A --> C
    D --> C
    classDef someclass fill:#f96;
Loading

Additional Diagram Slide

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;
Loading
  • What happens when I am typing a long message and I see some $f(x)$

Separate Diagram Slide Again

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;
Loading
  • What happens when I am typing a long message and I see some $f(x)$

Separate Diagram Slide Last

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;
Loading
  • What happens when I am typing a long message and I see some $f(x)$