# How to define a variable which is a function of another variables already defined?

Suppose I defined some variables via

\def\n1{some_value_1}
\def\n2{some_value_2}
\def\n3{some_value_3}


and I'd like to have another one, say, \f which is a function of \n1, \n2 and \n3.

This simple code doesn't work:

\def\f{\n1*log(\n2)-\n3}


P.S. This is going to be used in plotting functions via PsTricks (if it helps).

UPDATE: For example (\f is used in \psplot for x_max):

\def\f{\n1*log(\n2)-\n3}
\psplot{0}{\f}{sin(x)}

-

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-plot}
\psset{algebraic,plotpoints=100}

\usepackage[nomessages]{fp}
\FPset\a{3}
\FPset\b{2}
\FPset\c{1}
\FPeval\XMax{round(a*ln(b)-c:3)}
\begin{document}

\begin{pspicture}[showgrid=bottom](-\psPi,-2)(\psPi,2)
\psplot[linecolor=blue]{0}{\XMax}{sin(x)}
\rput[tr](\psPi,2){\textcolor{red}{XMax=$\XMax$}}
\end{pspicture}

\end{document}

-
Thanks! This is EXACTLY what I was looking for. –  Physicsworks Sep 26 '12 at 17:52

The macro names must not contain numbers.

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-plot}
\psset{algebraic,plotpoints=100}

\def\f(#1){#1}
\def\g(#1){sqrt(#1)}
\def\h(#1){\f(\g(#1))}

\begin{document}

\begin{pspicture}[showgrid=bottom](-1,-3)(5,3)
\psplot[linecolor=blue]{0}{5}{\h(x)}
\end{pspicture}

\end{document}

-