Geen omschrijving
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

matheMakrosFunctions.tex 9.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. %%
  2. %% Mathe Makros (auch außerhalb der BMS)
  3. %% 2025_05_30
  4. %% Autor: philipp.freimann@bms-w.c0
  5. %%
  6. %% Graphiken mit tikz und BMS-W Mathe-Makros
  7. %%
  8. \tikzset{bbwgrid/.style={help lines,color=bbwMMFarbe!25,thick,step=0.5cm}}
  9. %% einfach die folgende Zeile neu definieren bei kleineren Graphen und
  10. %% scale auf z. B. 0.5 setzen
  11. \tikzset{graphSkalierung/.style={xscale=1,yscale=1}}
  12. %% Koordinatensystem ohne Zahlen
  13. \newcommand{\bbwGridPartLeer}[4]{
  14. % grid:
  15. \draw[bbwgrid,graphSkalierung] (#1,#3) grid (#2,#4);
  16. % axes
  17. \draw[thick,graphSkalierung] (#1,0) -- (#2,0);
  18. \draw[thick,graphSkalierung] (0,#3) -- (0,#4);
  19. \foreach \x in {#1, ..., -1} \draw[graphSkalierung] (\x cm, 3pt) -- (\x cm, -3pt);%% node[anchor=north]{$\x$};
  20. \foreach \x in {1, ..., #2} \draw[graphSkalierung] (\x cm, 3pt) -- (\x cm, -3pt);%% node[anchor=north]{$\x$};
  21. \foreach \y in {#3, ..., -1} \draw[graphSkalierung] (-3pt, \y cm) -- (3pt, \y cm);%% node[anchor=east]{$\y\,\,$};
  22. \foreach \y in {1, ..., #4} \draw[graphSkalierung] (-3pt, \y cm) -- (3pt, \y cm);%% node[anchor=east]{$\y\,\,$};
  23. \draw[->,thick,graphSkalierung] (#2,0) -- ({#2+0.5},0) node[anchor=west]{$x$};
  24. \draw[->,thick,graphSkalierung] (0,#4) -- (0,{#4+0.5}) node[anchor=south]{$y$};
  25. }
  26. \newcommand{\bbwGridPart}[4]{
  27. % grid:
  28. \draw[bbwgrid,graphSkalierung] (#1,#3) grid (#2,#4);
  29. % axes
  30. \draw[thick,graphSkalierung] (#1,0) -- (#2,0);
  31. \draw[thick,graphSkalierung] (0,#3) -- (0,#4);
  32. \foreach \x in {#1, ..., -1} \draw[graphSkalierung] (\x cm, 3pt) -- (\x cm, -3pt) node[anchor=north,graphSkalierung]{\small $\x\,\,\,$};
  33. \foreach \x in {1, ..., #2} \draw[graphSkalierung] (\x cm, 3pt) -- (\x cm, -3pt) node[anchor=north,graphSkalierung]{$\x$};
  34. \foreach \y in {#3, ..., -1} \draw[graphSkalierung] (-3pt, \y cm) -- (3pt, \y cm) node[anchor=east,graphSkalierung]{\small $\y\,\,$};
  35. \foreach \y in {1, ..., #4} \draw[graphSkalierung] (-3pt, \y cm) -- (3pt, \y cm) node[anchor=east,graphSkalierung]{$\y\,\,$};
  36. \draw[->,thick,graphSkalierung] (#2,0) -- ({#2+0.5},0) node[anchor=west]{$x$};
  37. \draw[->,thick,graphSkalierung] (0,#4) -- (0,{#4+0.5}) node[anchor=south]{$y$};
  38. }
  39. %% A function within a Grid (without painting the grid)
  40. %% #1: funciton eg 2*\x (x has to be backquoted)
  41. %% #2: Domain eg. -1:2.5
  42. %% #3: colour eg red
  43. \newcommand{\bbwFuncC}[3]{\draw[domain=#2,smooth,samples=200,variable=\x,#3] plot ({\x},{#1});
  44. }
  45. %% A function within a Grid (without painting the grid)
  46. \newcommand{\bbwFunc}[2]{\bbwFuncC{#1}{#2}{blue}}
  47. %% Declare a function-plot
  48. %% xmin,xmax,ymin,ymax,fct,domain(x-min, x-max)
  49. %% example: \bbwFunction{-4}{3}{-2}{5}{-\x*\x- \x + 4.5}{-3:2}
  50. \newcommand{\bbwFunction}[6]{\begin{tikzpicture}
  51. \bbwGridPart{#1}{#2}{#3}{#4}
  52. \bbwFunc{#5}{#6}
  53. %% \draw[domain=#6,smooth,samples=200,variable=\x,blue] plot ({\x},{#5});
  54. \end{tikzpicture}}
  55. %% a whole graph having a coordinate-system #1-#4 and any tizpicture content #5:
  56. \newcommand{\bbwGraph}[5]{\begin{tikzpicture}\bbwGridPart{#1}{#2}{#3}{#4}#5\end{tikzpicture}}
  57. \newcommand{\bbwGraphLeer}[5]{\begin{tikzpicture}\bbwGridPartLeer{#1}{#2}{#3}{#4}#5\end{tikzpicture}}
  58. %% Dots and lines:
  59. %% Dot example: \bbwDot{-1,2}{red}{east}{A}
  60. \newcommand{\bbwDot}[4]{\filldraw[color=#2!60, fill=#2!5, thick](#1) circle(0.05) node[anchor=#3]{$#4$};}
  61. %% Line example: \bbwLine{-1,0}{2,3}{red}
  62. \newcommand{\bbwLine}[3]{\draw[thick,color=#3] (#1)--(#2);}
  63. \newcommand{\bbwArrow}[3]{\draw[thick,color=#3,->] (#1)--(#2);}
  64. %% Strecke mit zwei Endpunkten
  65. %% #1, #2: Koordinaten der Endpunkte
  66. %% #3: Ort der Beschriftung
  67. %% #4: Beschtiftung (z. B. "a)")
  68. %% #5: farbe der Strecke und der Beschriftung
  69. \newcommand{\bbwStrecke}[5]{%%
  70. \bbwLine{#1}{#2}{#5}%
  71. \bbwDot{#1}{#5}{west}{}%
  72. \bbwDot{#2}{#5}{west}{}%
  73. \draw (#3) node{{\color{#5}#4}};
  74. }%%
  75. %% Draw a single letter or small text
  76. % #1: Position eg 4,4
  77. % #2: letter eg f or blah
  78. % #3: colour
  79. \newcommand{\bbwLetter}[3]{\draw[color=#3](#1) node{$#2$};}
  80. %%% ABC-Formel
  81. %% usage \abcd{<a>}{<b>}{<c>}
  82. %% example usage: \abcd{b}{5}{\sqrt{4}}
  83. \newcommand{\abcd}[3]{$\frac{-(#2)\pm\sqrt{(#2)^2 - 4\cdot{}(#1)\cdot{}(#3)}}{2\cdot{}(#1)}$}
  84. %% coordSysBBWFlex
  85. %% Flexibles Koordinatensystem mit Pfeilen und Pfeilbeschriftung, aber
  86. %% noch ohne "ticks".
  87. %% #1 : Rastergröße
  88. %% #2-#5: Größe des Rasters in cm
  89. %% #6 : Beschriftung in x-Richtung (in y-Richtung ist es immer y
  90. %% #7 : Zu zeichnende Funktion
  91. %% #8 : Ticks oder was sonst noch komplexeres in die Grafik muss
  92. \newcommand{\bbwFunctionColour}{blue}
  93. \newcommand{\coordSysBBWFlex}[8]{
  94. \begin{tikzpicture}
  95. \draw[step = #1, thin, cyan!20] (#2, #4) grid (#3, #5);
  96. \draw[thick, ->] (#2,0) -- (#3,0) node[anchor = west] {$#6$};
  97. \draw[thick, ->] (0,#4) -- (0,#5) node[anchor = south] {$y$};
  98. \draw[domain=#2:#3,smooth,samples=200,variable=\x,\bbwFunctionColour] plot ({\x},{#7});
  99. #8;
  100. \end{tikzpicture}
  101. \renewcommand{\bbwFunctionColour}{blue}
  102. }%% end coordSysBBW
  103. \newcommand{\einheitskreis}{
  104. \definecolor{qqwuqq}{rgb}{0,0.79,0}
  105. \definecolor{qqqqff}{rgb}{0,0,1}
  106. \definecolor{qqzzzz}{rgb}{0,0.6,0.6}
  107. \definecolor{ffwwqq}{rgb}{1,0.4,0}
  108. \definecolor{qqccww}{rgb}{0,0.8,0.4}
  109. \definecolor{uququq}{rgb}{0.25,0.25,0.25}
  110. \definecolor{xdxdff}{rgb}{0.49,0.49,1}
  111. \begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=2.5cm,y=2.5cm]
  112. \draw[->,color=black] (-1.5,0) -- (1.5,0);
  113. \foreach \x in {-1.5,-1,-0.5,0.5,1}
  114. \draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $\x$};
  115. \draw[->,color=black] (0,-1.5) -- (0,1.5);
  116. \foreach \y in {-1.5,-1,-0.5,0.5,1}
  117. \draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize $\y$};
  118. \draw[color=black] (0pt,-10pt) node[right] {\footnotesize $0$};
  119. \clip(-1.5,-1.5) rectangle (1.5,1.5);
  120. \draw [shift={(0,0)},color=qqwuqq,fill=qqwuqq,fill opacity=0.1] (0,0) -- (0:0.28) arc (0:46.14:0.28) -- cycle;
  121. \draw(0,0) circle (2.5cm);
  122. \draw [domain=-1.5:1.5] plot(\x,{(-0-0.72*\x)/-0.69});
  123. \draw (0.69,-1.5) -- (0.69,1.5);
  124. \draw (1,-1.5) -- (1,1.5);
  125. \draw (1.12,0.6) node[anchor=north west,color=qqccww] {t};
  126. \draw (0.50,0.42) node[anchor=north west,color=ffwwqq] {s};
  127. \draw (0.30,0.21) node[anchor=north west,color=qqzzzz] {c};
  128. \draw [line width=1.2pt,color=qqccww] (1,1.04)-- (1,0);
  129. \draw [line width=1.2pt,color=ffwwqq] (0.69,0.72)-- (0.69,0);
  130. \draw [line width=1.6pt,color=qqzzzz] (0.69,0)-- (0,0);
  131. \begin{scriptsize}
  132. \fill [color=xdxdff] (0.69,0.72) circle (1.5pt);
  133. \draw[color=xdxdff] (0.49,0.71) node {$P$};
  134. \fill [color=uququq] (0.69,0) circle (1.5pt);
  135. \draw[color=uququq] (0.8,0.12) node {$Xp$};
  136. %%\fill [color=uququq] (1,1.04) circle (1.5pt);
  137. %%\draw[color=uququq] (1.22,0.95) node {$Yp$};
  138. \fill [color=uququq] (0.69,0.72) circle (1.5pt);
  139. \draw[color=uququq] (0.82,0.7) node {$Yp$};
  140. \fill [color=qqqqff] (0,0) circle (1.5pt);
  141. \draw(0.20,0.09) node {$\varphi$};
  142. \end{scriptsize}
  143. \end{tikzpicture}\par
  144. }%% END Command \einheitskreis
  145. \newcommand{\einheitskreisT}{%% Tangens
  146. \definecolor{qqwuqq}{rgb}{0,0.79,0}
  147. \definecolor{qqqqff}{rgb}{0,0,1}
  148. \definecolor{qqzzzz}{rgb}{0,0.6,0.6}
  149. \definecolor{ffwwqq}{rgb}{1,0.4,0}
  150. \definecolor{qqccww}{rgb}{0,0.8,0.4}
  151. \definecolor{uququq}{rgb}{0.25,0.25,0.25}
  152. \definecolor{xdxdff}{rgb}{0.49,0.49,1}
  153. \begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=2.5cm,y=2.5cm]
  154. \draw[->,color=black] (-1.5,0) -- (1.5,0);
  155. \foreach \x in {-1.5,-1,-0.5,0.5,1}
  156. \draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $\x$};
  157. \draw[->,color=black] (0,-1.5) -- (0,1.5);
  158. \foreach \y in {-1.5,-1,-0.5,0.5,1}
  159. \draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize $\y$};
  160. \draw[color=black] (0pt,-10pt) node[right] {\footnotesize $0$};
  161. \clip(-1.5,-1.5) rectangle (1.5,1.5);
  162. \draw [shift={(0,0)},color=qqwuqq,fill=qqwuqq,fill opacity=0.1] (0,0) -- (0:0.28) arc (0:46.14:0.28) -- cycle;
  163. \draw(0,0) circle (2.5cm);
  164. \draw [domain=-1.5:1.5] plot(\x,{(-0-0.72*\x)/-0.69});
  165. \draw (0.69,-1.5) -- (0.69,1.5);
  166. \draw (1,-1.5) -- (1,1.5);
  167. \draw (1.12,0.6) node[anchor=north west,color=qqccww] {t};
  168. \draw (0.50,0.42) node[anchor=north west,color=ffwwqq] {s};
  169. \draw (0.30,0.21) node[anchor=north west,color=qqzzzz] {c};
  170. \draw [line width=1.2pt,color=qqccww] (1,1.04)-- (1,0);
  171. \draw [line width=1.2pt,color=ffwwqq] (0.69,0.72)-- (0.69,0);
  172. \draw [line width=1.6pt,color=qqzzzz] (0.69,0)-- (0,0);
  173. \begin{scriptsize}
  174. \fill [color=xdxdff] (0.69,0.72) circle (1.5pt);
  175. \draw[color=xdxdff] (0.49,0.71) node {$P$};
  176. \fill [color=uququq] (0.69,0) circle (1.5pt);
  177. \draw[color=uququq] (0.8,0.12) node {$Xp$};
  178. %%\fill [color=uququq] (1,1.04) circle (1.5pt);
  179. %%\draw[color=uququq] (1.22,0.95) node {$Yp$};
  180. \fill [color=uququq] (0.69,0.72) circle (1.5pt);
  181. \draw[color=uququq] (0.82,0.7) node {$Yp$};
  182. \fill [color=qqqqff] (0,0) circle (1.5pt);
  183. %% Tangens
  184. \draw[color=uququq] (1.27,1) node {$T=(1|t)$};
  185. \fill [color=qqqqff] (1,1.05) circle (1.5pt);
  186. \draw(0.20,0.09) node {$\varphi$};
  187. \end{scriptsize}
  188. \end{tikzpicture}\par
  189. }%% END Command \einheitskreisT
  190. \newcommand{\miniEinheitskreis}{
  191. \tikzset{graphSkalierung/.style={xscale=2,yscale=2}}
  192. \bbwGraph{-1.5}{1.5}{-1.5}{1.5}{
  193. \bbwFuncC{ sqrt(4-\x*\x)}{-2:2}{lightgray}
  194. \bbwFuncC{-sqrt(4-\x*\x)}{-2:2}{lightgray}
  195. }
  196. \tikzset{graphSkalierung/.style={xscale=1,yscale=1}}
  197. }%% end newcommand miniEinheitskreis