I don't think a chain is the correct type for your diagram. You can however position the nodes manually. The `positioning`

library provides some advanced positioning keys.

Please also don't misuse mathmode to get italic text. Use `\textit`

for that. You can use math supscript for the index only or use `\textsubscript`

(needs to `fixltx2e`

package).

```
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[rounded corners=2pt,inner sep=5pt,node distance=.8cm]
\node [draw](client) {\textit{Client}};
\node [draw,below=of client] (server) {\textit{Job server}};
\node [inner sep=0pt,below=of server] (aux) {\strut};
\node [draw,left=.4cm of aux] (worker2) {\textit{Worker$_2$}};
\node [draw,right=.4cm of aux] (worker3) {\textit{Worker$_3$}};
\node [draw,left=of worker2] (worker1) {\textit{Worker$_1$}};
\node [draw,right=of worker3] (worker4) {\textit{Worker$_4$}};
\draw [<->] (client) -- (server);
\foreach \n in {1,...,4}
\draw [<->] (server) -- (worker\n.north);
\end{tikzpicture}
\end{document}
```

There are a couple of things you've gotten wrong. First of all, as marsupilam says in a comment, you have to plot the function as well, not just declare it.

Second, you can't use `\frac`

, `\pi`

etc. when declaring functions. They are macros intended for *typesetting* math, to do a calculation write it like e.g. `pi/2`

.

```
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
%\pgfplotsset{compat=1.8}
\begin{document}
\begin{tikzpicture}[
declare function={
func(\x)= (\x < -pi/2) * (0) +
and(\x >= -pi/2, \x < pi/2) * (pi/2-abs(\x)) +
(\x >= pi/2) * (0)
;
}
]
\begin{axis}[
axis x line=middle, axis y line=middle,
ymin=-5, ymax=5, ytick={-5,...,5}, ylabel=$y$,
xmin=-5, xmax=5, xtick={-5,...,5}, xlabel=$x$,
domain=-pi:pi,samples=101, % added
]
\addplot [blue,thick] {func(x)};
\end{axis}
\end{tikzpicture}
\end{document}
```

## Best Answer

Compile the following code with

`xelatex`

or a combo sequence`latex-dvips-ps2pdf`

.## Explanation

`\usepackage{pst-plot}`

.To get a tight page, use

Define a canvas on which you draw.

`(-4.25,-1.25)`

represents the bottom left point of your canvas and`(4.25,2.25)`

is the top right point.Define the function to plot.

In this example I chose

`y=sin(2x)+1/2`

.Draw the coordinate axes.

Plot the graph.

Put a label if necessary.

In PSTricks, we can specify a point in several ways.

`(*<x-value> {the value of expression in x for the given x})`

is one of them. Thus`(*1 {\f(x)+0.5})`

mathematically means a point`(x,y)`

where`x=1`

and`y=f(1)+0.5`

.Compile the input file with xelatex or the combo sequence latex-dvips-ps2pdf.

Done!

## Miscellaneous

The

`plotpoints`

can be used to increase the number of points used to plot the graph. But be wise, the greater its value is, the smoother the plot is but the bigger the file size becomes. For most extreme case,`plotpoints=1000`

should be more than enough.The first and second arguments of

`\psplot`

can accept RPN notation. In the example above, I used`-π-.5`

and`π+.5`

for both args, respectively. PSTricks gives you many good features, right?