\clearpage\newpage
 \section{Math constants and functions} % (fold)
 \label{sec:math_functions}

\bgroup
\catcode`_=12 
\small
\captionof{table}{Math constants and functions.}
\begin{tabular}{ll}
\toprule
\textbf{contants or functions} & \textbf{Comments}\\
\midrule
\Igfct{math}{tkzphi}     &  constant $\varphi  = (1+math.sqrt(5))/2 $\\
\Igfct{math}{tkzinvphi}   &  constant $1/\varphi  = 1/tkzphi$\\
\Igfct{math}{tkzsqrtphi}    &  constant $\sqrt{\varphi}= math.sqrt(tkzphi)$    \\
%round(num, idp)    &  \\
%tkzround( num, idp )   &   \\
% Cramer33(a1,a2,a3,b1,b2,b3,c1,c2,c3) &  \\
% Cramer22(a1,a2,b1,b2)  &   \\
\Igfct{math}{islinear (z1,z2,z3) }   & Are the points aligned? (z2-z1) $\parallel$ (z3-z1) ?  \\
\Igfct{math}{isortho (z1,z2,z3)} &  (z2-z1) $\perp$ (z3-z1)  ? boolean\\
\Igfct{package}{set\_lua\_to\_tex (list)}   & set\_lua\_to\_tex('a','n') defines |\a| and |\n|   \\
\Igfct{package}{tkzUseLua (variable)}   & |\textbackslash\tkzUseLua{a}| prints  the value of a\\
%parabola (a,b,c)   & to get   \\
\Igfct{math}{value (v) }     &  apply |scale * value |    \\
\Igfct{math}{real (v) }     &  apply  | value /scale |     \\
\Igfct{math}{angle\_normalize (a) }   &  to get a value between 0 and $2\pi$ \\
\Igfct{misc}{radical\_center (C1,C2,C3)} & see \ref{sub:radical_center}    \\
\Igfct{misc}{radical\_circle (C1,C2,C3)} & see \ref{sub:radical_circle}  \\
\Igfct{misc}{barycenter (\{z1,n1\},\{z2,n2\}, ...)} & barycenter of list of points  \\
\bottomrule
\end{tabular}
\egroup

\subsection{Harmonic division with tkzphi } % (fold)
\label{sub:harmonic_division_with_tkzphi}
\begin{tkzexample}[latex=0cm,small,code only]
\begin{tkzelements}
   scale =.5
   z.a = point: new(0,0)
   z.b = point: new(8,0)
   L.ab = line: new (z.a,z.b)
   z.m,z.n = L.ab: harmonic_both (tkzphi)
\end{tkzelements}
\begin{tikzpicture}
   \tkzGetNodes
   \tkzDrawLine[add= .2 and .2](a,n) 
   \tkzDrawPoints(a,b,n,m)
   \tkzLabelPoints(a,b,n,m)
\end{tikzpicture}
\end{tkzexample}


\begin{tkzelements}
   scale =.5
   z.a = point: new(0,0)
   z.b = point: new(8,0)
   L.ab = line: new (z.a,z.b)
   z.m,z.n = L.ab: harmonic_both (tkzphi)
\end{tkzelements}
\hspace*{\fill}
\begin{tikzpicture}
   \tkzGetNodes
   \tkzDrawLine[add= .2 and .2](a,n) 
   \tkzDrawPoints(a,b,n,m)
   \tkzLabelPoints(a,b,n,m)
\end{tikzpicture}
 \hspace*{\fill}
% subsection harmonic_division_with_tkzphi (end)

\subsection{Function islinear} % (fold)
\label{sub:function_islinear}
\begin{minipage}{0.5\textwidth}
\begin{tkzexample}[latex=0cm,small,code only]
\begin{tkzelements}
   z.a = point: new (1, 1)
   z.b = point: new (2, 2)
   z.c = point: new (4, 4)
   if islinear (z.a,z.b,z.c) then
       z.d = point: new (0, 0)
    else 
        z.d = point: new (-1, -1)
   end
\end{tkzelements}
\begin{tikzpicture}
    \tkzGetNodes
    \tkzDrawPoints(a,...,d)
    \tkzLabelPoints(a,...,d)
\end{tikzpicture}
\end{tkzexample}
\end{minipage}
\begin{minipage}{0.5\textwidth}
\begin{tkzelements}
   z.a = point: new (1, 1)
   z.b = point: new (2, 2)
   z.c = point: new (4, 4)
   if islinear (z.a,z.b,z.c) then
       z.d = point: new (0, 0)
    else 
        z.d = point: new (-1, -1)
   end
\end{tkzelements}
 \hspace*{\fill}
\begin{tikzpicture}
    \tkzGetNodes
    \tkzDrawPoints(a,...,d)
    \tkzLabelPoints(a,...,d)
\end{tikzpicture}
\hspace*{\fill}
\end{minipage}

% subsection function_islinear (end)

\subsection{Function  \tkzfname{value} }% (fold)
\label{sub:function_value}

value to apply scaling if necessary

If |scale = 1.2| with a = value(5) the actual value of |a| will be $5\times 1.2 = 6$.

% subsubsection function_value (end)

\subsubsection{Function  \tkzfname{real} }% (fold)
\label{ssub:function_real}

If |scale = 1.2| with a = 6 then real(a) = $6 / 1.2 = 5$ .

% subsection function_real (end)


\subsection{Transfer from lua to \TEX} % (fold)
\label{sub:transfer_from_lua_to_tex}
It's possible to transfer variable from Lua to \TEX{} with 
\Igfct{package}{\textbackslash{tkzUseLua}}.


\begin{minipage}{.5\textwidth}
   \begin{verbatim}
   \begin{tkzelements}
      z.A            = point : new (0 , 0)
      z.B            = point : new (4 , 3)
      z.C            = point : new (2 , 5)
      L.AB           = line : new (z.A,z.B)
      d              = L.AB : distance (z.C)
      l              = L.AB.length
      z.H            = L.AB : projection (z.C)
   \end{tkzelements}
   % possible here \tkzUseLua{L.AB.length}
   \begin{tikzpicture}
   \tkzGetNodes
   \tkzDrawLines(A,B C,H)
   \tkzDrawPoints(A,B,C,H)
   \tkzLabelPoints(A,B,C,H)
   \tkzLabelSegment[above left,draw](C,H){$CH = \tkzUseLua{d}$}
   \tkzLabelSegment[below left,draw](C,H){$AB = \tkzUseLua{l}$}
   \end{tikzpicture}
   \end{verbatim}
\end{minipage}
\begin{minipage}{.5\textwidth}
\begin{tkzelements}
   z.A            = point : new (0 , 0)
   z.B            = point : new (4 , 3)
   z.C            = point : new (2 , 5)
   L.AB           = line : new (z.A,z.B)
   d              = L.AB : distance (z.C)
   l              = L.AB.length
   z.H            = L.AB : projection (z.C)
\end{tkzelements}
\begin{tikzpicture}
\tkzGetNodes
\tkzDrawLines(A,B C,H)
\tkzDrawPoints(A,B,C,H)
\tkzLabelPoints(A,B,C,H)
\tkzLabelSegment[above left,draw](C,H){$CH = \tkzUseLua{d}$}
\tkzLabelSegment[below left,draw](C,H){$AB = \tkzUseLua{l}$}
\end{tikzpicture}
\end{minipage}
% subsection transfer_from_lua_to_tex (end)

\subsection{Normalized angles : Slope of lines (ab), (ac) and (ad)} % (fold)
\label{sub:normalized_angles}
\begin{tkzexample}[latex=0cm,small,code only]
\begin{tkzelements}
   z.a      = point: new(0, 0)
   z.b      = point: new(-3, -3)
   z.c      = point: new(0, 3)
   z.d      = point: new(2, -2)
   angle    = point.arg (z.b-z.a)
   tex.print('slope of (ab) : '..tostring(angle)..'\\\\')
   tex.print('slope normalized of (ab) : '..tostring(angle\_normalize(angle))..'\\\\')
   angle    = point.arg (z.c-z.a)
   tex.print('slope of (ac) : '..tostring(angle)..'\\\\')
   tex.print('slope normalized of (ac) : '..tostring(angle\_normalize(angle))..'\\\\')
   angle    = point.arg (z.d-z.a)
   tex.print('slope of (ad) : '..tostring(angle)..'\\\\')
   tex.print('slope normalized of (acd) : '..tostring(angle\_normalize(angle))..'\\\\')
\end{tkzelements}
\begin{tikzpicture}
   \tkzGetNodes
   \tkzDrawLines[red](a,b a,c a,d)
   \tkzDrawPoints(a,b,c,d)
   \tkzLabelPoints(a,b,c,d)
\end{tikzpicture}
\end{tkzexample}
\begin{tkzelements}
  scale = .75
z.a = point: new(0, 0)
z.b = point: new(-3, -3)
z.c = point: new(0, 3)
z.d = point: new(2, -2)
angle = point.arg (z.b-z.a)
tex.print('slope of (ab) : '..tostring(angle)..'\\\\')
tex.print('slope normalized of (ab) : '..tostring(angle_normalize(angle))..'\\\\')
angle = point.arg (z.c-z.a)
tex.print('slope of (ac) : '..tostring(angle)..'\\\\')
tex.print('slope normalized of (ac) : '..tostring(angle_normalize(angle))..'\\\\')
angle = point.arg (z.d-z.a)
tex.print('slope of (ad) : '..tostring(angle)..'\\\\')
tex.print('slope normalized of (ad) : '..tostring(angle_normalize(angle))..'\\\\')
\end{tkzelements}

  \hspace*{\fill}
\begin{tikzpicture}
   \tkzGetNodes
   \tkzDrawLines[red](a,b a,c a,d)
   \tkzDrawPoints(a,b,c,d)
   \tkzLabelPoints(a,b,c,d)
\end{tikzpicture}
 \hspace*{\fill}

% subsection normalized_angles (end)

\subsection{Get angle} % (fold)
\label{sub:get_angle}

The function  |get_angle (a,b,c)| gives the angle normalized of $(\overrightarrow{ab},\overrightarrow{ac})$.

\begin{minipage}{0.6\textwidth}
\begin{tkzexample}[latex=0cm,small,code only]
\begin{tkzelements}
   z.a   = point: new(0, 0)
   z.b   = point: new(-2, -2)
   z.c   = point: new(0, 3)
   angcb = tkzround ( get_angle (z.a,z.c,z.b),3)
   angbc = tkzround ( get_angle (z.a,z.b,z.c),3)
\end{tkzelements}

\begin{tikzpicture}
   \tkzGetNodes
   \tkzDrawLines[red](a,b a,c)
   \tkzDrawPoints(a,b,c)
   \tkzLabelPoints(a,b,c)
   \tkzMarkAngle[->](c,a,b)
   \tkzLabelAngle(c,a,b){\tkzUseLua{angcb}}
   \tkzMarkAngle[->](b,a,c)
   \tkzLabelAngle(b,a,c){\tkzUseLua{angbc}}
\end{tikzpicture}
\end{tkzexample}
\end{minipage}
\begin{minipage}{0.4\textwidth}
\begin{tkzelements}
   scale = 1.2
   z.a   = point: new(0, 0)
   z.b   = point: new(-2, -2)
   z.c   = point: new(0, 3)
   angcb = tkzround ( get_angle (z.a,z.c,z.b),3)
   angbc = tkzround ( get_angle (z.a,z.b,z.c),3)
\end{tkzelements}

\hspace*{\fill}
\begin{tikzpicture}
\tkzGetNodes
\tkzDrawLines[red](a,b a,c)
\tkzDrawPoints(a,b,c)
\tkzLabelPoints(a,b,c)
\tkzMarkAngle[->](c,a,b)
\tkzLabelAngle(c,a,b){\tkzUseLua{angcb}}
\tkzMarkAngle[->](b,a,c)
\tkzLabelAngle(b,a,c){\tkzUseLua{angbc}}
\end{tikzpicture}
\hspace*{\fill}
\end{minipage}

% subsection get_angle (end)

\subsection{Dot or scalar product} % (fold)
\label{sub:dot_or_scalar_product}

\begin{minipage}{0.5\textwidth}
\begin{tkzexample}[latex=0cm,small,code only]
\begin{tkzelements}
   z.A    = point: new(0,0)
   z.B    = point: new(5,0)
   z.C    = point: new(0,3)
   T.ABC  = triangle: new (z.A,z.B,z.C)
   z.A_1,
   z.B_1,
   z.C_1  = get_points (T.ABC: anti ())
   x  = dot_product (z.A,z.B,z.C)
\end{tkzelements}
\begin{tikzpicture}
   \tkzGetNodes
   \tkzDrawPolygon(A,B,C)
   \tkzDrawPoints(A,B,C,A_1,B_1,C_1)
   \tkzLabelPoints(A,B,C,A_1,B_1,C_1)
   \tkzDrawPolygon[blue](A_1,B_1,C_1)
   \tkzText[right](0,-1){dot product =\tkzUseLua{x}}
\end{tikzpicture}
\end{tkzexample}
\end{minipage}
\begin{minipage}{0.5\textwidth}
\begin{tkzelements}
 scale  = .6
 z.A    = point: new(0,0)
 z.B    = point: new(5,0)
 z.C    = point: new(0,3)
 T.ABC  = triangle: new (z.A,z.B,z.C)
 z.A_1,
 z.B_1,
 z.C_1  = get_points (T.ABC: anti ())
 x  = dot_product (z.A,z.B,z.C)
\end{tkzelements}
\hspace*{\fill}
\begin{tikzpicture}
   \tkzGetNodes
   \tkzDrawPolygon(A,B,C)
   \tkzDrawPoints(A,B,C,A_1,B_1,C_1)
   \tkzLabelPoints(A,B,C,A_1,B_1,C_1)
   \tkzDrawPolygon[blue](A_1,B_1,C_1)
   \tkzText[right](0,-1){dot product =\tkzUseLua{x}}
   \end{tikzpicture}
\hspace*{\fill}
\end{minipage}

The scalar product of the vectors $\overrightarrow{AC}$ and $\overrightarrow{AB}$ is equal to $\tkzUseLua{x}$, so these vectors are orthogonal.
% subsection dot_or_scalar_product (end)

\subsection{Alignment or orthogonality} % (fold)
\label{sub:alignment_or_orthogonality}

With the functions |islinear| and |isortho|. |islinear(z.a,z.b,z.c)| gives |true| idf the points $a$, $b$ and $c$ are aligned.

|isortho(z.a,z.b,z.c)| gives |true| if the line $(ab)$ is orthogonal to the line $(ac)$.
% subsection alignment_or_orthogonality (end)

\subsection{Other functions} % (fold)
\label{sub:other_functions}

Not documented because still in beta version: |parabola|, |Cramer22|, |Cramer33|.

% subsection other_functions (end)

% section math_functions (end)
% % section classes_and_objects (end)
\endinput




% \bgroup
% \catcode`_=12
% \begin{table}[H]
% \small
% \begin{center}
% \caption{functions\_polygons.lua }
% \begin{tabular}{lll}
% \toprule
% \textbf{Functions} & \textbf{Comments}\\
% \midrule
% function square (a,b)  \\
% function parallelogram (a,b,c) \\
% \bottomrule
% \end{tabular}
% \end{center}
% \end{table}
% \egroup


% \bgroup
% \catcode`_=12
% \begin{table}[H]
% \small
% \begin{center}
% \caption{elements\_vectors.lua    }
% \begin{tabular}{lll}
% \toprule
% \textbf{Methods} & \textbf{Comments}\\
% \midrule
% vector = {} class vector  \\
% \Imeth{vector}{function vector:  new (z1,z2)} &  st, ed   \\
% \Imeth{vector}{function vector: normalize  ()} &\\
% \bottomrule
% \end{tabular}
% \end{center}
% \end{table}
% \egroup




\endinput