% (find-angg "LATEX/2015-1-C2-figuras1.tex")
% (find-angg "LATEX/2015-1-C2-figuras1.lua")
% (defun c () (interactive) (find-LATEXsh "lualatex 2015-1-C2-figuras1.tex"))
% (defun c () (interactive) (find-LATEXsh "lualatex --output-format=dvi 2015-1-C2-figuras1.tex"))
% (defun d () (interactive) (find-xpdfpage "~/LATEX/2015-1-C2-figuras1.pdf"))
% (defun d () (interactive) (find-xdvipage "~/LATEX/2015-1-C2-figuras1.dvi"))
% (defun e () (interactive) (find-LATEX "2015-1-C2-figuras1.tex"))
% (defun l () (interactive) (find-LATEX "2015-1-C2-figuras1.lua"))
% (find-xpdfpage "~/LATEX/2015-1-C2-figuras1.pdf")
% (find-xdvipage "~/LATEX/2015-1-C2-figuras1.pdf")
\documentclass[oneside]{book}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{tikz}
\usepackage{luacode}
\usepackage{edrx15}
\begin{document}

\directlua{dofile "\jobname.lua"}

% (find-LATEX "2014-1-GA-P2-gab.tex")
% (find-LATEX "2014-1-GA-P2-gab.lua")





\def\luaexpr#1{\directlua{tex.print(#1)}}
\def\uv(#1,#2){\luaexpr {pcomma(xyfromuv(#1, #2))}}

\tikzset{axis/.style=very thick}
\tikzset{tick/.style=thick}
\tikzset{grid/.style=gray!20,very thin}
\tikzset{newaxis/.style=gray!30,thin}
\tikzset{level/.style=gray}

\def\axesandticks{
  \draw[axis] (-10,0) -- (10,0);
  \draw[axis] (0,-10) -- (0,10);
  \foreach \x in {-10,...,10} \draw[tick] (\x,-0.2) -- (\x,0.2);
  \foreach \y in {-10,...,10} \draw[tick] (-0.2,\y) -- (0.2,\y);
}
\def\mygrid(#1,#2) (#3,#4){
  \clip              (#1-0.4, #2-0.4) rectangle (#3+0.4, #4+0.4);
  \draw[step=1,grid] (#1-0.2, #2-0.2) grid      (#3+0.2, #4+0.2);
  \axesandticks;
}
\def\levelcurvesU{
  \draw[newaxis] \uv(-4,-1) -- \uv( 4,-1);
  \draw[newaxis] \uv(-4, 0) -- \uv( 4, 0);
  \draw[newaxis] \uv(-4, 1) -- \uv( 4, 1);
}
\def\levelcurvesV{
  \draw[newaxis] \uv(-1,-4) -- \uv(-1, 4);
  \draw[newaxis] \uv( 0,-4) -- \uv( 0, 4);
  \draw[newaxis] \uv( 1,-4) -- \uv( 1, 4);
}
\def\levelcurvesUV{
  \levelcurvesU;
  \levelcurvesV;
}




%   ___                  _                _ 
%  / _ \ _   _  ___  ___| |_ __ _  ___   / |
% | | | | | | |/ _ \/ __| __/ _` |/ _ \  | |
% | |_| | |_| |  __/\__ \ || (_| | (_) | | |
%  \__\_\\__,_|\___||___/\__\__,_|\___/  |_|
%                                           
% (find-xpdfpage "~/LATEX/2014-1-GA-P2.pdf")
% (find-LATEX "2014-1-GA-P2-gab.lua")

1a)
\begin{tikzpicture}[scale=0.25]
  \mygrid (-2,-2) (2,6);
  \draw[level] \luaexpr{ seqpath(-2, 2, 0.1, L"t  t,t*t-1") };
  \draw[level] \luaexpr{ seqpath(-2, 2, 0.1, L"t  t,t*t  ") };
  \draw[level] \luaexpr{ seqpath(-2, 2, 0.1, L"t  t,t*t+1") };
\end{tikzpicture}
%
\quad
1b)
%
\begin{tikzpicture}[scale=0.25]
  \mygrid (-4,-4) (4,4);
  \draw[level] \luaexpr{ seqpath(0,   6.3, 0.1, L"t  cos(t),sin(t)") };
  \draw[level] \luaexpr{ seqpath(0,   6.3, 0.1, L"t  2*cos(t),2*sin(t)") };
  \draw[level] \luaexpr{ seqpath(0,   6.3, 0.1, L"t  3*cos(t),3*sin(t)") };
\end{tikzpicture}
%
\quad
1c)
%
\begin{tikzpicture}[scale=0.25]
  \mygrid (-4,-4) (4,4);
  \draw[level] \luaexpr{ seqpath(0.1,    4, 0.1, L"t  t,1/t") };
  \draw[level] \luaexpr{ seqpath( -4, -0.1, 0.1, L"t  t,1/t") };
  \draw[level] \luaexpr{ seqpath(0.1,    4, 0.1, L"t  t,2/t") };
  \draw[level] \luaexpr{ seqpath( -4, -0.1, 0.1, L"t  t,2/t") };
  \draw[level] \luaexpr{ seqpath(0.1,    4, 0.1, L"t  t,-3/t") };
  \draw[level] \luaexpr{ seqpath( -4, -0.1, 0.1, L"t  t,-3/t") };
\end{tikzpicture}



1d)
\begin{tikzpicture}[scale=0.25]
  \mygrid (-4,-2) (4,6);
  \draw[level] \uv(-4,-1) -- \uv( 4,-1);
  \draw[level] \uv(-4, 0) -- \uv( 4, 0);
  \draw[level] \uv(-4, 1) -- \uv( 4, 1);
\end{tikzpicture}
%
\quad
1e)
%
\begin{tikzpicture}[scale=0.25]
  \mygrid (-4,-2) (4,6);
  \draw[level] \uv(-1,-4) -- \uv(-1, 4);
  \draw[level] \uv( 0,-4) -- \uv( 0, 4);
  \draw[level] \uv( 1,-4) -- \uv( 1, 4);
\end{tikzpicture}

1f)
\begin{tikzpicture}[scale=0.25]
  \mygrid (-4,-2) (4,6);
  \levelcurvesUV;
  \draw[level] \luaexpr{ seqpath(-2, 2, 0.1, xyfromp) };
\end{tikzpicture}
%
\quad
1g)
\begin{tikzpicture}[scale=0.25]
  \mygrid (-4,-2) (4,6);
  \levelcurvesUV;
  \draw[level] \luaexpr{ seqpath(0, 6.2, 0.1, xyfrome) };
\end{tikzpicture}
%
\quad
1h)
\begin{tikzpicture}[scale=0.25]
  \mygrid (-4,-2) (4,6);
  \levelcurvesUV;
  \draw[level] \luaexpr{ seqpath( -4, -0.1, 0.1, xyfromh) };
  \draw[level] \luaexpr{ seqpath(0.1,    4, 0.1, xyfromh) };
\end{tikzpicture}





%   ___                  _                ____  
%  / _ \ _   _  ___  ___| |_ __ _  ___   |___ \ 
% | | | | | | |/ _ \/ __| __/ _` |/ _ \    __) |
% | |_| | |_| |  __/\__ \ || (_| | (_) |  / __/ 
%  \__\_\\__,_|\___||___/\__\__,_|\___/  |_____|
%                                               

\def\nip{\par\noindent}
\def\uu{{\vec u}}
\def\vv{{\vec v}}
\def\ww{{\vec w}}
\def\Vec#1{\overrightarrow{#1}}
\def\VEC#1{{\overrightarrow{(#1)}}}
\def\Pr{{\text{Pr}}}
\def\Pru{\Pr_\uu}
\def\Prv{\Pr_\vv}
\def\Prw{\Pr_\ww}

\def\smpyr#1#2#3#4#5#6{
  \begin{smallmatrix}
  #1 \\
  #2 & #3 \\
  #4 & #5 & #6 \\
  \end{smallmatrix}
}
\def\apyr#1#2#3#4#5#6{
  \begin{array}{|r|r|r|}
  \hline
  #1 & & \\ \hline
  #2 & #3 & \\ \hline
  #4 & #5 & #6 \\ \hline
  \end{array}
}

\def\Pyr{\apyr}
\def\sizepyr#1#2#3#4#5#6#7{{\text{#1 \apyr{#2}{#3}{#4}{#5}{#6}{#7}}}}
\def\pyr#1#2#3#4#5#6{{\text{\small \apyr{#1}{#2}{#3}{#4}{#5}{#6}}}}
\def\pyr#1#2#3#4#5#6{\smpyr{#1}{#2}{#3}{#4}{#5}{#6}}
\def\pyr#1#2#3#4#5#6{\left[\smpyr{#1}{#2}{#3}{#4}{#5}{#6}\right]}
\def\hpyr#1#2#3{\pyr{#1}0{#2}00{#3}}

\def\qpyrd#1) #2#3#4#5#6#7 -> #8{%
  2a#1) $\pyr{#2}{#3}{#4}{#5}{#6}{#7} \Rightarrow #8$%
}


% matrix 2x2 x matrix 2x1 = matriz 2x1
% matrix 2x3 x matrix 3x4 = matriz 2x1

$\sm{a&b \\ c&d}$

$\psm{a&b \\ c&d}$

$\psm{a&c&e \\ b&d&f}$



\begin{tikzpicture}
  [place/.style={circle,draw=blue!50,fill=blue!20,thick,
                  inner sep=0pt,minimum size=6mm},
   transition/.style={rectangle,draw=black!50,fill=black!20,thick,
                       inner sep=0pt,minimum size=4mm}]
  \node at ( 0,2) [place] {};
  \node at ( 0,1) [place] {};
  \node at ( 0,0) [place] {};
  \node at ( 1,1) [transition] {};
  \node at (-1,1) [transition] {};
\end{tikzpicture}

\begin{tikzpicture}
  [opdot/.style={circle,draw=black,fill=white,
                 inner sep=0pt,minimum size=1mm},
   cldot/.style={circle,draw=black,fill=black,thick,
                 inner sep=0pt,minimum size=1mm}]
  \node at ( 0,2) [opdot] {};
  \node at ( 0,1) [opdot] {};
  \node at ( 0,0) [opdot] {};
  \node at ( 1,1) [cldot] {};
  \node at (-1,1) [cldot] {};
\end{tikzpicture}





\tikzset{opdot/.style={circle,inner sep=0pt,minimum size=1mm,
                       draw=black,fill=white}}
\tikzset{cldot/.style={circle,inner sep=0pt,minimum size=1mm,
                       draw=black,fill=black,thick}}

\begin{tikzpicture}
  \node at ( 0,2) [opdot] {};
  \node at ( 0,1) [opdot] {};
  \node at ( 0,0) [opdot] {};
  \node at ( 1,1) [cldot] {};
  \node at (-1,1) [cldot] {};
\end{tikzpicture}


\end{document}

