Skip to content

Commit

Permalink
Update docs GIFs #19
Browse files Browse the repository at this point in the history
To improve quality, gifs were replaced with png images.
  • Loading branch information
dylannalex committed Dec 28, 2022
1 parent 68a0c7f commit 4dba131
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 31 deletions.
41 changes: 20 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ A function has been translated when it has been moved in a way that does not cha

To visualize translations, we will use the function $f(x) = x^{2}$.

<p align="center">
<img width="500" height="500" src="docs/source/img/function_x_squared.png">
</p>

```python
import curvipy

Expand All @@ -40,15 +44,14 @@ plotter.plot_curve(curve)
plotter.wait()
```

<p align="center">
<img width="500" height="500" src="docs/source/img/function_x_squared.png">
</p>


### Horizontal Translation

In a horizontal translation, the function is moved along the x-axis.

<p align="center">
<img width="500" height="500" src="docs/source/img/horizontal_translation.png">
</p>

```python
import curvipy

Expand Down Expand Up @@ -80,14 +83,14 @@ plotter.plot_curve(curvipy.Function(m, interval))
plotter.wait()
```

<p align="center">
<img width="500" height="500" src="docs/source/img/horizontal_translation.gif">
</p>

### Vertical Translation

In a horizontal translation, the function is moved along the y-axis.

<p align="center">
<img width="500" height="500" src="docs/source/img/vertical_translation.png">
</p>

```python
import curvipy

Expand Down Expand Up @@ -118,10 +121,6 @@ plotter.plot_curve(curvipy.Function(m, interval))
plotter.wait()
```

<p align="center">
<img width="500" height="500" src="docs/source/img/vertical_translation.gif">
</p>

## Linear transformations

A linear transformation $f$ is a mapping between two vector spaces
Expand Down Expand Up @@ -154,6 +153,10 @@ $$

transforms the function $f(x) =\frac{x}{2}\sin(x)$.

<p align="center">
<img width="500" height="500" src="docs/source/img/transformation_matrix.png">
</p>

```python
import math
import curvipy
Expand All @@ -180,10 +183,6 @@ plotter.plot_curve(transformed_curve)
plotter.wait()
```

<p align="center">
<img width="500" height="500" src="docs/source/img/transformation_matrix.gif">
</p>

As you can see above, the matrix $A$ rotates the function $f(x)$ ninety degree anticlockwise.

**Note:** `curvipy.TransformedCurve`
Expand All @@ -209,6 +208,10 @@ $$

and see how they transform the curve $f(x) = x^{3}$.

<p align="center">
<img width="500" height="500" src="docs/source/img/mat_multiplication_commutative_property.png">
</p>

```python
import curvipy

Expand Down Expand Up @@ -242,10 +245,6 @@ plotter.plot_curve(BA_transformed_curve)
plotter.wait()
```

<p align="center">
<img width="500" height="500" src="docs/source/img/mat_multiplication_commutative_property.gif">
</p>

As you can see above, transforming $f(x)$ with the matrix $AB$ gives a different result as transforming $f(x)$ with the matrix $BA$.

You can also use numpy arrays to define **AB_transformed_curve** and **BA_transformed_curve** curves:
Expand Down
Binary file modified docs/source/img/function_x_squared.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/source/img/horizontal_translation.gif
Binary file not shown.
Binary file added docs/source/img/horizontal_translation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/source/img/transformation_matrix.gif
Binary file not shown.
Binary file added docs/source/img/transformation_matrix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/source/img/vertical_translation.gif
Binary file not shown.
Binary file added docs/source/img/vertical_translation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 10 additions & 10 deletions docs/source/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ A function has been translated when it has been moved in a way that does not cha

To visualize translations, we will use the function {math}`f(x) = x^{2}`.

![image](img/function_x_squared.png){width="500px" align=center}

```python
import curvipy

Expand All @@ -40,12 +42,12 @@ plotter.plot_curve(curve)
plotter.wait()
```

![image](img/function_x_squared.png){width="500px" align=center}

### Horizontal Translation

In a horizontal translation, the function is moved along the x-axis.

![image](img/horizontal_translation.png){width="500px" align=center}

```python
import curvipy

Expand Down Expand Up @@ -77,12 +79,12 @@ plotter.plot_curve(curvipy.Function(m, interval))
plotter.wait()
```

![image](img/horizontal_translation.gif){width="500px" align=center}

### Vertical Translation

In a horizontal translation, the function is moved along the y-axis.

![image](img/vertical_translation.png){width="500px" align=center}

```python
import curvipy

Expand Down Expand Up @@ -113,8 +115,6 @@ plotter.plot_curve(curvipy.Function(m, interval))
plotter.wait()
```

![image](img/vertical_translation.gif){width="500px" align=center}

## Linear transformations

A linear transformation {math}`f` is a mapping between two vector spaces
Expand Down Expand Up @@ -149,6 +149,8 @@ A = \begin{bmatrix}0 & -1\\1 & 0\end{bmatrix}

transforms the function {math}`f(x) =\frac{x}{2}\sin(x)`.

![image](img/transformation_matrix.png){width="500px" align=center}

```python
import math
import curvipy
Expand All @@ -175,8 +177,6 @@ plotter.plot_curve(transformed_curve)
plotter.wait()
```

![image](img/transformation_matrix.gif){width="500px" align=center}

As you can see above, the matrix {math}`A` rotates the function {math}`f(x)` ninety degree anticlockwise.

```{note}
Expand All @@ -196,6 +196,8 @@ A = \begin{bmatrix}0 & -1\\1 & 0\end{bmatrix} \text{and } B =\begin{bmatrix}1 &

and see how they transform the curve {math}`f(x) = x^{3}`.

![image](img/mat_multiplication_commutative_property.png){width="500px" align=center}

```python
import curvipy

Expand Down Expand Up @@ -229,8 +231,6 @@ plotter.plot_curve(BA_transformed_curve)
plotter.wait()
```

![image](img/mat_multiplication_commutative_property.gif){width="500px" align=center}

As you can see above, transforming {math}`f(x)` with the matrix {math}`AB` gives a different result as transforming {math}`f(x)` with the matrix {math}`BA`.

You can also use numpy arrays to define **AB_transformed_curve** and **BA_transformed_curve** curves:
Expand Down

0 comments on commit 4dba131

Please sign in to comment.