# How can I make a slide rule in TikZ?

I have recently found out about slide rules from a Scientific American article and I like them very much. However, I have never got access to a real slide rule. So I made my own slide rule using my printer with the help of this pdf. However, the slide rule that I have made does not have many scales whereas real slide rules like this one, have a lot of scales.

So I thought that maybe I will be able to make a better one using TikZ. I started making it and got stuck here:

\documentclass{article}

\usepackage{amsmath,amsfonts,amsthm}
\usepackage{tikz}
\usepackage[a5paper,margin=0pt]{geometry}

\begin{document}
~\vfill
\centering

\begin{tikzpicture}
\draw (0,0) rectangle (14,20);
\draw (8.75,0) -- (8.75,20);
\draw [dashed] (1.75,0) -- (1.75,20);
\draw [dashed] (7,0) -- (7,20);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\foreach \x in {2,...,18}{\draw (0,\x) -- ++(0.15,0);}
\node [rotate=90] at (0.5,1.5) {C};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{tikzpicture}\\

\vfill
\end{document}


The problem is that I don't know how to make a logarithmic scale in TikZ. So please tell me just the basic syntax to create the logarithmic scale. I will do the rest.

-
They are a thing of beauty (and I can still use one). I inherited my Dad's slide rule, which he used to help design the original heat shield bringing the first object ever back from orbit: drexel.edu/mem/news/archive/… . Funny thing is, when I tutor kids in math, and sometimes bring one along to demonstrate, they look at it like a thing of magic, the way we did when calculators were first introduced. Perspective is an interesting thing. –  Steven B. Segletes Jul 31 at 11:32

Logarithmic ticks can be easily plotted by iterating the function f[n,x]=n+log(x) for n>=0 and 1<=x<=9 where both n and x are integers.

\documentclass[pstricks,border=12pt,12pt]{standalone}
\psset{xunit=3cm}

\def\f(#1,#2){(#1+log(#2))}

\pstVerb{/I2P {AlgParser cvx exec} def}

\begin{document}
\begin{pspicture}(0,-1)(4,1)
\psline[linecolor=blue](4,0)
\psset{linecolor=red}
\foreach \n in {0,...,3}{%
\foreach \i in {1,...,10}{% 10 (instead of 9) is used here to make sure the last line is drawn.
\pstVerb{/xxx {{\f(\n,\i)} exec I2P} def}%
\psline(!xxx -1)(!xxx 1)}}
\end{pspicture}
\end{document}


## Translation to TikZ

\documentclass[tikz,border=12pt,12pt]{standalone}

\def\f(#1,#2){#1+log10(#2)}

\begin{document}
\begin{tikzpicture}
\draw[blue] (0,0) -- (4,0);
\foreach \n in {0,...,3}{%
\foreach \i in {1,...,10}{% 10 (instead of 9) is used here to make sure the last line is drawn.
\draw[red] ({\f(\n,\i)},-1) -- ({\f(\n,\i)},1);}}
\end{tikzpicture}
\end{document}

-
How can i do this in Tikz? –  Kartik Jul 31 at 11:18
I wasted much time to locate the log function in TikZ. It is actually named as log10. –  stalking is prohibited Jul 31 at 11:39
Thanks for the answer. I have made most of it, but can you tell me what formula is used for the sin and cos scale? –  Kartik Jul 31 at 15:13
@Kartik: What does it mean? I don't understand your question. –  stalking is prohibited Jul 31 at 15:40
I was asking that how can I make the "sin" scale on the slide rule. –  Kartik Aug 1 at 6:16