Skip to content
Snippets Groups Projects
Commit cf6201c9 authored by Christian Höfert's avatar Christian Höfert
Browse files

Revert "Delete M1_LineareAbbildungen.ipynb"

This reverts commit 4d033bed
parent abd34cac
No related tags found
1 merge request!1Revert "Delete M1_LineareAbbildungen.ipynb"
%% Cell type:markdown id: tags:
Importieren der nötigen Bibliotheken
%% Cell type:code id: tags:
``` python
import numpy as np
import math
import matplotlib.pyplot as plt
```
%% Cell type:markdown id: tags:
**Definition der Punktemenge** (Eckpunkte der folgenden Figur):
* Die Punkte werden zunächst als Zeilen einer $n \times 2$-Matrix $P$ definiert.
* Danach werden diese Matrix zu einer $2\times n$- Matrix transponiert $P \rightarrow P^T$.
%% Cell type:code id: tags:
``` python
#points =[[0,2],[0,-2],[3,0],[3,2],[4,3],[5,2],[-1,3]]
points =[[0,2],[1,-2],[3,0]]
points = np.transpose(points)
# Plotten als Punkte
plt.plot(points[0],points[1],'bo')
# Plotten des Polygons
plt.fill(points[0],points[1],facecolor = (0,.2,1,.7))
# Einrichten des Plots
plt.axis('equal') # gleiche Skalierung x,y
plt.grid('both') # Gitterlinien
```
%% Output
%% Cell type:markdown id: tags:
**Definition der finalen Abbildungsmatrix** $A$
%% Cell type:code id: tags:
``` python
S=[[-1,0],[0,1]] # Spiegelung
M=[[4,0],[0,.5]] # Skalierung
R= math.sqrt(2)/2*np.array([[1,1],[-1,1]]) # Drehung
A = S
#A=np.matmul(M,S)
```
%% Cell type:markdown id: tags:
**Anwenden der Abbilungsmatrix**, d.h. für jeden Ortsvektor $\vec v$ wird $$\vec v \mapsto A \cdot \vec v$$ ausgeführt.
%% Cell type:code id: tags:
``` python
# transformierten Punkte
pointsTransformed = np.matmul(A,points)
plt.plot(pointsTransformed[0],pointsTransformed[1],'yo')
plt.fill(pointsTransformed[0],pointsTransformed[1],facecolor = (1,.7,0,.7))
# zum Verleich nochmal die ursprünglichen Punkte
plt.plot(points[0],points[1],'bo')
# Plotten des Polygons
plt.fill(points[0],points[1],facecolor = (0,.2,1,.7))
# Einrichten des Plots
plt.axis('equal') # gleiche Skalierung x,y
plt.grid('both') # Gitterlinien
```
%% Output
%% Cell type:markdown id: tags:
Durch Hinzufügen einer Translation $\vec t$ wird die lineare Abbildung zu einer **affinen Abbildung**
$$
\vec v \mapsto A\cdot \vec v + \vec t
$$
%% Cell type:code id: tags:
``` python
t=np.transpose([[5,2]])
pointsAffine = pointsTransformed + t #elementweise Addition des Vektors t
plt.fill(pointsAffine[0],pointsAffine[1], facecolor = (1,0,.5,.5))
### die alten Figuren
pointsTransformed = np.matmul(A,points)
plt.plot(pointsTransformed[0],pointsTransformed[1],'yo')
plt.fill(pointsTransformed[0],pointsTransformed[1],facecolor = (1,.7,0,.7))
# zum Verleich nochmal die ursprünglichen Punkte
plt.plot(points[0],points[1],'bo')
# Plotten des Polygons
plt.fill(points[0],points[1],facecolor = (0,.2,1,.7))
# Einrichten des Plots
plt.axis('equal') # gleiche Skalierung x,y
plt.grid('both') # Gitterlinien
```
%% Output
%% 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