Skip to content

Commit

Permalink
kb autocommit
Browse files Browse the repository at this point in the history
  • Loading branch information
Jemoka committed Mar 13, 2024
1 parent a51d426 commit 814a9ec
Show file tree
Hide file tree
Showing 5 changed files with 345 additions and 22 deletions.
133 changes: 133 additions & 0 deletions content/posts/KBhconvolution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
+++
title = "convolution"
author = ["Houjun Liu"]
draft = false
+++

For \\(f,g : \mathbb{R} \to \mathbb{C}\\), we have:

\begin{equation}
(f \* g)(x) = \int\_{\mathbb{R}} f(x-y) g(y) \dd{y} = \int\_{\mathbb{R}} f(y) g(x-y) \dd{y}
\end{equation}


## properties of convolution {#properties-of-convolution}

- \\((g \* f) (x) = (f \* g) (x)\\)
- \\(\mathcal{F}(f \* g) = \mathcal{F}(f)\mathcal{F}(g)\\)
- \\(\mathcal{F}^{-1}(\hat{f} \hat{g}) = f \* g\\)
- \\((f \* g)' = f \* g' = f' \* g\\)
- \\(\lambda ( f \* g ) = (\lambda f) \* g = f \* (\lambda g)\\)

=&gt; "in a convolution, if **ANY ONE** of the two functions are [Differentiable]({{< relref "KBhuniqueness_and_existance.md#differentiable" >}}), both are [Differentiable]({{< relref "KBhuniqueness_and_existance.md#differentiable" >}})."; think about smoothing a jagged function using a [Gaussian]({{< relref "KBhgaussian.md" >}}).


## examples {#examples}


### rolling average {#rolling-average}

\begin{align}
U\_{L}(x) = \begin{cases}
L, |x| \leq \frac{1}{2L} \\\\
0, |x| > \frac{1}{2L}
\end{cases}
\end{align}

The width of the area for which the expression is positive is \\(2L\\), and the height is \\(L\\), so the area (integral) is \\(1\\).

So now let's consider:

\begin{equation}
(f \* U\_{L})(x)
\end{equation}

which is:

\begin{equation}
\int\_{\mathbb{R}} f(x-y) U\_{L}(y) \dd{y}
\end{equation}

meaning:

\begin{equation}
L \int\_{-\frac{1}{2}L}^{\frac{1}{2}L} f(x-y) \dd{y}
\end{equation}

You will note that we are sweeping something of window width \\(\frac{1}{L}\\) over the function, which averages the function \\(f\\) over the window \\(L\\).

So convolving with this function essentially smoothes function over a window \\(\frac{1}{L}\\); as \\(L\\) decreases, we are averaging over a greater interval; vise versa.


### signal compression {#signal-compression}

Write your signal in terms of its Fourier transform:

\begin{equation}
f(t) = \frac{1}{2\pi} \int\_{-\infty}^{\infty} e^{it\lambda} \hat{f}(\lambda) \dd{\lambda}
\end{equation}

We can write:

\begin{equation}
\hat{f}(\lambda) \cdot 1\_{J}(\lambda)
\end{equation}

whose inverse Fourier transform would be:

\begin{equation}
f(x) \* \mathcal{F}\qty(1\_{J}(\lambda))
\end{equation}


## motivation {#motivation}

What if we want the [Fourier Transform]({{< relref "KBhfourier_transform.md" >}}) of \\(\hat{f}(\lambda)\hat{g}(\lambda)\\) in terms of one expression?

Consider:

\begin{equation}
\hat{f}(\lambda) \hat{g}(\lambda) = \qty(\int\_{\mathbb{R}} f(x) e^{-i\lambda x} \dd{x}) \qty(\int\_{\mathbb{R}} g(y) e^{-i\lambda y} \dd{y})
\end{equation}

Notice that because neither integral have dependence on the other, we can actually:

\begin{equation}
\hat{f}(\lambda) \hat{g}(\lambda) = \int\_{\mathbb{R}} \int\_{\mathbb{R}} f(x) g(y) e^{-i\lambda (x+y)} \dd{x}\dd{y}
\end{equation}

writing this as a change of variable:

\begin{equation}
\begin{cases}
u = x+y \\\\
x = u-y \\\\
\dd{x} = \dd{u}
\end{cases}
\end{equation}

we can write:

\begin{equation}
\hat{f}(\lambda) \hat{g}(\lambda) = \int\_{\mathbb{R}} \qty(\int\_{\mathbb{R}} f(u-y) g(y) e^{-i\lambda (u)} \dd{u})\dd{y}
\end{equation}

Considering they the integrands are isolated and decaying, we can swap them, pulling out also \\(e^{-i\lambda(u)}\\) because it has no \\(y\\) dependence:

\begin{equation}
\hat{f}(\lambda) \hat{g}(\lambda) = \int\_{\mathbb{R}} \qty(\int\_{\mathbb{R}} f(u-y) g(y) \dd{y})e^{-i\lambda (u)} \dd{u}
\end{equation}

Notice! The inner part is a function, and the outer part is a Fourier transform! This is similar to a [convolution (probability)]({{< relref "KBhrandom_variables.md#adding-random-variables" >}})!

Meaning:

\begin{equation}
\hat{f}(\lambda) \hat{g}(\lambda) = \mathcal{F}(f \* g) = \mathcal{F}(f) \mathcal{F}(g)
\end{equation}

Operating on the inverse, we can obtain a similar result:

\begin{equation}
\mathcal{F}^{-1}(\hat{f} \hat{g}) = f \* g
\end{equation}
5 changes: 5 additions & 0 deletions content/posts/KBhos_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ how do we [trust]({{< relref "KBhprivacy.md#trust" >}}) software?

- [modern OS]({{< relref "KBhmodern_os.md" >}})


#### trust and OS {#trust-and-os}

- [trust]({{< relref "KBhprivacy.md#trust" >}})

---

An example of a good time:
Expand Down
53 changes: 52 additions & 1 deletion content/posts/KBhprivacy.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,58 @@ draft = false
- "fiduciary": proxy between you and a company
- "should anyone who has access to personal info have a fiduciary responsibility?"

---

## key trust questions {#key-trust-questions}

- who/what do we trust?
- what do we do if trust isn't upheald?
- how to approach building trust


## trust {#trust}

**trust**: to stop questioning the responsibility of something

- intentions
- dependence
- extensions of agency

We mostly don't trust software; instead, we trust the people that developed the software.


## accountability {#accountability}

a lot of people who are accountable in this chain:

- hardware designer (intel)
- OS developer (iOS, ec.)
- app developer
- users


## stakeholder {#stakeholder}

1. **direct stakeholders** (people who are operating, technicians, etc.)
2. **indirect stakeholders**: patients

purchase = long-term support ---- what do you do to get it fixed/repaired.


## time {#time}

- support duration
- obsolescence (how long is the end of support)
- products/services may not be garanteed forever
- problems with halting use---requires deleting entire pentagram account


## meltdown vulnerability {#meltdown-vulnerability}

**meltdown**: hardware vulnerability that allows an user program to access kernel level pages of system memory.

**potential ways of fixing a vulnerability/violation of trust**:

<https://www.cs.cmu.edu/~rdriley/487/papers/Thompson_1984_ReflectionsonTrustingTrust.pdf>


## loss of privacy {#loss-of-privacy}
Expand Down
131 changes: 110 additions & 21 deletions content/posts/KBhsu_math53_mar112024.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,145 @@ author = ["Houjun Liu"]
draft = false
+++

## convolution {#convolution}
## heat equation on the entire line {#heat-equation-on-the-entire-line}

For \\(f,g : \mathbb{R} \to \mathbb{C}\\), we have:
\begin{equation}
\pdv{u}{t} = \frac{1}{2} \pdv[2]{u}{x}
\end{equation}

We can try to find a:

\begin{equation}
(f \* g)(x) = \int\_{\mathbb{R}} f(x-y) g(y) \dd{y}
U(0,x) = f(x)
\end{equation}

if we write:

\begin{equation}
\hat{U}(t,\lambda) = \int e^{-i x \lambda} U(t,x) \dd{x}
\end{equation}

### properties of convolution {#properties-of-convolution}
which means we can write, with initial condtions:

- \\((g \* f) (x) = (f \* g) (x)\\)
- \\(\mathcal{F}(f \* g) = \mathcal{F}(f)\mathcal{F}(g)\\)
\begin{equation}
\hat{U} (t, \lambda) = \hat{f}(\lambda) e^{- t \frac{\lambda^{2}}{2}}
\end{equation}

We want to reach a close form:

\begin{equation}
U (t, x) = \frac{1}{\sqrt{2\pi} t} \int\_{-\infty}^{\infty} f(y) e^{-\frac{(x-y)^{2}}{2t}} \dd{y}
\end{equation}

---

Steps: recall we ended up at

\begin{equation}
\hat{U} (t, \lambda) = \hat{f}(\lambda) e^{- t \frac{\lambda^{2}}{2}}
\end{equation}

Let's call:

\begin{equation}
\hat{g}(\lambda) = e^{- t \frac{\lambda^{2}}{2}}
\end{equation}

so we have:

\begin{equation}
\hat{U} (t, \lambda) = \hat{f}(\lambda) \hat{g}(\lambda)
\end{equation}

we can use [convolution]({{< relref "KBhconvolution.md#convolution" >}}) to figure \\(U(t,x)\\).

Recall that the Fourier transform of a Gaussian:

\begin{equation}
\mathcal{F}\qty(e^{-\frac{ax^{2}}{2}}) = \sqrt{\frac{2\pi}{a}}e^{-\frac{\lambda^{2}}{2a}}
\end{equation}

### motivation {#motivation}
Let's first set:

What if we want the [Fourier Transform]({{< relref "KBhfourier_transform.md" >}}) of \\(\hat{f}(\lambda)\hat{g}(\lambda)\\) in terms of one expression?
\begin{equation}
a = \frac{1}{t}
\end{equation}

Consider:
Which will give us that:

\begin{equation}
\hat{f}(\lambda) \hat{g}(\lambda) = \qty(\int\_{\mathbb{R}} f(x) e^{-i\lambda x} \dd{x}) \qty(\int\_{\mathbb{R}} g(y) e^{-i\lambda y} \dd{y})
g(x) = \frac{1}{\sqrt{2\pi t} } e^{-\frac{x^{2}}{2t}}
\end{equation}

Notice that because neither integral have dependence on the other, we can actually:
Meaning, with convolution:

\begin{equation}
\hat{f}(\lambda) \hat{g}(\lambda) = \int\_{\mathbb{R}} \int\_{\mathbb{R}} f(x) g(y) e^{-i\lambda (x+y)} \dd{x}\dd{y}
\mathcal{F}^{-1}(\hat{f} \hat{g}) = f \* g
\end{equation}

writing this as a change of variable:

### why does this make sense {#why-does-this-make-sense}

We are convolving a Gaussian against \\(f(x)\\). Meaning, at very small \\(t\\) , we are taking a very small window of size \\(1\\) against.


### Heavyside function {#heavyside-function}

\begin{equation}
\begin{cases}
u = x+y \\\\
\dd{x} = \dd{u}
f(x) = \begin{cases}
1, x\geq 0 \\\\
0, x<0
\end{cases}
\end{equation}

we can write:
This gives: if we split the room by \\(x\\). Recall:

\begin{equation}
\hat{f}(\lambda) \hat{g}(\lambda) = \int\_{\mathbb{R}} \qty(\int\_{\mathbb{R}} f(u-y) g(y) e^{-i\lambda (u)} \dd{u})\dd{y}
U (t, x) = \frac{1}{\sqrt{2\pi} t} \int\_{-\infty}^{\infty} f(y) e^{-\frac{(x-y)^{2}}{2t}} \dd{y}
\end{equation}

Considering they the integrands are isolated and decaying, we can swap them, pulling out also \\(e^{-i\lambda(u)}\\) because it has no \\(y\\) dependence:
Given our \\(f\\), this becomes:

\begin{equation}
U (t, x) = \frac{1}{\sqrt{2\pi} t} \int\_{0}^{\infty} e^{-\frac{(x-y)^{2}}{2t}} \dd{y}
\end{equation}

If we change variables:

\begin{align}
\frac{(x-y)^{2}}{2t} - \qty( \frac{x}{\sqrt{2t}} - \frac{y}{\sqrt{2t}})^{2}
\end{align}

which means:

\begin{equation}
z = \frac{y}{2\sqrt{t}}
\end{equation}

\begin{equation}
\hat{f}(\lambda) \hat{g}(\lambda) = \int\_{\mathbb{R}} \qty(\int\_{\mathbb{R}} f(u-y) g(y) \dd{y})e^{-i\lambda (u)} \dd{u}
\frac{1}{\sqrt{\pi}} \int\_{0}^{\infty} e^{^{-\qty(\frac{x}{\sqrt{2t}} - z)^{2}}} \dd{z}
\end{equation}

Notice! The inner part is a function, and the outer part is a Fourier transform! This is similar to a [convolution (probability)]({{< relref "KBhrandom_variables.md#adding-random-variables" >}})!
and we will also apply:

\begin{equation}
w = z - \frac{x}{\sqrt{2t}}
\end{equation}

which will give:

\begin{equation}
\frac{1}{\sqrt{\pi}} \int\_{-\frac{x}{\sqrt{2t}}}^{\infty} e^{-w^{2}} \dd{w}
\end{equation}

notice, as \\(x\\) increases, we are integrating more of a Gaussian, which will be exceedingly close to \\(1\\); as \\(x\\) decreases, we'll get closer to \\(0\\). And also, \\(t\\) smoothed \\(x\\) out, which means as \\(t\\) increases the interface between \\(0\\) and \\(1\\) becomes smoother.


## erf {#erf}

[erf](#erf)


## [convolution]({{< relref "KBhconvolution.md#convolution" >}}) {#convolution--kbhconvolution-dot-md}

see [convolution]({{< relref "KBhconvolution.md#convolution" >}})
Loading

0 comments on commit 814a9ec

Please sign in to comment.