%/=========================================================================\
%| |
%| Nomogram Conversion from Hyperbolic Curve to Circular for q^2-aq+b=0. |
%| |
%| Ron Doerfler |
%| http://www.myreckonings.com/wordpress |
%| Version: 01/04/08 |
%| |
%| This script plots various nomograms for the Nomogram essays on my blog. |
%| It runs under the LaTeX typesetting software and uses the TikZ drawing |
%| package that supports parametric plotting. I use the free MiKTeX |
%| distribution of LaTeX (http://www.miktex.org) and the free TeXnicCenter |
%| integrated development environment (IDE) running on top of it |
%| (http://www.toolscenter.org/). Be sure to enable LaTeX to run an |
%| an external program by adding --enable-write18 to the pdflatex command |
%| line in the LaTeX=>PDF output profile to be selected in TeXnicCenter |
%| (for some other installations this requires -shell-escape instead). |
%| |
%| TikZ parametric plots require GNUPLOT to be installed, which is freely |
%| downloadable from http://www.gnuplot.info/. If you use the Windows |
%| executable as I do, you must rename the executable from wgnuplot.exe |
%| to gnuplot.exe and add its folder to the PATH environmental variable |
%| of Windows so that TikZ can call it. The outstanding TikZ user manual |
%| can be found at
%| http://www.ctan.org/tex-archive/graphics/pgf/base/doc/generic/pgf/version-for-pdftex/en/pgfmanual.pdf |
%| |
%| LaTeX has a huge advantage over other ways of plotting nomograms such |
%| as Excel or MatLab, both of which can graph parametric equations. |
%| LaTeX provides great flexibility in the appearance of the plot, |
%| including labeling the curves with the independent parameter which is |
%| what is needed for reading a nomogram. |
%| |
%| All of this should sound familiar to anyone currently using LaTeX as a |
%| typesetting tool for math or science articles. If you are unfamiliar |
%| with LaTeX or have any questions at all about running this script, |
%| please contact me using the Contact form at the URL at the top of this |
%| header and I will be happy to help get you set up. |
%| |
%\=========================================================================/
% NOTE: There are 68 named colors: GreenYellow, Yellow, Goldenrod, Dandelion, Apricot, Peach, Melon, YellowOrange, Orange, BurntOrange, Bittersweet, RedOrange, Mahogany, Maroon, BrickRed, Red, OrangeRed, RubineRed, WildStrawberry, Salmon, CarnationPink, Magenta, VioletRed, Rhodamine, Mulberry, RedViolet, Fuchsia, Lavender, Thistle, Orchid, DarkOrchid, Purple, Plum, Violet, RoyalPurple, BlueViolet, Periwinkle, CadetBlue, CornflowerBlue, MidnightBlue, NavyBlue, RoyalBlue, Blue, Cerulean, Cyan, ProcessBlue, SkyBlue, Turquoise, TealBlue, Aquamarine, BlueGreen, Emerald, JungleGreen, SeaGreen, Green, ForestGreen, PineGreen, LimeGreen, YellowGreen, SpringGreen, OliveGreen, RawSienna, Sepia, Brown,Tan,Gray
% You can create custom colors as: \definecolor{myred}{rgb}{.7,0.3,0.45}
% In the text you can use the colors as: \textcolor{myred}{This color is myred}
\documentclass[11pt]{article}
\usepackage{amsmath} % AMS math package
\usepackage{amsfonts} % AMS math fonts
\usepackage{amssymb} % AMS math symbols
\usepackage[pdftex]{graphicx} % Adds options for graphics
\usepackage[T1]{fontenc} % Use T1 font encoding
\usepackage{mathptmx} % Times New Roman font as default
\usepackage[pdftex,dvipsnames]{xcolor} % Extra foreground/background color support
\usepackage{tikz} % Drawing package
% My definitions.
\newlength{\xvalue}
\newlength{\yvalue}
\begin{document}
% PLOT DETERMINANT #1.
\begin{tikzpicture}
% Draw axes and grid.
\draw[gray,very thin] (-3.9,-4.9) grid (5.9,6.9);
\draw[line width=2pt,->] (-4,0) -- (6,0) node[right] {\Large $x(t)$};
\draw[line width=2pt,->] (0,-5) -- (0,7) node[above] {\Large $y(t)$};
\fill (0,0) circle (0.064cm);
% Draw first half of q.
\draw[color=blue,parametric,domain=1.2:6,samples=200,smooth]
plot[id=nomogram1-q1] function{t/(t-1),t*t/(t-1)};
% Plot tick marks and labels
\foreach \q in {1.5,2,...,6}
\pgfmathsetlength{\xvalue}{(\q cm)/(\q-1)}
\pgfmathsetlength{\yvalue}{(\q*\q cm)/(\q-1)}
\draw [line width=1pt,color=blue](\xvalue + 3pt,\yvalue) -- (\xvalue - 3pt,\yvalue) node[right] {\hspace{6pt}$\q$}
;
\draw[color=blue] (4.45cm,5.5cm) node[right] {\LARGE $q$};
% Draw second half of q.
\draw[color=blue,parametric,domain=-6:0.8,samples=200,smooth]
plot[id=nomogram1-q2] function{t/(t-1),t*t/(t-1)};
\foreach \q in {-6,-5.5,...,.5}
\pgfmathsetlength{\xvalue}{(\q cm)/(\q-1)}
\pgfmathsetlength{\yvalue}{(\q*\q cm)/(\q-1)}
\draw [line width=1pt,color=blue](\xvalue + 3pt,\yvalue) -- (\xvalue - 3pt,\yvalue) node[left] {\hspace{6pt}$\q$}
;
\draw[color=blue] (-3cm,-1.5cm) node[right] {\LARGE $q$};
% Draw scale for a.
\draw[color=red,parametric,domain=-5:7,samples=200,smooth]
plot[id=nomogram1-a] function{1,t};
\foreach \q in {-5,-4,...,7}
\pgfmathsetlength{\xvalue}{1 cm}
\pgfmathsetlength{\yvalue}{\q cm}
\draw [line width=2pt,color=red](\xvalue + 3pt,\yvalue) -- (\xvalue - 3pt,\yvalue) node[left] {\hspace{6pt}$\q$}
;
\draw[color=red] (1.2cm,2.45cm) node[right] {\LARGE $a$};
% Draw scale for b.
\draw[color=ForestGreen,parametric,domain=-5:7,samples=200,smooth]
plot[id=nomogram1-b] function{0,t};
\foreach \q in {-5,-4,...,7}
\pgfmathsetlength{\xvalue}{0 cm}
\pgfmathsetlength{\yvalue}{\q cm}
\draw [line width=2pt,color=ForestGreen](\xvalue + 3pt,\yvalue) -- (\xvalue - 3pt,\yvalue) node[left] {\hspace{6pt}$\q$}
;
\draw[color=ForestGreen] (-1cm,2.5cm) node[right] {\LARGE $b$};
\end{tikzpicture}
% PLOT DETERMINANT #2.
\begin{tikzpicture}
% Draw axes and grid.
\draw[gray,very thin] (-3.9,-4.9) grid (5.9,6.9);
\draw[line width=2pt,->] (-4,0) -- (6,0) node[right] {\Large $x(t)$};
\draw[line width=2pt,->] (0,-5) -- (0,7) node[above] {\Large $y(t)$};
\fill (0,0) circle (0.064cm);
% Draw first half of q.
\draw[color=blue,parametric,domain=1.2:6,samples=200,smooth]
plot[id=nomogram1-q1] function{(t*t + t)/(t-1),t};
\foreach \q in {1.5,2,...,6}
\pgfmathsetlength{\xvalue}{(\q*\q cm + \q cm)/(\q-1)}
\pgfmathsetlength{\yvalue}{(\q cm)}
\draw [line width=1pt,color=blue](\xvalue + 3pt,\yvalue) -- (\xvalue - 3pt,\yvalue)
;
% Draw second half of q.
\draw[color=blue,parametric,domain=-6:0.8,samples=200,smooth]
plot[id=nomogram1-q2] function{(t*t + t)/(t-1),t};
\foreach \q in {-6,-5.5,...,.5}
\pgfmathsetlength{\xvalue}{(\q*\q cm + \q cm)/(\q-1)}
\pgfmathsetlength{\yvalue}{(\q cm)}
\draw [line width=1pt,color=blue](\xvalue + 3pt,\yvalue) -- (\xvalue - 3pt,\yvalue)
;
% Draw scale for a.
\draw[color=red,parametric,domain=-5:7,samples=200,smooth]
plot[id=nomogram1-a] function{t+1,t-1};
\foreach \q in {-5,-4,...,7}
\pgfmathsetlength{\xvalue}{\q cm + 1 cm}
\pgfmathsetlength{\yvalue}{\q cm - 1 cm}
\draw [line width=2pt,color=red](\xvalue + 3pt,\yvalue) -- (\xvalue - 3pt,\yvalue)
;
% Draw scale for b.
\draw[color=ForestGreen,parametric,domain=-5:7,samples=200,smooth]
plot[id=nomogram1-b] function{t,t};
\foreach \q in {-5,-4,...,7}
\pgfmathsetlength{\xvalue}{\q cm}
\pgfmathsetlength{\yvalue}{\q cm}
\draw [line width=2pt,color=ForestGreen](\xvalue + 3pt,\yvalue) -- (\xvalue - 3pt,\yvalue)
;
\end{tikzpicture}
% PLOT DETERMINANT #3.
\begin{tikzpicture}
% Draw axes and grid.
\draw[gray,very thin] (-3.9,-4.9) grid (5.9,6.9);
\draw[line width=2pt,->] (-4,0) -- (6,0) node[right] {\Large $x(t)$};
\draw[line width=2pt,->] (0,-5) -- (0,7) node[above] {\Large $y(t)$};
\fill (0,0) circle (0.064cm);
% Draw first half of q.
\draw[color=blue,parametric,domain=1.2:6,samples=200,smooth]
plot[id=nomogram1-q1] function{(t*t+t)/(t*t+1),(-2*t*t)/(t*t+1)};
\foreach \q in {1.5,2,...,6}
\pgfmathsetlength{\xvalue}{(\q*\q cm + \q cm)/(\q*\q+1)}
\pgfmathsetlength{\yvalue}{-2*\q*\q cm/(\q*\q+1)}
\draw [line width=1pt,color=blue](\xvalue + 3pt,\yvalue) -- (\xvalue - 3pt,\yvalue)
;
% Draw second half of q.
\draw[color=blue,parametric,domain=-6:0.8,samples=200,smooth]
plot[id=nomogram1-q2] function{(t*t+t)/(t*t+1),(-2*t*t)/(t*t+1)};
\foreach \q in {-6,-5.5,...,.5}
\pgfmathsetlength{\xvalue}{(\q*\q cm + \q cm)/(\q*\q+1)}
\pgfmathsetlength{\yvalue}{-2*\q*\q cm/(\q*\q+1)}
\draw [line width=1pt,color=blue](\xvalue + 3pt,\yvalue) -- (\xvalue - 3pt,\yvalue)
;
% Draw scale for a.
\draw[color=red,parametric,domain=.2:50,samples=200,smooth]
plot[id=nomogram1-a] function{(t+1)/t,-2};
\foreach \q in {.5,1,...,50}
\pgfmathsetlength{\xvalue}{(\q cm + 1 cm)/\q}
\pgfmathsetlength{\yvalue}{-2 cm}
\draw [line width=1pt,color=red](\xvalue,\yvalue + 3pt) -- (\xvalue,\yvalue - 3pt)
;
\draw[color=red,parametric,domain=-.2:-50,samples=200,smooth]
plot[id=nomogram1-a] function{(t+1)/t,-2};
\foreach \q in {-.5,-1,...,-50}
\pgfmathsetlength{\xvalue}{(\q cm + 1 cm)/\q}
\pgfmathsetlength{\yvalue}{-2 cm}
\draw [line width=1pt,color=red](\xvalue,\yvalue + 3pt) -- (\xvalue,\yvalue - 3pt)
;
% Draw scale for b.
\draw[color=ForestGreen,parametric,domain=1.5:50,samples=200,smooth]
plot[id=nomogram1-b] function{(t)/(t-1),(-2*t)/(t-1)};
\foreach \q in {1.5,2,...,50}
\pgfmathsetlength{\xvalue}{(\q cm)/(\q-1)}
\pgfmathsetlength{\yvalue}{(-2*\q cm)/(\q-1)}
\draw [line width=1pt,color=ForestGreen](\xvalue + 3pt,\yvalue) -- (\xvalue - 3pt,\yvalue)
;
\draw[color=ForestGreen,parametric,domain=.5:-50,samples=200,smooth]
plot[id=nomogram1-b] function{(t)/(t-1),(-2*t)/(t-1)};
\foreach \q in {.5,0,...,-50}
\pgfmathsetlength{\xvalue}{(\q cm)/(\q-1)}
\pgfmathsetlength{\yvalue}{(-2*\q cm)/(\q-1)}
\draw [line width=1pt,color=ForestGreen](\xvalue + 3pt,\yvalue) -- (\xvalue - 3pt,\yvalue)
;
\end{tikzpicture}
% PLOT DETERMINANT #4.
\begin{tikzpicture}
% Draw axes and grid.
\draw[gray,very thin] (-3.9,-4.9) grid (5.9,6.9);
\draw[line width=2pt,->] (-4,0) -- (6,0) node[right] {\Large $x(t)$};
\draw[line width=2pt,->] (0,-5) -- (0,7) node[above] {\Large $y(t)$};
\fill (0,0) circle (0.064cm);
% Draw first half of q.
\draw[color=blue,parametric,domain=1.2:6,samples=200,smooth]
plot[id=nomogram1-q1] function{t/(t*t+1),(-2*t*t)/(t*t+1)};
\foreach \q in {1.5,2,...,6}
\pgfmathsetlength{\xvalue}{(\q cm)/(\q*\q+1)}
\pgfmathsetlength{\yvalue}{(-2*\q*\q cm)/(\q*\q+1)}
\draw [line width=1pt,color=blue](\xvalue + 3pt,\yvalue) -- (\xvalue - 3pt,\yvalue)
;
% Draw second half of q.
\draw[color=blue,parametric,domain=-6:0.8,samples=200,smooth]
plot[id=nomogram1-q2] function{(t*t+t)/(t*t+1)+0.5*(-2*t*t)/(t*t+1),(-2*t*t)/(t*t+1)};
\foreach \q in {-6,-5.5,...,.5}
\pgfmathsetlength{\xvalue}{(\q cm)/(\q*\q+1)}
\pgfmathsetlength{\yvalue}{(-2*\q*\q cm)/(\q*\q+1)}
\draw [line width=1pt,color=blue](\xvalue + 3pt,\yvalue) -- (\xvalue - 3pt,\yvalue)
;
% Draw scale for a.
\draw[color=red,parametric,domain=.2:50,samples=200,smooth]
plot[id=nomogram1-a] function{(t+1)/t - 1,(-2)};
\foreach \q in {.5,1,...,50}
\pgfmathsetlength{\xvalue}{(1 cm)/\q}
\pgfmathsetlength{\yvalue}{-2 cm}
\draw [line width=1pt,color=red](\xvalue,\yvalue + 3pt) -- (\xvalue,\yvalue - 3pt)
;
\draw[color=red,parametric,domain=-.2:-50,samples=200,smooth]
plot[id=nomogram1-a] function{(t+1)/t - 1,(-2)};
\foreach \q in {-.5,-1,...,-50}
\pgfmathsetlength{\xvalue}{(1 cm)/\q}
\pgfmathsetlength{\yvalue}{-2 cm}
\draw [line width=1pt,color=red](\xvalue,\yvalue + 3pt) -- (\xvalue,\yvalue - 3pt)
;
% Draw scale for b.
\draw[color=ForestGreen,parametric,domain=1.5:50,samples=200,smooth]
plot[id=nomogram1-b] function{0,(-2*t)/(t-1)};
\foreach \q in {1.5,2,...,50}
\pgfmathsetlength{\xvalue}{0 cm}
\pgfmathsetlength{\yvalue}{(-2*\q cm)/(\q-1)}
\draw [line width=1pt,color=ForestGreen](\xvalue + 3pt,\yvalue) -- (\xvalue - 3pt,\yvalue)
;
\draw[color=ForestGreen,parametric,domain=.5:-50,samples=200,smooth]
plot[id=nomogram1-b] function{(0,(-2*t)/(t-1)};
\foreach \q in {.5,0,...,-50}
\pgfmathsetlength{\xvalue}{0 cm}
\pgfmathsetlength{\yvalue}{(-2*\q cm)/(\q-1)}
\draw [line width=1pt,color=ForestGreen](\xvalue + 3pt,\yvalue) -- (\xvalue - 3pt,\yvalue)
;
\end{tikzpicture}
% PLOT DETERMINANT #5.
\begin{tikzpicture}
% Draw axes and grid.
\draw[gray,very thin] (-3.9,-4.9) grid (5.9,6.9);
\draw[line width=2pt,->] (-4,0) -- (6,0) node[right] {\Large $x(t)$};
\draw[line width=2pt,->] (0,-5) -- (0,7) node[above] {\Large $y(t)$};
\fill (0,0) circle (0.064cm);
% Draw first half of q.
\draw[color=blue,parametric,domain=1.2:6,samples=200,smooth]
plot[id=nomogram1-q1] function{t/(t*t+1),(-2*t*t)/(t*t+1)+2};
\foreach \q in {1.5,2,...,6}
\pgfmathsetlength{\xvalue}{(\q cm)/(\q*\q+1)}
\pgfmathsetlength{\yvalue}{(2 cm)/(\q*\q+1)}
\draw [line width=1pt,color=blue](\xvalue + 3pt,\yvalue) -- (\xvalue - 3pt,\yvalue)
;
% Draw second half of q.
\draw[color=blue,parametric,domain=-6:0.8,samples=200,smooth]
plot[id=nomogram1-q2] function{(t*t+t)/(t*t+1)+0.5*(-2*t*t)/(t*t+1),(-2*t*t)/(t*t+1)+2};
\foreach \q in {-6,-5.5,...,.5}
\pgfmathsetlength{\xvalue}{(\q cm)/(\q*\q+1)}
\pgfmathsetlength{\yvalue}{(2 cm)/(\q*\q+1)}
\draw [line width=1pt,color=blue](\xvalue + 3pt,\yvalue) -- (\xvalue - 3pt,\yvalue)
;
% Draw scale for a.
\draw[color=red,parametric,domain=.2:50,samples=200,smooth]
plot[id=nomogram1-a] function{(t+1)/t - 1,0};
\foreach \q in {.5,1,...,50}
\pgfmathsetlength{\xvalue}{(1 cm)/\q}
\pgfmathsetlength{\yvalue}{0 cm}
\draw [line width=1pt,color=red](\xvalue,\yvalue + 3pt) -- (\xvalue,\yvalue - 3pt)
;
\draw[color=red,parametric,domain=-.2:-50,samples=200,smooth]
plot[id=nomogram1-a] function{(t+1)/t - 1,0};
\foreach \q in {-.5,-1,...,-50}
\pgfmathsetlength{\xvalue}{(1 cm)/\q}
\pgfmathsetlength{\yvalue}{0 cm}
\draw [line width=1pt,color=red](\xvalue,\yvalue + 3pt) -- (\xvalue,\yvalue - 3pt)
;
% Draw scale for b.
\draw[color=ForestGreen,parametric,domain=1.5:50,samples=200,smooth]
plot[id=nomogram1-b] function{0,(-2*t)/(t-1)+2};
\foreach \q in {1.5,2,...,50}
\pgfmathsetlength{\xvalue}{0 cm}
\pgfmathsetlength{\yvalue}{(-2 cm)/(\q-1)}
\draw [line width=1pt,color=ForestGreen](\xvalue + 3pt,\yvalue) -- (\xvalue - 3pt,\yvalue)
;
\draw[color=ForestGreen,parametric,domain=.5:-50,samples=200,smooth]
plot[id=nomogram1-b] function{0,(-2*t)/(t-1)+2};
\foreach \q in {.5,0,...,-50}
\pgfmathsetlength{\xvalue}{0 cm}
\pgfmathsetlength{\yvalue}{(-2 cm)/(\q-1)}
\draw [line width=1pt,color=ForestGreen](\xvalue + 3pt,\yvalue) -- (\xvalue - 3pt,\yvalue)
;
\end{tikzpicture}
% PLOT DETERMINANT #6.
\begin{tikzpicture}
% Draw axes and grid.
\draw[gray,very thin] (-3.9,-4.9) grid (5.9,6.9);
\draw[line width=2pt,->] (-4,0) -- (6,0) node[right] {\Large $x(t)$};
\draw[line width=2pt,->] (0,-5) -- (0,7) node[above] {\Large $y(t)$};
\fill (0,0) circle (0.064cm);
% Draw first half of q.
\draw[color=blue,parametric,domain=1.2:6,samples=200,smooth]
plot[id=nomogram1-q1] function{t/(t*t+1),1/(t*t+1)};
\foreach \q in {1.5,2,...,6}
\pgfmathsetlength{\xvalue}{(\q cm)/(\q*\q+1)}
\pgfmathsetlength{\yvalue}{(1 cm)/(\q*\q+1)}
\draw [line width=1pt,color=blue](\xvalue + 3pt,\yvalue) -- (\xvalue - 3pt,\yvalue)
;
% Draw second half of q.
\draw[color=blue,parametric,domain=-6:0.8,samples=200,smooth]
plot[id=nomogram1-q2] function{(t*t+t)/(t*t+1)+0.5*(-2*t*t)/(t*t+1),(-t*t)/(t*t+1)+1};
\foreach \q in {-6,-5.5,...,.5}
\pgfmathsetlength{\xvalue}{(\q cm)/(\q*\q+1)}
\pgfmathsetlength{\yvalue}{(1 cm)/(\q*\q+1)}
\draw [line width=1pt,color=blue](\xvalue + 3pt,\yvalue) -- (\xvalue - 3pt,\yvalue)
;
% Draw scale for a.
\draw[color=red,parametric,domain=.2:50,samples=200,smooth]
plot[id=nomogram1-a] function{(t+1)/t - 1,0};
\foreach \q in {.5,1,...,50}
\pgfmathsetlength{\xvalue}{(1 cm)/\q}
\pgfmathsetlength{\yvalue}{0 cm}
\draw [line width=1pt,color=red](\xvalue,\yvalue + 3pt) -- (\xvalue,\yvalue - 3pt)
;
\draw[color=red,parametric,domain=-.2:-50,samples=200,smooth]
plot[id=nomogram1-a] function{(t+1)/t - 1,0};
\foreach \q in {-.5,-1,...,-50}
\pgfmathsetlength{\xvalue}{(1 cm)/\q}
\pgfmathsetlength{\yvalue}{0 cm}
\draw [line width=1pt,color=red](\xvalue,\yvalue + 3pt) -- (\xvalue,\yvalue - 3pt)
;
% Draw scale for b.
\draw[color=ForestGreen,parametric,domain=1.5:50,samples=200,smooth]
plot[id=nomogram1-b] function{0,(-t)/(t-1)+1};
\foreach \q in {1.5,2,...,50}
\pgfmathsetlength{\xvalue}{0 cm}
\pgfmathsetlength{\yvalue}{(-1 cm)/(\q-1)}
\draw [line width=1pt,color=ForestGreen](\xvalue + 3pt,\yvalue) -- (\xvalue - 3pt,\yvalue)
;
\draw[color=ForestGreen,parametric,domain=.5:-50,samples=200,smooth]
plot[id=nomogram1-b] function{0,(-t)/(t-1)+1};
\foreach \q in {.5,0,...,-50}
\pgfmathsetlength{\xvalue}{0 cm}
\pgfmathsetlength{\yvalue}{(-1 cm)/(\q-1)}
\draw [line width=1pt,color=ForestGreen](\xvalue + 3pt,\yvalue) -- (\xvalue - 3pt,\yvalue)
;
\end{tikzpicture}
\end{document}