Skip to content

Latest commit

 

History

History
1178 lines (947 loc) · 28.1 KB

Final_Pres.org

File metadata and controls

1178 lines (947 loc) · 28.1 KB

Complex and Hypercomplex @@latex:\@@ Iterative Methods

1 Config/Preamble

1.1 Header

1.2 Emacs Config

1.3 LaTeX Config

1.3.1 Set Beamer Theme

1.3.2 Use Listings instead of verbatim

1.3.3 Fix Captions

1.3.4 Animate

1.3.5 SVG

1.3.6 Define abs

1.3.7 Configure fonts

1.3.8 Environments

1.3.8.1 Angled Small Vector

1.3.8.2 Angled Vector

1.3.8.3 Tight Align

1.4 Python Config

2 Introduction

2.1 Definitions

2.1.1 Iterative Method

A sequence where each value in the sequence is defined by the previous value.

2.1.2 Dynamical System

A system that enacts rules on a set of variables to produce a state.

2.1.3 Complex Dynamics

The study of dynamical systems defined by complex functions.

2.1.4 Fractal

TODO

3 Iteration

3.1 Iteration

3.1.1 Function Iteration

$f^0 := \symbf{I}$

$fk+1 := f ˆ f^k$

3.1.2 Example

Given $f(x) = x + 1$,

\begin{talign*} \onslide<3->{f^0(x) & = x \} \onslide<4->{f^1(x) & = x + 1 \} \onslide<5->{f^2(x) & = (x + 1) + 1 \} \onslide<6->{f^3(x) & = \left((x + 1) + 1\right) + 1 \} \onslide<6->{\vdots} \end{talign*}

4 Complex Iterative Methods

4.1 Complex Numbers

4.1.1 Complex Numbers

$\symbf{i}^2 = -1$

$\{a + b \symbf{i} : a,b ∈ \symbb{R} \} ∈ \symbb{C}$

4.1.2 Addition

Let $a,b,x,y ∈ \symbb{R}$,

\begin{talign*} (a + b\symbf{i}) + (x + y\symbf{i}) \onslide<4->{& = (a + x) + (b + y)\symbf{i}} \end{talign*}

4.1.3 Multiplication

Let $a,b,x,y ∈ \symbb{R}$,

\begin{talign*} (a + b\symbf{i}) ∗ (x + y\symbf{i}) \onslide<7->{& = ax + ay\symbf{i} + bx\symbf{i} + by\symbf{i}^2 \} \onslide<8->{& = (ax - by) + (ay + bx)\symbf{i}} \end{talign*}

4.2 Complex Iteration

4.2.1 Text

4.2.1.1 Rules

$f(z) = z^2$

$z_0 = \frac{1}{\sqrt{2}} + \frac{1}{\sqrt{2}} \symbf{i}$

4.2.1.2 The Rest

  • $f^0(z) = \frac{1}{\sqrt{2}} + \frac{1}{\sqrt{2}} \symbf{i}$
  • $f^1(z) \only&lt;2&gt;{= \left( \frac{1}{\sqrt{2}} + \frac{1}{\sqrt{2}} \symbf{i} \right)^2 = \left( \frac{1}{\sqrt{2}} \right)^2 - \left(\frac{1}{\sqrt{2}} + \frac{1}{\sqrt{2}}\right)^2 + \left(\frac{1}{\sqrt{2}} + \frac{1}{\sqrt{2}}\right)^2 \symbf{i}} = \symbf{i}$
  • $f^2(z) = -1$
  • $f^3(z) = 1$
  • $f^4(z) = f^5(z) = f^6(z) = 1$

4.2.2 Image

4.2.2.1 Generator

4.2.2.2 Results

4.3 Complex Iteration

4.3.1 Text

4.3.1.1 Rules

$f(z) = z^2 - \frac{1}{10} - \frac{1}{10} \symbf{i}$

$z_0 = \frac{1}{\sqrt{2}} + \frac{1}{\sqrt{2}} \symbf{i}$

4.3.1.2 The Rest

  • $f^0(z) = \frac{1}{\sqrt{2}} + \frac{1}{\sqrt{2}} \symbf{i}$
  • $f^1(z) \only&lt;2&gt;{= -\frac{1}{10} + \left(1 - \frac{1}{10}\right)\symbf{i}} = -0.1 + 0.9\symbf{i}$
  • $f^2(z) = -0.9-0.28\symbf{i}$
  • $f^3(z) = 0.6316+0.404\symbf{i}$
  • $f^4(z) ≈ 0.13570256+0.4103328\symbf{i}$
  • $f^5(z) ≈ -0.24995782+0.01136642\symbf{i}$
  • $f^6(z) ≈ -0.03765028-0.10568225\symbf{i}$

4.3.2 Image

4.3.2.1 Generator

4.3.2.2 Results

4.4 Group Activity

4.4.1 Easier

$f(z) = z^2 - 0.2 + 0 \symbf{i}$

$z_0 = 0.5 + 0 \symbf{i}$

4.4.2 Harder

$f(z) = z^2 -0.2 + 0.4 \symbf{i}$

$z_0 = 0.5 - 0.5 \symbf{i}$

4.5 Group Activity (Easier)

4.5.1 Text

4.5.1.1 Rules

$f(z) = z^2 -0.2 + 0 \symbf{i}$

$z_0 = 0.5 + 0 \symbf{i}$

4.5.1.2 The Rest

  • $f^0(z) = 0.5$
  • $f^1(z) = 0.05$
  • $f^2(z) = -0.1975$
  • $f^3(z) = -0.16099375$
  • $f^4(z) ≈ -0.1740810125$

4.5.2 Image

4.5.2.1 Generator

4.5.2.2 Results

4.6 Group Activity (Harder)

4.6.1 Text

4.6.1.1 Rules

$f(z) = z^2 -0.2 + 0.4 \symbf{i}$

$z_0 = 0.5 - 0.5 \symbf{i}$

4.6.1.2 The Rest

  • $f^0(z) = 0.5 - 0.5 \symbf{i}$
  • $f^1(z) = -0.2 - 0.1 \symbf{i}$
  • $f^2(z) = -0.17 + 0.44 \symbf{i}$
  • $f^3(z) = -0.3647 + 0.2504 \symbf{i}$
  • $f^4(z) = -0.12969407 + 0.21735824 \symbf{i}$

4.6.2 Image

4.6.2.1 Generator

4.6.2.2 Results

4.7 Implementation

4.7.1 Iteration (Python)

N = 128
B = 4
c = complex(-0.2, 0.4)
def iterate(z):
    for n in range(N):
        z = z*z + c
        if abs(z) > B*B: break
    return n

4.7.2 Graph

4.8 TODO Iterative Fractals

4.8.1 Text

4.8.1.1 Complex Juila Set Example

Defined by iterative function in complex space

  • $f_c (z) = z^2 - 0.675 - 0.112\symbf{i}$
  • $K_c = \left\{ z_0 ∈ \symbb{C}: \abs{f^k_c \left(z_0 \right)} &gt; B \text{ as } k → ∞\right\}$

4.8.2 Julia Set

./Figs/Fig_2v2.png

5 Quaternions

5.1 Quaternions History

5.1.1 Left

./Figs/Fig_3.jpg

5.1.2 Right

./Figs/Fig_4.png

5.2 Quaternions

5.2.1 Quaternion

$\symbf{i}^2 = \symbf{j}^2 = \symbf{k}^2 = \symbf{ijk} = -1$

$\left\{ d + a\symbf{i} + b\symbf{j} + c\symbf{k} : a,b,c,d ∈ \symbb{R} \right\} ∈ \symbb{H}$

5.2.2 Proof

  • @@b:<2->@@ $\symbf{i}^2 = \symbf{ijk}$

    \begin{talign*} \symbf{i}-1 \symbf{i}^2 & = \symbf{i}-1 \symbf{ijk}
    \symbf{i} & = \symbf{jk} \end{talign*}

  • @@b:<3->@@ $\symbf{k}^2 = \symbf{ijk}$

    \begin{talign*} \symbf{k}^2 \symbf{k}-1 & = \symbf{ijk} \symbf{k}-1
    \symbf{k} & = \symbf{ij} \end{talign*}

  • @@b:<3->@@ $\symbf{j} = \symbf{ki}$

5.2.3 Proof

  • @@b:<4->@@ $\symbf{i} = \symbf{jk}$

    \begin{talign*} \symbf{ji} & = \symbf{jjk}
    \symbf{ji} & = \symbf{j}^2 \symbf{k} \ \symbf{ji} & = -\symbf{k} \ -\symbf{k} & = \symbf{ji} \end{talign*}

  • @@b:<5->@@ $-\symbf{i} = \symbf{kj}$
  • @@b:<5->@@ $-\symbf{j} = \symbf{ik}$

5.3 Quaternion Multiplication

5.3.1 Let,

$\symbf{i}^2 = \symbf{j}^2 = \symbf{k}^2 = \symbf{ijk} = -1$

$p = d + a\symbf{i} + b\symbf{j} + c\symbf{k}$

$q = w + x\symbf{i} + y\symbf{j} + z\symbf{k}$

5.3.2 Equation

\begin{align*} p ∗ q \only<1-2>{& = dw + dx\symbf{i} + dy\symbf{j} + dz\symbf{k} \} \only<1-2>{& + aw\symbf{i} + ax\symbf{i}^2 + ay\symbf{ij} + az\symbf{ik} \} \only<1-2>{& + bw\symbf{j} + bx\symbf{ji} + by\symbf{j}^2 + bz\symbf{jk} \} \only<1-2>{& + cw\symbf{k} + cx\symbf{ki} + cy\symbf{kj} + cz\symbf{k}^2 \} \only<2-3>{& = dw - ax - by - cz \} \only<4>{& = dw - (ax + by + cz) \} \only<5->{& = dw - \begin{asvector} a\b\c \end{asvector} ⋅ \begin{asvector} x\y\z \end{asvector} \} \only<2-5>{& + dx\symbf{i} + aw\symbf{i} + bz\symbf{i} - cy\symbf{i} \} \only<2-5>{& + dy\symbf{j} - az\symbf{j} + bw\symbf{j} + cx\symbf{j} \} \only<2-5>{& + dz\symbf{k} + ay\symbf{k} - bx\symbf{k} + cw\symbf{k} \} \onslide<6->{& + \begin{avector}} \onslide<6->{dx + aw + bz - cy \} \onslide<6->{dy - az + bw + cx \} \onslide<6->{dz + ay - bx + cw} \onslide<6->{\end{avector}} \onslide<6->{⋅ \begin{avector} \symbf{i} \ \symbf{j} \ \symbf{k} \end{avector} \} \onslide<7->{& = dw - \begin{asvector} a\b\c \end{asvector} ⋅ \begin{asvector} x\y\z \end{asvector} + \left(d \begin{asvector} x\y\z \end{asvector} \only<8->{+ w \begin{asvector} a\b\c \end{asvector}} \only<9->{+ \begin{asvector} a\b\c \end{asvector} × \begin{asvector} x\y\z \end{asvector}} \only<7-8>{\cdots} \right) ⋅ \begin{asvector} \symbf{i}\\symbf{j}\\symbf{k} \end{asvector}} \end{align*}

6 Quaternion Iterative Methods

6.1 Implementation

6.1.1 Quaternion Multiplication

def q_mult(p, q):
    r = Quat(
        p.w*q.wp.x*q.xp.y*q.y - p.z*q.z,
        p.w*q.x + p.x*q.w + p.y*q.z - p.z*q.y,
        p.w*q.yp.x*q.z + p.y*q.w + p.y*q.x,
        p.w*q.z + p.x*q.yp.y*q.x + p.z*q.w
    )
    return r

6.2 Implementation

6.2.1 Quaternion Square

def q_square(q):
    r = Quat(
        q.w*q.wq.x*q.xq.y*q.y - q.z*q.z,
        2*q.w*q.x,
        2*q.w*q.y,
        2*q.w*q.z
    )
    return r

6.3 Implementation

6.3.1 Quaternion Add

def q_add(p, q):
    r = Quat(
        p.w + q.w,
        p.x + q.x,
        p.y + q.y,
        p.z + q.z
    )
    return r

6.3.2 Quaternion Magnitude

def q_abs(q):
    return q.w*q.w +
           q.x*q.x +
           q.y*q.y +
           q.z*q.z

6.4 Implementation

6.4.1 Iteration

N = 12
B = 16
q = Quat(-0.2, 0.4, -0.4, -0.4)
def iterate(z):
    for n in range(N):
        z = q_add(q_square(z), q)
        if q_abs(z) > B*B: break
    return n

6.5 Iteration

6.5.1 Text

6.5.1.1 Rules

$f(z) = z^2 + 0.3 - 0.375\symbf{i} - 0.675\symbf{j} - 0.112\symbf{k}$

$z_0 = 0.5 - 0.5\symbf{i} + 0.5\symbf{j} - 0.5\symbf{k}$

6.5.1.2 The Rest

  • $f^0(z) = 0.5 - 0.5\symbf{i} + 0.5\symbf{j} - 0.5\symbf{k}$
  • $f^1(z) = -0.2 - 0.875\symbf{i} - 0.175\symbf{j} - 0.612\symbf{k}$
  • $f^2(z) = -0.831 - 0.025\symbf{i} - 0.605\symbf{j} + 0.133\symbf{k}$
  • $f^3(z) ≈ 0.6066 - 0.333\symbf{i} + 0.330\symbf{j} - 0.333\symbf{k}$
  • $f^4(z) ≈ 0.336 - 0.779\symbf{i} - 0.274\symbf{j} - 0.515\symbf{k}$
  • $f^5(z) ≈ -0.535 - 0.899\symbf{i} - 0.860\symbf{j} - 0.458\symbf{k}$

6.5.2 Image

6.5.2.1 Generator

6.5.2.2 Results

6.6 Plotting

6.6.1 Pane 1

6.6.1.1 Generator

6.6.1.2 Results

6.6.2 Pane 2

./Figs/Fig_1v2.png

6.7 Ray Tracing

./Figs/Fig_5-1.svg

6.8 Ray Marching

6.8.1 Image

./Figs/Fig_6.png

6.8.2 Distance Estimation

Let $f(z) = z^m + q$ where $q ∈ \symbb{H}, m ∈ \symbb{Z}^+$ be the iterative function of a Julia fractal. Then, the distance, $δ$, to the fractal can be approximated by \begin{align*} a \frac{z_n}{z_n’} < δ \end{align*} where $a ∈ \symbb{R}$ is some constant coefficient.

6.9 Normal Estimation

./Figs/Fig_5-2.svg

6.10 TODO Quaternion Iterative Fractals

6.10.1 Quaternion Juila Set Example

  • Defined by iterative function in 4D Quaternion space

6.10.2 Quaternion Julia Set

6.11 Summary

6.12 References

6.13 Questions?

https://github.com/scrufulufugus/senior-synthesis

./Figs/qr.png