In some mathematical figures it's nice to vary curve thickness smoothly along a path. That's for reproducing hand drawn mathematical figures made with inking liners.

\documentclass{article}\usepackage{tikz}
\def\ltrstroke #1,#2 #3,#4 #5,#6 #7,#8%
{\foreach \n in {0,0.01,0.02,...,0.09}{\path[line width=1pt,rounded corners=48pt,line cap=round,draw]%
(#1+\n/1,#2+\n/1)--(#3+\n/4,#4+\n/4)--(#5+\n/3,#6-\n/3)--(#7+\n/4,#8-\n/4);}}
\def\ltrinking #1,#2 #3,#4 #5,#6 #7,#8%
{\foreach \n in {0,0.01,0.02,...,0.09}{\path[line width=2pt,rounded corners=48pt,draw]%
(#1+\n/.4,#2+\n/.4)--(#3+\n/.6,#4+\n/.6)--(#5+\n/1,#6-\n/1)to[bend left](#7+\n/4,#8-\n/4)--cycle;}\path[line width=2pt,rounded corners=48pt](#1,#2)--(#3,#4)--(#5,#6)to[bend left](#7,#8)--cycle;}
\begin{document}\begin{tikzpicture}[bend angle=8];
\ltrinking 0,0 4,4 8,3 4,-1
\ltrstroke 0,5 0.2,5.2 3,8 2,6
\end{tikzpicture}\end{document}
One procedure which does that simply flares path coordinates by adding deviations in multiples. These increase or decrease depending where on the line they are. Also this is done recursively over a set of deviations. We plot the many overlapping curves. The result is shown above.
QUESTION: The problem is
\defaccepts <10 inputs. So how do I extend\deffor arbitrary even number of arguments >10 that is a multiple of another number? We require this to control lines in such drawings. Eachxandyargument is separately transformed by the for each loop as a function of the hand fixed numerical parametersps.
Please suggest how to input the coordinates in a tuple form, not in a form {x1}{y1}{p1}{x2}{y2}{p2}... That becomes confusing when all the inputs are given numbers and the curve is edited, and it becomes ambiguous if errors are input made. Treat |x,y,p| as one argument, extract the x and y and p.
The pens do make paths of varying width in TeX plus MetaPost:

\documentclass{article}\usepackage[shellescape,latex]{gmp}
\begin{document}\begin{figure}\centering\begin{mpost}
pen mypen; mypen = pencircle scaled 1in xscaled .08 yscaled .32 rotated 180;
pickup mypen; draw (0,0)..(100,-32)..(192,192)..(256,64);
\end{mpost}\caption{testing}\end{figure}\end{document}
Tikz is more convenient for combining this with equation work and outputs this faster. It also allows treating parts of other outputs as graphic nodes and has powerful libraries. Metapost works best with equation defined pens and curves, or if the ends of the curves need to be sharp and rotated. However, the bezier parameters for each thick pen turn requires tweaking that covaries with each curve. My implementation here requires tweaking at most one parameter.
The n-argument macro from the answer to this question is great. I tried to generalize the answer in this usage; but the commented out version gives undefined control sequence error. The noncommented version works; the \csname x{#1} \endcsname code is probably not valid. What does one replace it with?

\documentclass{article}\usepackage{tikz}
\newcount\tmpnum
\def\scanargs #1#2#3;{\let\tmp=#1\tmpnum=0 \scanargsA #3|,,|}
\def\scanargsA #1,#2,#3|{\ifx,#1,\expandafter\tmp \else
\advance\tmpnum by1
\expandafter\def\csname x:\the\tmpnum\endcsname{#1}%
\expandafter\def\csname y:\the\tmpnum\endcsname{#2}%
\expandafter\def\csname z:\the\tmpnum\endcsname{#3}%
\expandafter\scanargsA \fi}
\def\x#1{\csname x:#1\endcsname}
\def\y#1{\csname y:#1\endcsname}
\def\z#1{\csname z:#1\endcsname}
\def\arcpart#1{({\csname x#1 \endcsname}+\n/{\csname z#1 \endcsname},{\csname y#1 \endcsname}-\n/{\csname z#1 \endcsname})\to}
\def\ltrinking{\foreach \n in {0,.01,.02,...,1}{%
\path[line width=2pt,rounded corners=48pt,draw]%
(\x1+\n/\z1,\y1+\n/\z1)--(\x2+\n/\z2,\y2+\n/\z2)--(\x3+\n/\z3,\y3-\n/\z3)--(\x4+\n/\z4,\y4-\n/\z4)--(\x5+\n/\z5,\y5-\n/\z5)--(\x6+\n/\z6,\y6-\n/\z6)--cycle;%
}}
\begin{document}\begin{tikzpicture}[bend angle=8];
\scanargs\ltrinking|0,8,3|5,4,1|16,9,4|8,4,1|5,1,4|4,-8,1;
% \scanargs\ltric|7,0,0|0,8,3|5,4,1|16,9,4|8,4,1|5,1,4|4,-8,1;
\end{tikzpicture}\end{document}



(x1,y1), you could just use another TikZ\foreachcouldn't you? – cfr May 04 '15 at 00:55metapost? – cfr May 04 '15 at 00:57metapostyou can use pens and get varying thickness automatically so no workarounds of the sort needed in TikZ are required. I mentioned the(,)syntax because a TikZforeachloop will handle that syntax specially i.e. it will automatically treat those as coordinates. [Page 910 of the manual says] 'When a list item starts with a(everything up to the next)is made part of the item.' – cfr May 04 '15 at 01:14calclibrary to add coordinates so that you don't need to worry about splitting the pairs. – cfr May 04 '15 at 01:17penposinstruction, i.e. using pen strokes instead of picking up a particular pen as you did. As soon as I have more time, I will have a go at it (if nobody does it before me, of course). In the meantime, you can see Thrustron's answer to this subject: http://tex.stackexchange.com/questions/192668/union-of-paths-in-metapost/237617#237617 – Franck Pastor May 04 '15 at 14:45