Skip to content
Snippets Groups Projects
Commit 440f44ed authored by shawk masboob's avatar shawk masboob
Browse files

adding introduction notebook

parent 8e8bb9c7
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id: tags:
<h1><center>Topological Data Analysis</center></h1>
![Url](https://thumbs.gfycat.com/DisgustingBlandDromedary-size_restricted.gif)
<p style="text-align: center;">Gif from: https://gfycat.com/disgustingblanddromedary</p>
%% Cell type:code id: tags:
``` python
import numpy as np
import matplotlib.pyplot as plt
from ripser import ripser
from persim import plot_diagrams
%matplotlib inline
```
%% Cell type:markdown id: tags:
### Background
%% Cell type:markdown id: tags:
### Simplicial Complex
%% Cell type:markdown id: tags:
### Homology
%% Cell type:markdown id: tags:
#### Betti Number
%% Cell type:markdown id: tags:
#### Euler-Poincare Formula
%% Cell type:markdown id: tags:
### Persistent Homology
%% Cell type:code id: tags:
``` python
N = 25
r = np.random.uniform(-0.2, 0.2, N) # radious
theta = np.random.uniform(-np.pi, np.pi, N) # angles
x = (1+r)*np.cos(theta) # x-corodinate
y = (1+r)*np.sin(theta) # y-coordinate
X = np.column_stack((x,y)) # data set
plt.scatter(X[:,0], X[:,1])
plt.show()
```
%% Output
%% Cell type:code id: tags:
``` python
from matplotlib import pyplot as plt
from matplotlib import animation
def create_circle():
circle = plt.Circle((0, 0), 0.05)
return circle
def update_radius(i, circle):
circle.radius = i*0.5
return circle,
def create_animation():
fig = plt.gcf()
ax = plt.axes(xlim=(-10, 10), ylim=(-10, 10))
ax.set_aspect('equal')
circle = create_circle()
ax.add_patch(circle)
anim = animation.FuncAnimation(
fig, update_radius, fargs = (circle,), frames=30, interval=50)
plt.title('Simple Circle Animation')
plt.show()
if __name__ == '__main__':
create_animation()
```
%% Output
%% Cell type:markdown id: tags:
### References
%% Cell type:code id: tags:
``` python
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment