\chapter{نمونه‌ شکل‌های دیگر    } 
با استفاده از بسته tkz شکل‌ها و نمودارهای مختلفی را می توان رسم نمود که می‌توانند در  رشته‌های مختلف مورد استفاده قرار گیرند. این شکل‌ها و نمودارها نیز مانند متون نوشته شده در لاتک، دارای کیفیت بسیار بالایی می‌باشند. در ادامه برخی از آنها قرار داده شده‌اند که با توجه به نحوه این دستورات، ممکن است قسمتی از دستور به‌کار رفته در آنها مورد استفاده شما قرار گیرد. 
%\begin{figure}
%	\usetikzlibrary{calc}
%	\def\nbrcircles {700}
%	\def\outerradius {30mm}
%	\def\deviation {.9}
%	\def\fudge {.62}
%	\newcounter{cumulArea}
%	\setcounter{cumulArea}{0}
%	\begin{center}
%		\begin{tikzpicture}[scale=.32]
%		
%		\pgfmathsetmacro {\goldenRatio} {(1+sqrt(5))}
%		\pgfmathsetmacro {\meanArea}
%		{pow(\outerradius * 10 / \nbrcircles, 2) * pi}
%		\pgfmathsetmacro {\minArea} {\meanArea * (1 - \deviation)}
%		\pgfmathsetmacro {\midArea} {\meanArea * (1 + \deviation) - \minArea}
%		
%		\foreach \b in {0,...,\nbrcircles}{
%			% mod() must be used in order to calculate the right angle.
%			% otherwise, when \b is greater than 28 the angle is greater
%			% than 16384 and an error is raised ('Dimension too large').
%			% -- thx Tonio for this one.
%			\pgfmathsetmacro{\angle}{mod(\goldenRatio * \b, 2) * 180}
%			
%			\pgfmathsetmacro{\sratio}{\b / \nbrcircles}
%			\pgfmathsetmacro{\smArea}{\minArea + \sratio * \midArea}
%			\pgfmathsetmacro{\smRadius}{sqrt(\smArea / pi) / 2 * \fudge}
%			\addtocounter{cumulArea}{\smArea};
%			
%			\pgfmathparse{sqrt(\value{cumulArea} / pi) / 2}
%			\fill[] (\angle:\pgfmathresult) circle [radius=\smRadius] ;
%		}  
%		\end{tikzpicture}
%		\caption{phyllotaxy}
%	\end{center}
%\end{figure}
\newpage
\begin{figure}
	\usetikzlibrary{calc}
	\begin{center}
		\begin{tikzpicture}[cap=round]
		% Colors
		\colorlet{anglecolor}{green!50!black}
		\colorlet{bordercolor}{black}
		
		%Configuration: change this to define number of intersections: 
		% 5 degree mean 360/10 = 36 elements
		\def\alpha{5} % degree
		\def\layer{5}
		
		\begin{scope}[scale=5]
		% Radius R = 1
		
		% The figure is constructed by intersecting circles Cx of radius R.
		%  M_Cx lies on the circle C with a radius \alpha degree from the outer circle R 
		%  and a distance defined by \alpha degree.
		
		% It is sufficent to calculate one special M_C, which is intersecting the x-axis 
		% at distance R from (0,0).
		\pgfmathsetmacro\sinTriDiff{sin(60-\alpha)}
		\pgfmathsetmacro\cosTriDiff{1-cos(60-\alpha)}
		% The distance from the (0,0).
		\pgfmathsetmacro\radiusC{sqrt(\cosTriDiff*\cosTriDiff + \sinTriDiff*\sinTriDiff)}
		% Angle of M_C (from x-axis)
		\pgfmathsetmacro\startAng{\alpha + atan(\sinTriDiff/\cosTriDiff)}
		
		% The segment layer are \alpha degree apart
		\pgfmathsetmacro\al{\alpha*\layer}
		
		% For each segment create the intersection parts of the circles by using arcs
		\foreach \x in {0,\alpha,...,\al}
		{
			% Calculate the polar coordiantes of M_Cx. We take the M_C from above 
			% and  can calculate all other M_Cx by adding \alpha
			\pgfmathsetmacro\ang{\x + \startAng}
			% From ths we get the (x,y) coordinates
			\pgfmathsetmacro\xRs{\radiusC*cos(\ang)}
			\pgfmathsetmacro\yRs{\radiusC*sin(\ang)}
			
			% Now we intersect each new M_C with the x-axis:
			% We can find the radius of concentric inner circles
			\pgfmathsetmacro\radiusLayer{\xRs + sqrt( 1 - \yRs*\yRs )}
			
			% To calculate angles for the arcs later, this angle is needed
			\pgfmathsetmacro\angRs{acos(\yRs)}
			
			% We need to have the angle from the previous loop as well
			\pgfmathsetmacro\angRss{acos(\radiusC*sin(\ang-\alpha))}
			
			
			% Add some fading by \ang
			\colorlet{anglecolor}{black!\ang!green}
			
			% The loop needs to run a whole.  
			% We don't want to cope with angles > 360 degree, adapt the limits. 
			\pgfmathsetmacro\step{2*\alpha - 180}
			\pgfmathsetmacro\stop{180-2*\alpha}
			\foreach \y in {-180, \step ,..., \stop}
			{
				\pgfmathsetmacro\deltaAng{\y-\x}
				% This are the arcs which are definied by the intersection of 3 circles 
				\filldraw[color=anglecolor,draw=bordercolor] 
				(\y-\x:\radiusLayer)    
				arc (-90+\angRs+\deltaAng : \alpha-90+\angRss+\deltaAng :1) 
				arc (\alpha+90-\angRss+\deltaAng : 2*\alpha+90-\angRs+\deltaAng :1)
				arc (\deltaAng+2*\alpha : \deltaAng : \radiusLayer);
			}
			
			
			% helper circles  & lines
			%\draw[color=gray] (\xRs,\yRs) circle (1);
			%\draw[color=gray] (\xRs,-\yRs) circle (1);
			%\draw[color=blue] (0,0) circle (\radiusLayer);
			%\draw[color=blue, very thick] (0,0) -- (0:1);
			%\draw[color=blue, very thick] (0,0) -- (\ang:\radiusC) -- (\xRs,0);  
			%\draw[color=blue, very thick] (\xRs,\yRs) -- (0:\radiusLayer);
			%\filldraw[color=blue!20, very thick] (\xRs,\yRs) -- 
			% (\xRs,\yRs-0.3) arc (-90:-90+\angRs:0.2) -- cycle;
			
		}
		% Additional inner decoration element
		\pgfmathsetmacro\xRs{\radiusC*cos(\al+\startAng)}
		\pgfmathsetmacro\yRs{\radiusC*sin(\al+\startAng)}
		\pgfmathsetmacro\radiusLayer{\xRs + sqrt( 1 - \yRs*\yRs )}
		\draw[line width=2, color=bordercolor] (0,0) circle (.8*\radiusLayer);
		\pgfmathsetmacro\radiusSmall{.7*\radiusLayer}
		% There are six elements to create. Avoid angles >360 degree.
		\foreach \x in {-60,0,...,240}
		{
			\fill[color=anglecolor] (\x:\radiusSmall) arc (-180+\x+60: -180+\x: \radiusSmall)
			arc (0+\x: -60+\x: \radiusSmall)
			arc (120+\x: 60+\x: \radiusSmall); 
		}
		% The outer decoration
		\foreach \x in {0, 4, ..., 360}
		{
			\fill[color=anglecolor] (\x:1) -- (\x+3:1.05) -- (\x+5:1.05) -- (\x+2:1) -- cycle;
			\fill[color=anglecolor] (\x+5:1.05) -- (\x+7:1.05) -- (\x+4:1.1) -- (\x+2:1.1) -- cycle;
		}
		\draw[line width=1, color=bordercolor] (0,0) circle (1);
		\draw[line width=1, color=bordercolor] (0,0) circle (1.1);
		\end{scope}
		\end{tikzpicture}
		\caption{mosaic-from-pompeii}
	\end{center}
\end{figure}	
\newpage
\begin{figure}
	\usetikzlibrary{fadings,decorations,decorations.pathmorphing}
	\begin{center}
		\begin{tikzpicture}
		
		\clip (-5,-3) rectangle (5,3);
		
		% the sky
		\fill[blue!10!black] (-6,1) rectangle (6,3);
		\fill[yellow] (-6,-3) rectangle (6,1);
		\fill[inner color=blue!50!,outer color=blue!10!black] (-12,-6) rectangle (9,2);
		
		% orange fadings
		\draw[draw=none] 
		[postaction={path fading=north,fill=orange!80!yellow,opacity=0.6}]
		(-7,-2.5) rectangle (7,-1.5);%
		\draw[draw=none] 
		[postaction={path fading=north,fill=orange,opacity=0.8}]
		(-7,-2.5) rectangle (7,-2);
		
		% the line of mountains
		\fill[black]
		decorate [decoration={random steps,segment length=3pt,amplitude=1pt}] %
		{(-5,-2.25) -- (-3.5,-2.25)}%
		decorate [decoration={random steps,segment length=5pt,amplitude=4pt}] %
		{-- (-2.5,-2.25) -- (-1,-2.25)}%
		decorate [decoration={random steps,segment length=5pt,amplitude=1pt}] %
		{-- (-1,-2.25) -- (5,-2.25)}%
		-- (5,-3) -- (-5,-3) -- (-5,-2.25);
		
		% a planet or a star
		\draw[color=white] (3.6,2.1) circle (0.009);
		\draw[color=white] (2.8,.5) circle (0.002);
		\draw[color=white] (1.1,.75) circle (0.0001);
		\draw[color=white] (0,2.5) circle (0.0001);
		\end{tikzpicture}
		\caption{Sunset}
	\end{center}
\end{figure}
\newpage

\begin{figure}
	\begin{center}
		\tikzset{3D/.cd,
			x/.store in=\xx, x=0,
			y/.store in=\yy, y=0,
			z/.store in=\zz, z=0
		}
		
		\tikzdeclarecoordinatesystem{3D}{%
			\tikzset{3D/.cd,#1}%
			\pgfpoint{sin(\yy)*(\xx)}{-((\xx)/75)^2+(\zz)/100*(\xx)}%
		}
		\begin{tikzpicture}[line join=round, very thin]
		\def\e{1260}
		\foreach \x [evaluate={\i=mod(\x+90,360); \j=int((\i<180)*2-1); \t=3;
			\sc=\x/\e; \n=int((\e-\x)/15+5); \X=\x/\e;}] in {10,25,...,\e} {
			
			\path [shift={(3D cs:x=\x-\t,y={3*sin(\x-\t)})}, yslant=cos(\x)/5]
			(-\X/2, 0)   coordinate (A')  ( \X/2, 0)   coordinate (B')
			( \X/2,2*\X) coordinate (C')  (-\X/2,2*\X) coordinate (D');
			
			\path [shift={(3D cs:x=\x,y=3*sin \x)}, yslant=cos(\x)/5]
			(-\X/2, 0)   coordinate (A) ( \X/2, 0)   coordinate (B)
			( \X/2,2*\X) coordinate (C) (-\X/2,2*\X) coordinate (D);
			
			\filldraw [black!90] (B) -- (B') -- (C') -- (C)  -- cycle;
			\filldraw [black!80] (A) -- (A') -- (D') -- (D)  -- cycle;
			\filldraw [black!70] (C) -- (D)  -- (D') -- (C') -- cycle;
			\filldraw [black]    (A) -- (B)  -- (C)  -- (D)  -- cycle;
			
			\node [text=white, shift={($(C)!0.5!(D)$)}, anchor=north,
			yslant=cos(\x)/5, font=\sf, scale=\sc*1.5] at (0,-.33*\X) {\n};
		}
		%
		\foreach \i [evaluate={\x=\i*30-10; \X=1; \n=int(5-\i); \xsl=\x/180}]
		in {1,...,4} {
			
			\path [shift={(3D cs:x=\x+\e,y=-3*\x/90)}, yslant=cos \e/5, xslant=\xsl]
			(-\X/2, 0)           coordinate (A) ( \X/2, 0)           coordinate (B)
			( \X/2, \X*2-\x/360) coordinate (C) (-\X/2, \X*2-\x/360) coordinate (D);
			
			\path [shift={(3D cs:x=\x+\e,y=-3*\x/90)}, shift={(5/50,5/50-\i*2/50)},
			yslant=cos \e/5, xslant=\xsl]
			(-\X/2, 0)           coordinate (A') ( \X/2, 0)           coordinate (B')
			( \X/2, \X*2-\x/330) coordinate (C') (-\X/2, \X*2-\x/330) coordinate (D');
			
			\filldraw [black!70] (C) -- (D)  -- (D') -- (C') -- cycle;
			\filldraw [black!70] (A) -- (B)  -- (B') -- (A') -- cycle;
			\filldraw [black!90] (B) -- (B') -- (C') -- (C)  -- cycle;
			\filldraw [black]    (A) -- (B)  -- (C)  -- (D)  -- cycle;
			
			\node [text=white, shift={($(C)!0.5!(D)$)}, anchor=north, xslant=\xsl,
			yslant=cos \e/5, font=\sf, scale=1.5] at (0,-.33*\X) {\n};
		}
		\end{tikzpicture}
		\caption{ Domino}
	\end{center}
\end{figure}
\newpage
\begin{figure}
	\usetikzlibrary{calc,decorations.pathmorphing}
	\begin{latin}
		\pgfdeclareradialshading{someshade}{\pgfpointorigin}{%
			color(0mm)=(pgftransparent!40);color(5mm)=(pgftransparent!50);%
			color(10mm)=(pgftransparent!70);color(2cm)=(pgftransparent!100)}
		\pgfdeclareradialshading{somenodeshade}{\pgfpointorigin}{%
			color(0mm)=(pgftransparent!0);color(2mm)=(pgftransparent!5);%
			color(5mm)=(pgftransparent!95);color(20mm)=(pgftransparent!100)}
		\pgfdeclareradialshading{invertshade}{\pgfpointorigin}{%
			color(0mm)=(pgftransparent!100);color(6mm)=(pgftransparent!95);%
			color(10mm)=(pgftransparent!60);color(2cm)=(pgftransparent!0)}
		\pgfdeclarefading{fadeit}{\pgfuseshading{someshade}}
		\pgfdeclarefading{fadein}{\pgfuseshading{invertshade}}
		\begin{center}
			\begin{tikzpicture}[projectile/.style={decorate,decoration={random steps,
					segment length=3pt,amplitude=0.5pt}}]
			\fill[black] (-4,-4) rectangle (6,5);
			
			\begin{scope}[xshift=0cm,yshift=-0.4cm,transparency group]
			\pgfsetfading{fadein}{\pgftransformshift{\pgfpointorigin}}
			\foreach \x in {0,6,..., 360}{\draw[blue!80!white,projectile,line width=1.1pt]
				(0,0) to [in=90] (10*rand+\x:rand*1mm+2cm);};
			\end{scope}
			
			\begin{scope}[xshift=2cm,yshift=1cm]
			\foreach \x in {0,8,..., 360}{\draw [yellow!5,thick,projectile] (0.7,0)
				to  (3*rand+\x :1mm*rand+2.2cm)  node[circle,inner sep=1mm,
				shade,shading=somenodeshade,opacity=0.1] {};}
			{\pgfsetfading{fadeit}{\pgftransformshift{\pgfpoint{2.5cm}{1cm}}}};
			\fill[white] (-3,-3) rectangle (3,3);
			\end{scope}
			
			\begin{scope}[xshift=3cm,yshift=-1cm]
			\foreach \x in {0,10,..., 360}{\def\r1{rand}\draw [yellow]
				($(0,0)!abs{\r1}!(\x :5mm)$) to [in=90] ($(0,0)!abs{\r1}+0.2!(\x :8mm)$);}
			{\pgfsetfading{fadeit}{\pgftransformshift{\pgfpoint{3cm}{-1cm}}}};
			\fill[yellow,opacity=0.6] (-3,-3) rectangle (3,3);
			\end{scope}
			
			\begin{scope}[xshift=-1cm,yshift=1.5cm]
			\foreach \x in {0,12,..., 360}{\def\r2{rand}\draw [red,line width=0.5pt]
				($(0,0)!abs{\r2}!(\x :3mm)$) -- ($(0,0)!abs{\r2}+0.1!(\x :7mm)$);}
			{\pgfsetfading{fadeit}{\pgftransformshift{\pgfpoint{-1cm}{1.5cm}}}};
			\fill[red,opacity=0.6] (-3,-3) rectangle (3,3);
			\end{scope}
			\end{tikzpicture}
		\end{center}\caption{firework}
	\end{latin}
\end{figure}
\newpage
\begin{figure}
	\begin{center}
	\tikzset{partial ellipse/.style args =
		{#1:#2:#3}{insert path={+ (#1:#3) arc (#1:#2:#3)}}}
	\begin{tikzpicture}[>=latex]
	%  ellipses
	\draw [fill=white!90!red]    (3,-1.8) ellipse    (4cm and 1 cm);
	\draw [fill=yellow!90!green] (3,-1.8) ellipse (3cm and 0.75 cm);
	\draw [fill=white!90!green]  (3,-1.8) ellipse  (2cm and 0.5 cm);
	
	% -- Soleil
	\shade [ball color=gray!10!yellow] (3,-1.8) circle (1);
	\node (soleil) at (3,-1.8) {\bf Soleil};
	% partial ellipse pour tracé devant le Soleil
	\draw (3,-1.8) [partial ellipse=220:320:2cm and 0.5cm]
	(3,-1.8) [partial ellipse=220:320:3cm and 0.75cm];
	
	% Venus
	\shade [ball color=gray!10!orange] (1.6,-1.8) circle (.2);
	\node (venus) at (1.5,-1.45) {Venus}; 
	
	% ombre de Venus
	\draw[color=white!70!black,fill=white!70!black]
	(1.6,-2.3) ellipse (2mm and 0.5mm);
	
	% Mercure
	\shade [ball color=gray!10!orange] (5,-1.225) circle (.25);
	\node (mercure) at (5,-0.8) {Mercure}; 
	
	% Earth
	\shade [ball color=white!50!blue] (5.75,-2.5) circle (.33);
	\node (terre) at (6.6,-2.6) {\bf Terre};
	
	% Lune
	\shade [ball color=yellow] (5.25,-2.8) circle (.1);
	\node (lune) at (5.25,-3) {Lune};
	
	% Mars
	\draw (3,-1.8) [partial ellipse=45:120:9cm and 2.5cm];
	\shade [ball color=black!50!red] (5,0.66) circle (.15);
	\node (mars) at (5,1) {\bf Mars};   
	% trajet
	\draw [line width=2pt,blue,->,>=latex] (terre) to[out=0,in=0] (mars);   
	\end{tikzpicture}	
		\caption{planets}
	\end{center}
\end{figure}
\newpage
\begin{figure}
	\begin{center}
\begin{tikzpicture}[x=3cm, y=3cm]
\begin{scope}[every node/.append style={
	yslant=0,xslant=0},yslant=0,xslant=2.5
]
\shade[bottom color = black, top color = white] (-12.54, 5)
rectangle +(0.1, 1.1);
\shade[bottom color = blue, top color = white] (-12.48,5)
rectangle +(0.5,1.1);
\shade[bottom color = black, top color = white] (-12, 4.98)
rectangle +(0.1, 1.1);
\end{scope}

\begin{scope}[every node/.append style={
	yslant=0,xslant=0},yslant=0.4,xslant=0
]
\shade[left color = blue, right color = white, rounded corners=1]
(0.54,-0.26) rectangle +(2.8,5.03);
\foreach \x in {0.8,1.3,...,3.3}{
	\foreach \y in {0.1, 0.7,..., 4.8}{
		\pgfmathsetmacro{\val}{1-(\x-0.8)/2.6}
		\node [color = red, opacity =\val] at (\x ,\y) {\Huge{\textbf +}};
	}
}
\end{scope}

\pgfmathsetseed{10}

\foreach \i in {1,2,...,30}{
	%    \pgfmathsetmacro{\x}{(rand*0.5 + 1)*4 + 1}
	%    \pgfmathsetmacro{\y}{(rand*0.5 + 1)*3.9 + 2 }
	\pgfmathsetmacro{\x}{(rand*0.5 + 1)*3 - 0.5}
	\pgfmathsetmacro{\y}{(rand*0.5 + 1)*4.7-1.2}
	%    \pgfmathsetmacro{\opacVal}{0.95*(\x-2.5)/4 + rand*0.05}
	\pgfmathsetmacro{\opacVal}{rand*0.5+1}
	\shade [ball color = green, opacity = \opacVal] (\x,\y) circle (0.1);
}

\fill [fill = black,rounded corners= 0.6] (-0.05,-0.05)
rectangle +(0.6,5.05);
\fill [fill = blue] (0,0) rectangle +(0.5,4.95);
\end{tikzpicture}		
		\caption{membrane-ions}
	\end{center}
\end{figure}
\newpage
\begin{figure}
	\usetikzlibrary{calc,fadings,decorations.pathreplacing}
	\begin{center}
		\begin{tikzpicture}
		\def\nuPi{3.1459265}
		\foreach \i in {11,10,...,0}{% This one doesn't matter
			\foreach \j in {5,4,...,0}{% This will crate a membrane
				% with the front lipids visible
				% top layer
				\pgfmathsetmacro{\dx}{rand*0.1}% A random variance in the x coordinate
				\pgfmathsetmacro{\dy}{rand*0.1}% A random variance in the y coordinate,
				% gives a hight fill to the lipid
				\pgfmathsetmacro{\rot}{rand*0.1}% A random variance in the
				% molecule orientation      
				\shade[ball color=red] ({\i+\dx+\rot},{0.5*\j+\dy+0.4*sin(\i*\nuPi*10)}) circle(0.45);
				\shade[ball color=gray] (\i+\dx,{0.5*\j+\dy+0.4*sin(\i*\nuPi*10)-0.9}) circle(0.45);
				\shade[ball color=gray] (\i+\dx-\rot,{0.5*\j+\dy+0.4*sin(\i*\nuPi*10)-1.8}) circle(0.45);
				% bottom layer
				\pgfmathsetmacro{\dx}{rand*0.1}
				\pgfmathsetmacro{\dy}{rand*0.1}
				\pgfmathsetmacro{\rot}{rand*0.1}
				\shade[ball color=gray] (\i+\dx+\rot,{0.5*\j+\dy+0.4*sin(\i*\nuPi*10)-2.8}) circle(0.45);
				\shade[ball color=gray] (\i+\dx,{0.5*\j+\dy+0.4*sin(\i*\nuPi*10)-3.7}) circle(0.45);
				\shade[ball color=red] (\i+\dx-\rot,{0.5*\j+\dy+0.4*sin(\i*\nuPi*10)-4.6}) circle(0.45);
			}
		}
		\end{tikzpicture}
		\caption{membrane-surface}
	\end{center}
\end{figure}
\newpage
\usetikzlibrary{spy}
\newlength\longd
\newlength\shortd
\setlength{\longd}{0.5cm}
\setlength{\shortd}{0.2cm}
\newcommand{\myshape}[3]{
	\shadedraw[inner color=#1,outer color=#2, draw=#3 ]
	(O)[rounded corners=4pt] --
	++(90:\longd)[sharp corners] --
	++(210:\shortd)[rounded corners=4pt] --
	++(150:\shortd) --
	++(30:\longd)--
	++(330:\longd)[sharp corners] --
	++(210:\shortd)[rounded corners=4pt] --
	++(150:\shortd)--
	++(-90:\longd) --
	++(90-120:\longd) [sharp corners]--
	++(210-120:\shortd)[rounded corners=4pt] --
	++(150-120:\shortd)--
	++(30-120:\longd) --
	++(330-120:\longd)[sharp corners] --
	++(210-120:\shortd)[rounded corners=4pt]--
	++(150-120:\shortd)--
	++(-90-120:\longd) --
	++(90-240:\longd) [sharp corners]--
	++(210-240:\shortd)[rounded corners=4pt] --
	++(150-240:\shortd) --
	++(30-240:\longd) --
	++(330-240:\longd)[sharp corners] --
	++(210-240:\shortd)[rounded corners=4pt] --
	++(150-240:\shortd)-- cycle;
}
\begin{figure}
	\begin{center}
	\begin{tikzpicture}[scale=1.6, spy using outlines={circle,
		magnification=4, size=3cm, connect spies}]
	\begin{scope} %Scope environment is used to limit the clip command
	\clip [rounded corners] (.5,.5) rectangle (7.5,7.5);
	%The base shape is repeatedly drawn using loop comands.
	\foreach \y in {0,.9,..., 9} % {0, 4.5*\shortd, ..., n*4.5*\shortd}
	{
		\foreach \x in {0,1.55884,..., 7.79423}
		%{0, sqrt(3)*4.5*\shortd,..., upper limit}
		{
			\coordinate (O) at (\x,\y);
			\myshape{white}{black}{black};
		}
	}
	\foreach \y in {-0.45,.45,..., 8.6}
	%{0-4.5*\shortd/2, 4.5*\shortd/2,..., n*4.5*\shortd}
	{
		\foreach \x in {0.779422,2.338267,..., 10}
		%{0.5*sqrt(3)*4.5*\shortd, 1.5*sqrt(3)*4.5*\shortd/2,...,upper lim}
		{
			\coordinate (O) at (\x,\y);
			\myshape{white}{black}{black};
		}
	}
	\end{scope}
	\draw [rounded corners, very thick] (.5,.5) rectangle (7.5,7.5);
	\spy [cyan] on (5.4,2.3) in node [left] at (5.4,-1.15);
	\end{tikzpicture}
		\caption{islamic-art}
	\end{center}
\end{figure}
\newpage

\begin{figure}
\tikzfading[name=fade out, inner color=transparent!0,
outer color=transparent!100]
	\def\petal { 
		[rounded corners=0.5] %
		(-1,0)%
		.. controls (-1,0.6) and (-0.07,0.8).. (0,1)%
		.. controls (0.07,0.8) and (1,0.6).. (1,0)%
		.. controls (0.7,-1) and (-0.7,-1).. (-1,0)%
	}
	
	%%%%% circles in the background %%%%%
	\def\background[#1,#2]{
		\fill[#1] (0,0) circle (3.9);
		\fill[#2] (0,0) circle (1);
	}
	
	%%%%% star and small circle in the center %%%%%
	\def\center[#1]{
		\foreach \a in {51.4285,102.857,...,360} { %
			\draw[color=yellow,rotate=\a,fill=#1]
			(-0.08,0) -- (0,0.46) -- (0.08,0); %
		}
		\draw[color=yellow,fill=#1] (0,0) circle (0.1);
	}
	
	%%%%%%%%%% Mandala with fixed colouring %%%%%%%%%%
	\def \mandala {
		\background[red!30!blue!70!black,blue!70!yellow!50];
		
		% ysh - yshift
		% xs - xscale
		% ys - yscale
		% af - first angle in foreach
		% as - second angle in foreach
		% y - number in the color specification after yellow
		% b - number in the color specification before blue
		% r - number in the color specification of the shading after red
		% bl - number in the color specification of the shading before black
		\foreach \ysh/\xs/\ys/\af/\as/\y/\b/\w/\r/\bl in {%
			3.06/0.72/0.8/   25.71425/51.4285/    70/100/100/ 100/100,%
			2.34/1/0.9/        25.71425/77.14275/   6/90/92/       80/80,%
			1.8/0.8/0.9/       51.4285/102.857/       0/75/100/     60/70,%
			1.5/0.6/0.6/       25.71425/77.14275/   0/55/100/     40/60,%
			1.1/0.53/0.58/   51.4285/102.857/       0/40/100/     20/50,%
			0.8/0.37/0.45/   25.71425/77.14275/   0/45/85/       20/40,%
			0.53/0.1/0.24/   25.71425/77.14275/   0/10/100/     0/30,%
			0.49/0.22/0.32/ 51.4285/102.857/       0/10/100/     0/50%
		}
		{
			\foreach \a in {\af,\as,...,360}
			{
				\begin{scope}[rotate=\a,shift={(0,\ysh)},xscale=\xs,yscale=\ys]
					\draw[color=yellow,fill=yellow!\y!red!\b!blue!\w] %
					[drop shadow={shadow xshift=0.5pt, shadow yshift=-0.5pt}]
					\petal;
				\end{scope}
				
				\begin{scope}[transform canvas={rotate=\a},shift={(0,\ysh)},xscale=\xs,yscale=\ys]
					\clip \petal; %
					\fill[path fading=fade out,fill=red!\r!blue!\bl!black, opacity=0.7]%
					(0,-0.35) ellipse (1.2 and 0.75);
					\fill[path fading=fade out,fill=red!\r!blue!\bl!black, opacity=0.3]%
					(0,-0.2) ellipse (1.2 and 0.4);
					
					\fill[path fading=fade out,fill=red!\r!blue,opacity=0.2] %
					(-0.4,0.6) -- (0,0.9) -- (0.4,0.6);
				\end{scope}
			}
		}	
		\center[blue]
	}
	%%%%%%%%%% End of Mandala with fixed colouring %%%%%%%%%%
	
	%%%%% one layer of petals %%%%%
	\def\mainbody{
		\foreach \a in {\af,\as,...,360}
		{
			\begin{scope}[rotate=\a,shift={(0,\ysh)},xscale=\xs,yscale=\ys]
				\draw[color=yellow,fill=\c] %
				[drop shadow={shadow xshift=0.5pt, shadow yshift=-0.5pt}]
				\petal;
			\end{scope}
			
			% fadings
			\begin{scope}[transform canvas={rotate=\a}, shift={(0,\ysh)},xscale=\xs,yscale=\ys]
				\clip \petal; %
				\fill[path fading=fade out,fill=\fc, opacity=0.7]%
				(0,-0.35) ellipse (1.2 and 0.75);
				\fill[path fading=fade out,fill=\fc, opacity=0.3]%
				(0,-0.2) ellipse (1.2 and 0.4);
				\fill[path fading=fade out,fill=\fc,opacity=0.2] %
				(-0.4,0.6) -- (0,0.9) -- (0.4,0.6);
			\end{scope}
		}
	}
	
	%%%%%%%%%%% Mandalas with parametrized colouring %%%%%%%%%%
	% #1 - the color of the outer most (first) layer
	% #2 - the color of the third layer
	% #3 - the color of the fifth layer
	% #4 - the color of the seventh layer
	% #5 - the color of the fading, gets denser closer to the center
	\def \mandalac[#1,#2,#3,#4,#5]{
		\background[#3!30!#4!70!#5,#4!70!#2!50];
		
		% ysh - yshift
		% xs - xscale
		% ys - yscale
		% af - first angle in foreach
		% as - second angle in foreach
		% c - color of the petal
		% fc - color of the fading
		\foreach \ysh/\xs/\ys/\af/\as/\c/\fc in {%
			3.06/0.72/0.8/   25.71425/51.4285  /#1/#1!50!#2!90!#5,%
			2.34/1/0.9/        25.71425/77.14275/#1!50!#2/#2!80!#5,%
			1.8/0.8/0.9/       51.4285/102.857    /#2/#2!50!#3!70!#5,%
			1.5/0.6/0.6/       25.71425/77.14275/#2!50!#3/#3!60!#5,%
			1.1/0.53/0.58/   51.4285/102.857    /#3/#3!50!#4!50!#5,%
			0.8/0.37/0.45/   25.71425/77.14275/#3!50!#4/#4!40!#5,%
			0.53/0.1/0.24/   25.71425/77.14275/#4/#4!50!#5,%
			0.49/0.22/0.32/ 51.4285/102.857    /#4/#4!50!#5%
		}
		{
			\mainbody
		}
		\center[#4]
	}
	
	% #1 - the color of the outer most (first) layer
	% #2 - the color of the second layer
	% #3 - the color of the third layer
	% #4 - the color of the forth layer
	% #5 - the color of the fifth layer
	% #6 - the color of the sixth layer
	% #7 - the color of the seventh layer
	% #8 - the color of the fading, gets denser closer to the center
	\def \mandalab[#1,#2,#3,#4,#5,#6,#7,#8]{
		\background[#6!30!#7!70!#8,#7!70!#4!50];
		
		% ysh - yshift
		% xs - xscale
		% ys - yscale
		% af - first angle in foreach
		% as - second angle in foreach
		% c - color of the petal
		% fc - color of the fading
		\foreach \ysh/\xs/\ys/\af/\as/\c/\fc in {%
			3.06/0.72/0.8/   25.71425/51.4285  /#1/#2!90!#8,%
			2.34/1/0.9/        25.71425/77.14275/#2/#3!90!#8,%
			1.8/0.8/0.9/       51.4285/102.857    /#3/#4!80!#8,%
			1.5/0.6/0.6/       25.71425/77.14275/#4/#5!80!#8,%
			1.1/0.53/0.58/   51.4285/102.857    /#5/#6!70!#8,%
			0.8/0.37/0.45/   25.71425/77.14275/#6/#7!70!#8,%
			0.53/0.1/0.24/   25.71425/77.14275/#7/#7!50!#8,%
			0.49/0.22/0.32/ 51.4285/102.857    /#7/#7!50!#8%
		}
		{
			\mainbody
		}
		\center[#7]
	}
	%%%%%%%%%%% End of Mandalas with parametrized colouring %%%%%%%%%%
	
	%%%%%%%%%%%%%%%%%%%%%%%%% BEGIN DOCUMENT %%%%%%%%%%%%%%%%%%%%%%%%
	\pagestyle{empty}
	\setlength{\parindent}{0pt}
	\tikz\mandala;
	\tikz\mandalac[magenta!30!,magenta,purple,violet,];
	\tikz\mandalac[blue!40!black,violet,purple,pink,];
	\tikz\mandalac[lime!90!black,yellow!95!black,orange,red,];
	\tikz\mandalac[green!80!black,yellow,pink,purple!90!,red];
	%	\tikz\mandalab[green!50!black, green!60!black, green!70!black!80!, green!50!,green!10!, pink!40!, red!40!,];
	\tikz\mandalab[blue!30!black, blue!40!black, blue!60!black, blue!70!black!80!,
	blue!50!, yellow!40!, yellow!70!,];
	\caption{Mandala}
\end{figure}
\newpage
\begin{figure}
	\begin{center}
	\usetikzlibrary{arrows}
\begin{tikzpicture}[x={(0.866cm,-0.5cm)}, y={(0.866cm,0.5cm)}, z={(0cm,1cm)}, scale=1.0,
%Option for nice arrows
>=stealth, %
inner sep=0pt, outer sep=2pt,%
axis/.style={thick,->},
wave/.style={thick,color=#1,smooth},
polaroid/.style={fill=black!60!white, opacity=0.3},
]
% Colors
\colorlet{darkgreen}{green!50!black}
\colorlet{lightgreen}{green!80!black}
\colorlet{darkred}{red!50!black}
\colorlet{lightred}{red!80!black}

% Frame
\coordinate (O) at (0, 0, 0);
\draw[axis] (O) -- +(14, 0,   0) node [right] {x};
\draw[axis] (O) -- +(0,  2.5, 0) node [right] {y};
\draw[axis] (O) -- +(0,  0,   2) node [above] {z};

\draw[thick,dashed] (-2,0,0) -- (O);

% monochromatic incident light with electric field
\draw[wave=blue, opacity=0.7, variable=\x, samples at={-2,-1.75,...,0}]
plot (\x, { cos(1.0*\x r)*sin(2.0*\x r)}, { sin(1.0*\x r)*sin(2.0*\x r)})
plot (\x, {-cos(1.0*\x r)*sin(2.0*\x r)}, {-sin(1.0*\x r)*sin(2.0*\x r)});

\foreach \x in{-2,-1.75,...,0}{
	\draw[color=blue, opacity=0.7,->]
	(\x,0,0) -- (\x, { cos(1.0*\x r)*sin(2.0*\x r)}, { sin(1.0*\x r)*sin(2.0*\x r)})
	(\x,0,0) -- (\x, {-cos(1.0*\x r)*sin(2.0*\x r)}, {-sin(1.0*\x r)*sin(2.0*\x r)});
}

\filldraw[polaroid] (0,-2,-1.5) -- (0,-2,1.5) -- (0,2,1.5) -- (0,2,-1.5) -- (0,-2,-1.5)
node[below, sloped, near end]{Polaroid};%

%Direction of polarization
\draw[thick,<->] (0,-1.75,-1) -- (0,-0.75,-1);

% Electric field vectors
\draw[wave=blue, variable=\x,samples at={0,0.25,...,6}]
plot (\x,{sin(2*\x r)},0)node[anchor=north]{$\vec{E}$};

%Polarized light between polaroid and thin section
\foreach \x in{0, 0.25,...,6}
\draw[color=blue,->] (\x,0,0) -- (\x,{sin(2*\x r)},0);

\draw (3,1,1) node [text width=2.5cm, text centered]{Polarized light};

%Crystal thin section
\begin{scope}[thick]
\draw (6,-2,-1.5) -- (6,-2,1.5) node [above, sloped, midway]{Crystal section}
-- (6, 2, 1.5) -- (6, 2, -1.5) -- cycle % First face
(6,  -2, -1.5) -- (6.2, -2,-1.5)
(6,   2, -1.5) -- (6.2,  2,-1.5)
(6,  -2,  1.5) -- (6.2, -2, 1.5)
(6,   2,  1.5) -- (6.2,  2, 1.5)
(6.2,-2, -1.5) -- (6.2, -2, 1.5) -- (6.2, 2, 1.5) 
-- (6.2, 2, -1.5) -- cycle; % Second face

%Optical indices
\draw[darkred, ->]       (6.1, 0, 0) -- (6.1, 0.26,  0.966) node [right] {$n_{g}'$}; % index 1
\draw[darkred, dashed]   (6.1, 0, 0) -- (6.1,-0.26, -0.966); % index 1
\draw[darkgreen, ->]     (6.1, 0, 0) -- (6.1, 0.644,-0.173) node [right] {$n_{p}'$}; % index 2
\draw[darkgreen, dashed] (6.1, 0, 0) -- (6.1,-0.644, 0.173); % index 2
\end{scope}

%Rays leaving thin section
\draw[wave=darkred,   variable=\x, samples at={6.2,6.45,...,12}] 
plot (\x, {0.26*0.26*sin(2*(\x-0.5) r)},  {0.966*0.26*sin(2*(\x-0.5) r)});  %n'g-oriented ray
\draw[wave=darkgreen, variable=\x, samples at={6.2,6.45,...,12}]
plot (\x, {0.966*0.966*sin(2*(\x-0.1) r)},{-0.26*0.966*sin(2*(\x-0.1) r)}); %n'p-oriented ray
\draw (10,1,1) node [text width=2.5cm, text centered] {Polarized and dephased light};

\foreach \x in{6.2,6.45,...,12} {
	\draw[color=darkgreen, ->] (\x, 0, 0) --
	(\x, {0.966*0.966*sin(2*(\x-0.1) r)}, {-0.26*0.966*sin(2*(\x-0.1) r)});
	\draw[color=darkred,   ->] (\x, 0, 0) --
	(\x, {0.26*0.26*sin(2*(\x-0.5) r)}, {0.966*0.26*sin(2*(\x-0.5) r)});
}

%Second polarization
\draw[polaroid]   (12, -2,  -1.5) -- (12, -2,   1.5)  %Polarizing filter
node [above, sloped,midway] {Polaroid} -- (12, 2, 1.5) -- (12, 2, -1.5) -- cycle;
\draw[thick, <->] (12, -1.5,-0.5) -- (12, -1.5, 0.5); %Polarization direction

%Light leaving the second polaroid
\draw[wave=lightgreen,variable=\x, samples at={12, 12.25,..., 14}]
plot (\x,{0}, {0.966*0.966*0.26*sin(2*(\x-0.5) r)}); %n'g polarized ray
\draw[wave=lightred,  variable=\x, samples at={12, 12.25,..., 14}]
plot (\x,{0}, {-0.26*0.966*sin(2*(\x-0.1) r)});      %n'p polarized ray

\node[align=justify, text width=14cm, anchor=north west, yshift=-2mm] at (current bounding box.south west)
{Light behavior in a petrographic microscope with light polarizing
	device. Only one incident wavelength is shown (monochromatic light).
	The magnetic field, perpendicular to the electric one, is not drawn.};
\end{tikzpicture}		
		\caption{polarizing-microscope}
	\end{center}
\end{figure}
\newpage
\begin{figure}
	\begin{center}
		
		\definecolor{copper}{cmyk}{0,0.9,0.9,0.2}
		\colorlet{lightgray}{black!25}
		\colorlet{darkgray}{black!75}
		
		\centering
		\Large {Daniell's Pile}
		\vspace{2cm}
		
		
		\begin{tikzpicture}
		% Draw back of vessel 1
		\draw (0,0) to [controls=+(90:0.5) and +(90:0.5)] (2,0);
		\draw[fill=blue!60, fill opacity=0.5] (0,-0.5) to
		[controls=+(90:0.5) and +(90:0.5)] (2,-0.5);
		
		% Draw back of vessel 2
		\draw (3.5,0) to [controls=+(90:0.5) and +(90:0.5)] (5.5,0);
		\draw[fill=lightgray, fill opacity=0.5] (3.5,-0.5) to [controls=+(90:0.5)
		and +(90:0.5)] (5.5,-0.5);
		
		% Draw copper electrode
		\draw[fill=copper] (0.5,2) rectangle (1.5,-1);
		\draw (0,2.3) node {Cu};
		\draw (1,-1.75) node {\small{CuSO$_{4}$}};
		
		% Draw salt bridge
		
		\draw[join=round, line width = 10pt] (1.75,-1.75) -- (1.75,0.5) --
		(3.75, 0.5) -- (3.75,-1.75);
		\draw[join=round, line width = 5pt, color = gray!25] (1.75,-1.75) --
		(1.75,0.5) -- (3.75, 0.5) -- (3.75,-1.75);
		\draw (2.75,0.5) node {\tiny{KNO$_{3}$}};
		
		%Draw front of vessel 1
		
		\draw (0,0) .. controls +(-90:0.5) and +(-90:0.5) .. (2,0);
		\draw (0,0) .. controls +(-90:0.5) and +(-90:0.5) .. (2,0)
		-- (2,-0.5) .. controls +(-90:0.5) and +(-90:0.5) .. (0,-0.5) -- (0,0);
		
		%Second part
		
		\draw[fill=blue!60, fill opacity=0.5] (0,-0.5) .. controls +(-90:0.5)
		and +(-90:0.5) .. (2,-0.5);
		\draw[fill=blue!60, fill opacity=0.5] (0,-0.5) .. controls +(-90:0.5)
		and +(-90:0.5) .. (2,-0.5)
		-- (2,-2) .. controls +(-90:0.5) and +(-90:0.5) .. (0,-2) -- (0,-0.5);
		
		% draw voltmeter
		
		\draw[join = round, thick] (1,2) -- (1,2.5) -- (4.5,2.5) -- (4.5,2);
		\draw (2.75,2.5) node [circle, draw, fill=red!30] {V};
		
		%Draw back of vessel 2
		
		%Draw electrode
		
		\draw[fill=darkgray] (4,2) rectangle (5,-1);
		\draw (5.5,2.3) node {Zn};
		\draw (4.5,-1.75) node {\small{ZnSO$_{4}$}};
		
		% Draw front of vessel 2
		% part 1
		\draw (3.5,0) .. controls +(-90:0.5) and +(-90:0.5) .. (5.5,0);
		\draw (3.5,0) .. controls +(-90:0.5) and +(-90:0.5) .. (5.5,0)
		-- (5.5,-0.5) .. controls +(-90:0.5) and +(-90:0.5)
		.. (3.5,-0.5) -- (3.5,0);
		% part 2
		\draw[fill=lightgray, fill opacity=0.5] (3.5,-0.5) .. controls +(-90:0.5)
		and +(-90:0.5) .. (5.5,-0.5);
		\draw[fill=lightgray, fill opacity=0.5] (3.5,-0.5) .. controls +(-90:0.5)
		and +(-90:0.5) .. (5.5,-0.5) --
		(5.5,-2) .. controls +(-90:0.5) and +(-90:0.5)
		.. (3.5,-2) -- (3.5,-0.5);
		\end{tikzpicture}
		\caption{pile}
	\end{center}
\end{figure}
\begin{figure}
	\begin{center}
		\begin{tikzpicture}[
		media/.style={font={\footnotesize\sffamily}},
		wave/.style={
			decorate,decoration={snake,post length=1.4mm,amplitude=2mm,
				segment length=2mm},thick},
		interface/.style={
			% The border decoration is a path replacing decorator. 
			% For the interface style we want to draw the original path.
			% The postaction option is therefore used to ensure that the
			% border decoration is drawn *after* the original path.
			postaction={draw,decorate,decoration={border,angle=-45,
					amplitude=0.3cm,segment length=2mm}}},
		]
		% Round rectangle
		\fill[gray!10,rounded corners] (-4,-3) rectangle (4,0);
		% Interface
		\draw[blue,line width=.5pt,interface](-4,0)--(4,0);
		% Vertical dashed line
		\draw[dashed,gray](0,-3)--(0,3);
		% Coordinates system
		\draw(0,0.15)node[above]{$x$};
		\draw[<->,line width=1pt] (1,0) node[above]{$y$}-|(0,-1) node[left]{$z$};
		% Incidence
		\draw[->,wave]
		(135:3.2cm)--(135:2.5cm)node[right]{$f^0$};
		\draw[gray](0:0cm)--(135:2cm);
		\path (0,0)++(113:1cm)node{$\phi$};
		\draw[->](0,0.75)arc(90:135:.75cm);
		% Transmission
		\draw[->,wave]
		(-30:2.5cm)--(-30:3.2cm)node[right]{$f^+$};
		\draw[gray](0:0cm)--(-30:2cm);
		\path (0,0)++(-60:1cm)node{$\theta$};
		\draw[->] (0,-0.75) arc (-90:-30:.75cm);
		% Reflection
		\draw[->,wave]
		(45:2.5cm)--(45:3.2cm)node[right]{$f^-$};
		\path (0,0)++(-22:1.75cm) node{$\psi$};
		\draw[gray](0:0cm)--(45:2cm);
		\draw[->] (0,-1.5)arc(-90:45:1.5cm);
		% Media names
		\path[media] (-3,.6)  node {media 1}
		(-3,-.6) node {media 2};
		
		% $x$ axis
		\filldraw[fill=white,line width=1pt](0,0)circle(.12cm);
		\draw[line width=.6pt] (0,0)
		+(-135:.12cm) -- +(45:.12cm)
		+(-45:.12cm) -- +(135:.12cm);
		% Interface pointer
		\draw[-latex,thick](3.2,0.5)node[right]{$\mathsf{S_{1,2}}$}
		to[out=180,in=90] (3,0);
		% To-paths are really useful for drawing curved lines. The above
		% to path is equal to:
		%
		% \draw[-latex,thick](3.2,0.5)node[right]{$\mathsf{S_{1,2}}$}
		%      ..controls +(180:.2cm) and +(up:0.25cm) .. (3,0);
		% Internally the to path is translated to a similar bezier curve,
		% but the to path syntax hides the complexity from the user. 
		\end{tikzpicture}
		\caption{oblique-incidence}
	\end{center}
\end{figure}






 \newpage
% \begin{figure}
% 	\begin{center}
% 	\usetikzlibrary{circuits.logic.US} % TiKZ Library for US Logic Circuits.
% \begin{tikzpicture}[circuit logic US, every circuit symbol/.style={thick}]
% % Logic Gates in Left Side of Multiplexor
% \node[buffer gate, point down,inputs={i}] (buf1) at (-1,3)    {}; % Input Ea
% \node[and gate,inputs={nnnn}, point down] (and1) at (0,-1)    {};
% \node[and gate,inputs={nnnn}, point down] (and2) at (1.5,-1)  {};
% \node[and gate,inputs={nnnn}, point down] (and3) at (3,-1)    {};
% \node[and gate,inputs={nnnn}, point down] (and4) at (4.5,-1)  {};
% \node[or gate,inputs={nnnn}, point down]  (or1)  at (2.25,-3) {};
% \node[not gate, point down]               (not1) at (5.5,4)   {}; % Input Sa
% \node[buffer gate, point down,inputs={i}] (buf2) at (5.5,2.5) {};
% % Left Side connections
% \draw [red, very thick] (buf1.output) -- ++(down:26.4mm) -| (and1.input 4);
% \draw (and1.output) -- ++(down:5mm) -| (or1.input 4);
% \draw (and2.output) -- ++(down:3mm) -| (or1.input 3);
% \draw (and3.output) -- ++(down:3mm) -| (or1.input 2);
% \draw (and4.output) -- ++(down:5mm) -| (or1.input 1);
% \draw (not1.output) -- (buf2.input);
% % Logic Gates in Right Side of Multiplexor
% \node[not gate, point down] (not2) at (7,4) {}; % Input Sb
% \node[buffer gate, point down,inputs={i}] (buf3) at (7,2.5)    {};
% \node[buffer gate, point down,inputs={i}] (buf4) at (13.50,3)  {}; % Input Eb
% \node[and gate,inputs={nnnn}, point down] (and5) at (8,-1)     {};
% \node[and gate,inputs={nnnn}, point down] (and6) at (9.5,-1)   {};
% \node[and gate,inputs={nnnn}, point down] (and7) at (11,-1)    {};
% \node[and gate,inputs={nnnn}, point down] (and8) at (12.5,-1)  {};
% \node[or gate,inputs={nnnn},  point down] (or2)  at (10.25,-3) {};
% \draw (not2.output) -- (buf3.input);
% % Right Side connections
% \draw [red, very thick] (buf4.output) -- ++(down:26.4mm) -| (and8.input 1);
% \draw (and5.output) -- ++(down:5mm) -|  (or2.input 4);
% \draw (and6.output) -- ++(down:3mm) -|  (or2.input 3);
% \draw (and7.output) -- ++(down:3mm) -|  (or2.input 2);
% \draw (and8.output) -- ++(down:5mm) -|  (or2.input 1);
% % Inputs and Outputs of Multiplexer
% \draw [black,very thick] (buf1.input) -- ++(up:5mm) node [above]{$E_a$};
% % Enable Signal a
% \draw [black,very thick] (buf4.input) -- ++(up:5mm) node [above]{$E_b$};
% % Enable Signal b
% \draw [black,very thick] (not1.input) -- ++(up:5mm) node [above]{$S_a$};
% % Selection Signal a
% \draw [black,very thick] (not2.input) -- ++(up:5mm) node [above]{$S_b$};
% % Selection Signal b
% % Inputs I_na with n={0, 1, 2, 3}
% \draw [black,very thick] (and1.input 1) -- ++(up:4.3) node [above]{$I_{0a}$}; 
% \draw [black,very thick] (and2.input 1) -- ++(up:4.3) node [above]{$I_{1a}$};
% \draw [black,very thick] (and3.input 1) -- ++(up:4.3) node [above]{$I_{2a}$};
% \draw [black,very thick] (and4.input 1) -- ++(up:4.3) node [above]{$I_{3a}$};
% % Inputs I_nb with n={0, 1, 2, 3}
% \draw [black,very thick] (and5.input 4) -- ++(up:4.3) node [above]{$I_{0b}$}; 
% \draw [black,very thick] (and6.input 4) -- ++(up:4.3) node [above]{$I_{1b}$};
% \draw [black,very thick] (and7.input 4) -- ++(up:4.3) node [above]{$I_{2b}$};
% \draw [black,very thick] (and8.input 4) -- ++(up:4.3) node [above]{$I_{3b}$};
% % Output of NOT gates
% \draw [blue, very thick]  (not1.output) -- ++(down:2.5mm)
% -- ++(left:5mm) -- (5,0.45);
% \draw [blue, very thick]  (not1.output) -- (buf2.input);
% \draw [Gold3, very thick] (not2.output) -- ++(down:2.5mm) -- ++(left:5mm)
% -- (6.5,0.1);
% \draw [Gold3, very thick] (not2.output) -- (buf3.input);
% % Output of BUFFER gates
% \draw [Brown4, very thick] (buf2.output) -- (5.5,1);
% \draw [Green4, very thick] (buf3.output) -- (7,0.7);
% % Interconnection of AND gates
% \draw [red,very thick]    (and1.input 4) -- ++(up:3mm)  -| (and2.input 4)
% -- ++(up:3mm) -|    (and3.input 4) -- ++(up:3mm)  -| (and4.input 4);
% \draw [red,very thick]    (and5.input 1) -- ++(up:3mm)  -| (and6.input 1)
% -- ++(up:3mm) -|    (and7.input 1) -- ++(up:3mm)  -| (and8.input 1);
% \draw [blue,very thick]   (and1.input 3) -- ++(up:9mm)  -| (and2.input 3)
% -- ++(up:9mm) -|    (and5.input 3) -- ++(up:9mm)  -| (and6.input 3);
% \draw [Gold3,very thick]  (and1.input 2) -- ++(up:6mm)  -| (and3.input 2)
% -- ++(up:6mm) -|    (and5.input 2) -- ++(up:6mm)  -| (and7.input 2);
% \draw [Green4,very thick] (and2.input 2) -- ++(up:12mm) -| (and4.input 2)
% -- ++(up:12mm) -|   (and6.input 2) -- ++(up:12mm) -| (and8.input 2);
% \draw [Brown4,very thick] (and3.input 3) -- ++(up:15mm) -| (and4.input 3)
% -- ++(up:15mm) -|   (and7.input 3) -- ++(up:15mm) -| (and8.input 3);
% % Outputs of multiplexer
% % Buffers at output of OR logic gates.
% \node[buffer gate, point down,inputs={i}] (1y) at (2.25,-4.5)  {};
% \node[buffer gate, point down,inputs={i}] (2y) at (10.25,-4.5) {};
% % Connecting output of OR logic gates to Buffers input
% \draw (or1.output) -- (1y.input);
% \draw (or2.output) -- (2y.input);
% % Outputs of multiplexer
% \draw (1y.output) -- ++(down:5mm) node [below]{$1Y$};
% \draw (2y.output) -- ++(down:5mm) node [below]{$2Y$};
% \end{tikzpicture}		
% 		\caption{}
% 	\end{center}
% \end{figure}
% 
% \begin{figure}
% 	\begin{center}	\usetikzlibrary{positioning,shadows}
% 		\begin{tikzpicture}[x=13mm,y=9mm]
% 		\def\power{8}
% 		% some colors
% 		\colorlet{even}{cyan!60!black}
% 		\colorlet{odd}{orange!100!black}
% 		\colorlet{links}{red!70!black}
% 		\colorlet{back}{yellow!20!white}
% 		% some styles
% 		\tikzset{
% 			box/.style={
% 				minimum height=5mm,
% 				inner sep=.7mm,
% 				outer sep=0mm,
% 				text width=10mm,
% 				text centered,
% 				font=\small\bfseries\sffamily,
% 				text=#1!50!black,
% 				draw=#1,
% 				line width=.25mm,
% 				top color=#1!5,
% 				bottom color=#1!40,
% 				shading angle=0,
% 				rounded corners=2.3mm,
% 				drop shadow={fill=#1!40!gray,fill opacity=.8},
% 				rotate=0,
% 			},
% 			link/.style={-latex,links,line width=.3mm},
% 			plus/.style={text=links,font=\footnotesize\bfseries\sffamily},
% 		}
% 		% Pascal's triangle
% 		% row #0 => value is 1
% 		\node[box=odd] (p-0-0) at (0,0) {1};
% 		\foreach \row in {1,...,\power} {
% 			% col #0 =&gt; value is 1
% 			\node[box=odd] (p-\row-0) at (-\row/2,-\row) {1};
% 			\pgfmathsetmacro{\value}{1};
% 			\foreach \col in {1,...,\row} {
% 				% iterative formula : val = precval * (row-col+1)/col
% 				% (+ 0.5 to bypass rounding errors)
% 				\pgfmathtruncatemacro{\value}{\value*((\row-\col+1)/\col)+0.5};
% 				\global\let\value=\value
% 				% position of each value
% 				\coordinate (pos) at (-\row/2+\col,-\row);
% 				% odd color for odd value and even color for even value
% 				\pgfmathtruncatemacro{\rest}{mod(\value,2)}
% 				\ifnum \rest=0
% 				\node[box=even] (p-\row-\col) at (pos) {\value};
% 				\else
% 				\node[box=odd] (p-\row-\col) at (pos) {\value};
% 				\fi
% 				% for arrows and plus sign
% 				\ifnum \col<\row
% 				\node[plus,above=0mm of p-\row-\col]{+};
% 				\pgfmathtruncatemacro{\prow}{\row-1}
% 				\pgfmathtruncatemacro{\pcol}{\col-1}
% 				\draw[link] (p-\prow-\pcol) -- (p-\row-\col);
% 				\draw[link] ( p-\prow-\col) -- (p-\row-\col);
% 				\fi
% 			}
% 		}
% 		%	\begin{pgfonlayer}{background}
% 		%	% filling and drawing with the same color to enlarge background
% 		%	\path[draw=back,fill=back,line width=5mm,rounded corners=2.5mm]
% 		%	(  p-0-0.north west) -- (  p-0-0.north east) --
% 		%	(p-\power-\power.north east) -- (p-\power-\power.south east) --
% 		%	( p-\power-0.south west) -- ( p-\power-0.north west) --
% 		%	cycle;
% 		%	\end{pgfonlayer}
% 		\end{tikzpicture}	
% 		\caption{yry}
% 	\end{center}
% \end{figure}
%
%\newpage
%\newcommand{\proton}[1]{%
%	\shade[ball color=red] (#1) circle (.25);\draw (#1) node{$+$};
%}
%
%%\neutron{xposition,yposition}
%\newcommand{\neutron}[1]{%
%	\shade[ball color=green] (#1) circle (.25);
%}
%
%%\electron{xwidth,ywidth,rotation angle}
%\newcommand{\electron}[3]{%
%	\draw[rotate = #3](0,0) ellipse (#1 and #2)[color=blue];
%	\shade[ball color=Gold2] (0,#2)[rotate=#3] circle (.1);
%}
%
%\newcommand{\nucleus}{%
%	\neutron{0.1,0.3}
%	\proton{0,0}
%	\neutron{0.3,0.2}
%	\proton{-0.2,0.1}
%	\neutron{-0.1,0.3}
%	\proton{0.2,-0.15}
%	\neutron{-0.05,-0.12}
%	\proton{0.17,0.21}
%}
%
%%\photoelectron{xwidth,ywidth,rotation angle}
%\newcommand{\photoelectron}[3]{%
%	\draw[rotate = #3](0,0) ellipse (#1 and #2)[color=blue];%
%	\draw[snake=coil,%
%	line after snake=0pt, segment aspect=0,%
%	segment length=20pt,color=red!50!blue](#3:#1)-- +(-6,0)%
%	node[fill=white!70!Gold2,draw=red!80!white, above=0.2cm,pos=0.5]%
%	{Incoming $\gamma$-photon};%
%	\draw[-stealth,Gold2](#3:#1) -- ++ (5,0.625);%
%	\shade[ball color=Gold2](#3:#1)  --  ++(4,0.5)%
%	node[fill=white!70!Gold2,draw=red!80!white,%
%	text width=3cm, below right=0.2cm]%
%	{Photoelectron from an inner shell} circle(0.1);%
%	\fill  (#1,0)[rotate=#3,color=white,opaque] circle (.1);%
%	\draw  (#1,0)[rotate=#3,color=Gold2] circle (.1) ;%
%}
%
%%\comptonelectron{xwidth,ywidth,rotation angle}
%\newcommand{\comptonelectron}[3]{%
%	\draw[rotate = #3](0,0) ellipse (#1 and #2)[color=blue];%
%	\draw[snake=coil, line after snake=0pt,%
%	segment aspect=0, segment length=10pt,color=red!50!blue]%
%	(#3:#1)-- +(-6,0)%
%	node[fill=white!70!Gold2,draw=red!80!white, above=0.2cm,pos=0.5]%
%	{Incoming $\gamma$-photon};%
%	\draw[-stealth,Gold2](#3:#1) -- ++ (5,2.5);%
%	\shade[ball color=Gold2](#3:#1)  --  ++(4,2.0)%
%	node[fill=white!70!Gold2,draw=red!80!white, text width=3cm,%
%	below right=0.2cm]{Scattered electron from an outer shell} circle(0.1);%
%	\fill  (#1,0)[rotate=#3,color=white,opaque] circle (.1);%
%	\draw  (#1,0)[rotate=#3,color=Gold2] circle (.1) ;%
%	\draw[snake=coil, line after snake=1mm, segment aspect=0,%
%	segment length=15pt,color=red!50!blue,-stealth] (#3:#1)-- ++(6,-3)%
%	node[fill=white!70!Gold2,draw=red!80!white, right=1cm,pos=0.5]%
%	{Scattered $\gamma$-photon};%
%}
%
%%\paircreation{impact parameter}
%\newcommand{\paircreation}[1]{%
%	\draw[snake=coil, line after snake=0pt, segment aspect=0,%
%	segment length=5pt,color=red!50!blue] (0,#1)-- +(-6,0)%
%	node[fill=white!70!Gold2,draw=red!80!white, above=0.2cm,pos=0.5]%
%	{Incoming $\gamma$-photon};%
%	\draw[-stealth,Gold2](0,#1) -- ++ (5,2.5);%
%	\shade[ball color=Gold2](0,#1)  --  ++(4,2.0)%
%	node[fill=white!70!Gold2,draw=red!80!white, below right=0.2cm]%
%	{Positron} circle(0.1);%
%	\draw[-stealth,Gold2](0,#1) -- ++ (4,-2.0);%
%	\shade[ball color=Gold2](0,#1)  --  ++(3.2,-1.6)%
%	node[fill=white!70!Gold2!,draw=red!80!white, above right=0.2cm]%
%	{Electron} circle(0.1);%
%}
%%
%
%
%\pagestyle{empty}
%
%\begin{figure}
%	\usetikzlibrary{arrows,snakes,shapes}
%	\centering
%	\begin{tikzpicture}[scale=0.65]
%	\nucleus
%	\electron{1.2}{1.4}{260}
%	\electron{4}{2}{30}
%	\electron{5}{1}{60}
%	\electron{5.5}{1.5}{150}
%	\electron{4.8}{2.25}{80}
%	\photoelectron{1.5}{0.75}{80}
%	\end{tikzpicture}
%	\caption{Photoelectric effect}
%	\begin{tikzpicture}[scale=0.65]
%	\nucleus
%	\electron{1.5}{0.75}{80}
%	\electron{1.2}{1.4}{260}
%	\electron{4}{2}{30}
%	\electron{5}{1}{60}
%	\electron{5.5}{1.5}{150}
%	\comptonelectron{4.8}{2.25}{80}
%	\end{tikzpicture}
%	\caption{Compton scattering}
%	\begin{tikzpicture}[scale=0.65]
%	\nucleus
%	\electron{1.5}{0.75}{80}
%	\electron{1.2}{1.4}{260}
%	\electron{4}{2}{30}
%	\electron{5}{1}{60}
%	\electron{5.5}{1.5}{150}
%	\electron{4.8}{2.25}{80}
%	\paircreation{1}
%	\end{tikzpicture}
%	\caption{Pair creation.}
%\end{figure}