emathグラフで2次関数の最大最小

これだけを書くのにすごく時間がかかったのでとりあえずメモ。解説は時間があるときに。

%------------------------------------------------------------------------
\item $a + 1 < 1$,すなわち $a < 0$ のとき\\
\unitlength=5mm
\begin{zahyou*}(0,8)(0,6)
% \def\Fx{0.15*(X-1)*(X-1)+1} %a
% \def\Fx{0.2*(X-3)*(X-3)+1} %b
% \def\Fx{0.4*(X-4)*(X-4)+1} %c
% \def\Fx{0.2*(X-5)*(X-5)+1} %d
% \def\Fx{0.15*(X-7)*(X-7)+1} %e
 \YGurafu(.2)(.05)\Fx\xmin{2}
 \YGurafu\Fx{2}{6}
 \YGurafu(.2)(.05)\Fx{6}\xmax
 \tenretu*{
%  aA(2,1.15);aAx(2,0);aAy(0,1.15);aB(1,1);aBx(1,0);aBy(0,1);aC(6,4.75);aCx(6,0);aCy(0,4.75);
%  bA(2,1.2);bAx(2,0);bAy(0,1.2); bB(3,1);bBx(3,0);bBy(0,1);bC(6,2.8);bCx(6,0);bCy(0,2.8);
%  cA(2,2.6);cAx(2,0);cAy(0,2.6); cB(4,1);cBx(4,0);cBy(0,1);cC(6,2.6);cCx(6,0);cCy(0,2.6);
%  dA(2,2.8);dAx(2,0);dAy(0,2.8);dB(5,1);dBx(5,0);dBy(0,1);dC(6,1.2);dCx(6,0);dCy(0,1.2);
%  eA(2,4.75);eAx(2,0);eAy(0,4.75);eB(7,1);eBx(7,0);eBy(0,1);eC(6,1.15);eCx(6,0);eCy(0,1.15);
  Lt(2,\ymax);Lb(2,\ymin);Rt(6,\ymax);Rb(6,\ymin);Mt(4,\ymax);Mb(4,\ymin)
 }
 \Hasen{\Lt\Lb}\Hasen{\Rt\Rb}
% \Hasen{\Mt\Mb}
% \Put\aA[es]{$(,f())$}\Put\aB[sw]{$(,f())$}\Put\aC[e]{$(,f())$}
% \Put\bA[w]{$(,f())$}\Put\bB[se]{$(,f())$}\Put\bC[e]{$(,f())$}
% \Put\cA[w]{$(,f())$}\Put\cB[se]{$(,f())$}\Put\cC[e]{$(,f())$}
% \Put\dA[w]{$(,f())$}\Put\dB[sw]{$(,f())$}\Put\dC[e]{$(,f())$}
% \Put\eA[w]{$(,f())$}\Put\eB[se]{$(,f())$}\Put\eC[sw]{$(,f())$}
% \Put\Lb[s]{$x=$}\Put\Rb[s]{$x=$}
% \Put\Mb[s]{$x=$}
% \kuromaru[2pt]{\aA}\kuromaru[2pt]{\aB}\kuromaru[2pt]{\aC}
% \kuromaru[2pt]{\bA}\kuromaru[2pt]{\bB}\kuromaru[2pt]{\bC}
% \kuromaru[2pt]{\cA}\kuromaru[2pt]{\cB}\kuromaru[2pt]{\cC}
% \kuromaru[2pt]{\dA}\kuromaru[2pt]{\dB}\kuromaru[2pt]{\dC}
% \kuromaru[2pt]{\eA}\kuromaru[2pt]{\eB}\kuromaru[2pt]{\eC}
\end{zahyou*}\\[5mm]
図より
\begin{jquote}(1zw)
 $M(a) = f(a)$\\
 $   = a^2 - 2a + 2$
\end{jquote}