% (find-angg "LATEX/2014-1-GA-P2-gab.tex")
% (find-angg "LATEX/2014-1-GA-P2.tex")
% (defun c () (interactive) (find-LATEXsh "lualatex 2014-1-GA-P2-gab.tex"))
% (defun d () (interactive) (find-xpdfpage "~/LATEX/2014-1-GA-P2-gab.pdf"))
% (defun e () (interactive) (find-LATEX "2014-1-GA-P2-gab.tex"))
% (defun l () (interactive) (find-LATEX "2014-1-GA-P2-gab.lua"))
% (find-xpdfpage "~/LATEX/2014-1-GA-P2.pdf")
% (find-xpdfpage "~/LATEX/2014-1-GA-P2-gab.pdf")
% (find-LATEXfile "" "2014-1-GA-P2-gab.pdf")
% (find-twusfile  "LATEX/" "2014-1-GA-P2-gab")
% http://angg.twu.net/LATEX/2014-1-GA-P2-gab.pdf
\documentclass[oneside]{book}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{tikz}
\usepackage{luacode}
\begin{document}

\def\bsk{\bigskip}
\def\msk{\medskip}
\def\ssk{\smallskip}

% (find-es "tikz" "luacode")
% (find-es "luatex" "luacode")

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

{\setlength{\parindent}{0em}
\par Geometria Anal\'\i tica - Segunda Prova (P2)
\par PURO-UFF - 2014.2
\par 4/jun/2014 - Turma A
\par Prof: Eduardo Ochs
}

% \begin{luacode*}
% \end{luacode*}
% (find-LATEX "2014-1-GA-P2-gab.lua")
\directlua{
  dofile "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$%
}

\bsk

% 2a)
\qpyrd a) 0  1 0  0 0 {-1} -> 0,
\qpyrd b) 1  0 0  0 0 1    -> {-4},
\qpyrd c) 0  0 1  {-1} 0 0    -> {1},

\qpyrd d) 0  {1/2} 0   {-1}  {1/4} 0    -> 0,
\qpyrd e) 0  {1/2} 0   {-1} {-1/4} 0    -> 0,

$U(x,y) \cdot U(x,y) = \pyr 0  {1/2} 0   {-1}  {1/4} 0 \cdot 
                       \pyr 0  {1/2} 0   {-1}  {1/4} 0
                     = \pyr {1/4}  {-1} {1/4}   {1} {-1/2} {1/16}$,

$U(x,y) \cdot V(x,y) = \pyr 0  {1/2} 0   {-1}  {1/4} 0 \cdot 
                       \pyr 0  {1/2} 0   {-1} {-1/4} 0
                     = \pyr {1/4}  {-1} 0   {1} 0 {-1/16}$,

$V(x,y) \cdot V(x,y) = \pyr 0  {1/2} 0   {-1} {-1/4} 0 \cdot 
                       \pyr 0  {1/2} 0   {-1} {-1/4} 0
                     = \pyr {1/4}  {-1} {-1/4}   {1} {1/2} {1/16}$,

\qpyrd f) {-1/4}  {3/2} {-1/4}   {-2} {1/4} {-1/16}    -> 0,
\qpyrd g) {1/2}  {-2} 0   {2} {0} {1/8}    -> -1/4,

\qpyrd h) {1/4}  {-1} 0   {1} 0 {-1/16}    -> 1/16.

\msk

2b)


{\def\P{\hpyr 1 1 {-6}}

\nip 2c) $(1/2,1) \in \P$, $(-1/3,1) \in \P$












\end{document}


 (eepitch-sympy)
 (eepitch-kill)
 (eepitch-sympy)

 (eepitch-isympy)
 (eepitch-kill)
 (eepitch-isympy)
U = x/4 + y/2 - 1
V = -x/4 + y/2 - 1
expand(U*U)
expand(U*V)
expand(V*V)
expand(V-U*U)
expand(U*U+V*V)

def P(x, y):
  return y*y + x*y -6*x*x

P(x, 1)
P(1/2, 1)
P(-1/2, 1)
P(-1/3, 1)
P(1/3, 1)

P(1, y)
P(1, 2)
P(1, -3)



P(x, 1).solve(x)





% Local Variables:
% coding:           raw-text-unix
% ee-anchor-format: "«%s»"
% End:

