Erste Grafik, Versuch eines Skripts, etc...

This commit is contained in:
2020-11-07 21:22:50 +01:00
parent 403d24706f
commit 4b96667b18
7 changed files with 64 additions and 4 deletions

View File

@@ -0,0 +1,16 @@
Linear Algebra Refresher
Addition von Vektoren
$\left[ {\begin{array}{*{20}{c}}
1\\
2
\end{array}} \right] + \left[ {\begin{array}{*{20}{c}}
3\\
1
\end{array}} \right] = \left[ {\begin{array}{*{20}{c}}
4\\
3
\end{array}} \right]$
<img src="vektor_add.png" style="zoom:50%;" />

5
convert_pdf_to_png.sh Normal file
View File

@@ -0,0 +1,5 @@
!#/bin/bash
pdfcrop $1 $2
convert --density 300 $2

View File

@@ -11,10 +11,10 @@ class Vector(object):
self.dimension = len(coordinates) self.dimension = len(coordinates)
except ValueError: except ValueError:
raise ValueError('Die Koordinaten dürfen nicht leer sein') raise ValueError('Die Koordinaten d<EFBFBD>rfen nicht leer sein')
except TypeError: except TypeError:
raise TypeError('Die Koordinaten müssen iterierbar sein') raise TypeError('Die Koordinaten m<EFBFBD>ssen iterierbar sein')
def __str__(self): def __str__(self):
@@ -43,7 +43,7 @@ class Vector(object):
return Vector(new_coordinates) return Vector(new_coordinates)
def magnitude(self): def magnitude(self):
#Länge #L<EFBFBD>nge
coordinates_squared = [x**2 for x in self.coordinates] coordinates_squared = [x**2 for x in self.coordinates]
#pdb.set_trace() #pdb.set_trace()
return sqrt(sum(coordinates_squared)) return sqrt(sum(coordinates_squared))
@@ -72,7 +72,7 @@ print (vektor_2.minus(vektor_3))
print (vektor_3.times_scalar(3)) print (vektor_3.times_scalar(3))
print ("Magnitude -- Länge ", vektor_3.magnitude()) print ("Magnitude -- L<EFBFBD>nge ", vektor_3.magnitude())
print ("Normalisieren ", vektor_2.normalized()) print ("Normalisieren ", vektor_2.normalized())

BIN
vektor_add.pdf Normal file

Binary file not shown.

BIN
vektor_add.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
vektor_addition.pdf Normal file

Binary file not shown.

39
vektor_addition.tex Normal file
View File

@@ -0,0 +1,39 @@
\documentclass[10pt]{article}
\usepackage{pgf,tikz,pgfplots}
\pgfplotsset{compat=1.15}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}[x=1cm,y=1cm]
\begin{axis}[
x=1cm,y=1cm,
axis lines=middle,
ymajorgrids=true,
xmajorgrids=true,
xmin=-0.5,
xmax=7.5,
ymin=-1,
ymax=2.5,
xtick={0,...,7},
ytick={0,...,3},]
\clip(-0.5327923283402358,-3.438438462661708) rectangle (7.550357053950259,3.4379509853468746);
\draw [-latex,line width=1pt] (0,0) -- (5,0);
\draw [-latex,line width=1pt] (0,0) -- (2,2);
\draw [-latex,line width=1pt,color=red, dashed] (2,2) -- (7,2);
\draw [-latex,line width=1pt,color=red, dashed] (5,0) -- (7,2);
\draw [-latex,line width=1pt,color=blue] (0,0) -- (7,2);
\begin{scriptsize}
\draw[color=black] (2.55908371629915,-0.25) node {$\vec{y}$};
\draw[color=black] (0.8,1.1993756042973518) node {$\vec{x}$};
\draw[color=red] (4.315669182768639,2.3) node {$\vec{y}$};
\draw[color=red] (6.45,1.142250873680458) node {$\vec{x}$};
\draw[color=blue] (3.1,1.220797378278687) node {$\vec{x+y}$};
\end{scriptsize}
\end{axis}
\end{tikzpicture}
\end{document}