# 10 parameters separated by comma. How can I do it? [duplicate]

\def\g(#1,#2,#3,#4,#5,#6,#7,#8,#9,#10){(#6)*exp(-(#2)/(#7))+((#6)**2)*exp(2*(-(#2))/(#7))*(#9)*exp((#4)/(#7)}%

\def\f(#1,#2,#3,#4,#5,#6,#7,#8,#9,#10){1+2*(#6)*exp(-(#2)/(#7))+((#6)**2)*exp(2*(-(#2))/(#7))*exp((#4)/(#7))}%

\def\h(#1,#2,#3,#4,#5,#6,#7,#8,#9,#10){2*(#10)*exp(-(#1)/(#7)) +exp( (#3)/(#7) )*( (#10)*exp(-(#1)/(#7) ) )^2 + 2*(#6)*exp(-(#2)/(#7))*(#10)*exp(-(#1)/(#7) )*exp((#5)/(#7)) }%

\def\v(#1,#2,#3,#4,#5,#6,#7,#8,#9,#10){( \g(#1,#2,#3,#4,#5,#6,#7,#8,#9,#10) + (#6)*exp(-(#2)/(#7))*(#10)*exp(-(#1)/(#7))*(#8)*exp((#5)/(#7)) )/(\f(#1,#2,#3,#4,#5,#6,#7,#8,#9,#10) + \h(#1,#2,#3,#4,#5,#6,#7,#8,#9,#10) )}}

\begin{tikzpicture}

\begin{axis}

domain=0.0001:1,samples=300, line width=1]
gnuplot { \v(0,(-10),0,0,0,x/10^3,1,1,1,1) }

\end{axis}

\end{tikzpicture}

\end{document}


## marked as duplicate by Werner, Bobyandbob, user121799, Stefan Pinnow, user31729 Feb 3 '18 at 6:54

• I tried that way and it didnot match the definition when a try to use \v – Thales Souza Freire Feb 2 '18 at 21:50
• Unfortunately that doesn't help. You need to show what you've tried. – Werner Feb 2 '18 at 21:54
• the code above is exactly how i tried – Thales Souza Freire Feb 2 '18 at 21:59
• @ThalesSouzaFreire That code can't work. Can you please add what the four functions should do with the ten parameters? Just pretend that #10 can be used. Add it at the bottom of your question. – egreg Feb 2 '18 at 22:02
• The question was edited – Thales Souza Freire Feb 2 '18 at 22:26

The idea is to do something like

\documentclass{article}
\usepackage{xparse,pgfplots}

\ExplSyntaxOn
\NewExpandableDocumentCommand{\E}{mm}
{
\clist_item:nn { #1 } { #2 }
}
\ExplSyntaxOff

\NewExpandableDocumentCommand{\funcg}{m}
{
(\E{#1}{6})*exp(-(\E{#1}{2})/(\E{#1}{7}))+((\E{#1}{6})**2)*
exp(2*(-(\E{#1}{2}))/(\E{#1}{7}))*(\E{#1}{9})*exp((\E{#1}{4})/(\E{#1}{7})
}

\NewExpandableDocumentCommand{\funcf}{m}
{
1+2*(\E{#1}{6})*exp(-(\E{#1}{2})/(\E{#1}{7}))+((\E{#1}{6})**2)*
exp(2*(-(\E{#1}{2}))/(\E{#1}{7}))*exp((\E{#1}{4})/(\E{#1}{7}))
}

\NewExpandableDocumentCommand{\funch}{m}
{
2*(\E{#1}{10})*exp(-(\E{#1}{1})/(\E{#1}{7})) +
exp( (\E{#1}{3})/(\E{#1}{7}) )*( (\E{#1}{10})*exp(-(\E{#1}{1})/(\E{#1}{7}) ) )^2 +
2*(\E{#1}{6})*exp(-(\E{#1}{2})/(\E{#1}{7}))*(\E{#1}{10})*exp(-(\E{#1}{1})/(\E{#1}{7}) )*
exp((\E{#1}{5})/(\E{#1}{7}))
}

\NewExpandableDocumentCommand{\funcv}{m}
{
(\funcg{#1} + (\E{#1}{6})*exp(-(\E{#1}{2})/(\E{#1}{7}))*
(\E{#1}{10})*exp(-(\E{#1}{1})/(\E{#1}{7}))*(\E{#1}{8})*exp((\E{#1}{5})/(\E{#1}{7})) )/
(\funcf{#1} + \funch{#1} )
}

\begin{document}

\begin{tikzpicture}
\begin{axis}
gnuplot { \funcv{0,(-10),0,0,0,x/10^3,1,1,1,1} };
\end{axis}
\end{tikzpicture}

\end{document}


where \E{#1}{<number>} stands for your #<number>.

Check the function definitions, because I get a gnuplot error; the expanded version seems to be

( (x/10^3)*exp(-((-10))/(1))+((x/10^3)**2)* exp(2*(-((-10)))/(1))*(1)*exp((
0)/(1)  + (x/10^3)*exp(-((-10))/(1))* (1)*exp(-(0)/(1))*(1)*exp((0)/(1)) )/ ( 1
+2*(x/10^3)*exp(-((-10))/(1))+((x/10^3)**2)* exp(2*(-((-10)))/(1))*exp((0)/(1))
+  2*(1)*exp(-(0)/(1)) + exp( (0)/(1) )*( (1)*exp(-(0)/(1) ) )^2 + 2*(x/10^3)
*exp(-((-10))/(1))*(1)*exp(-(0)/(1) )* exp((0)/(1))  )