Why?
This is a serious question, preliminary to a discussion. My answer?
If it is a subscript, input it as a subscript!
With
\DeclareMathOperator{\logistic}{lgc}
you'd use
\logistic_{n,P_0,k}
and you're just following the standard input conventions.
An alternative would be as Mico suggests:
\NewDocumentCommand{\logistic}{o}{%
\operatorname{lgc}\IfValueT{#1}{_{#1}}%
}
where you'd input
\logistic[n,P_0,k]
But where's the advantage over the direct conventional input described above?
OK, if you insist in nonstandard and confusing syntax,…
\documentclass{article}
\usepackage{amsmath}
\ExplSyntaxOn
\NewDocumentCommand{\logistic}{}
{
\group_begin:
\operatorname{lgc}
\__koudas_lgc_grab:
}
\seq_new:N \l__koudas_lgc_seq
\cs_new_protected:Nn \__koudas_lgc_grab:
{
\peek_meaning:NTF \c_group_begin_token
{% start the recursion
\__koudas_lgc_grab_next:n
}
{
\__koudas_lgc_grab_end:
}
}
\cs_new_protected:Nn \__koudas_lgc_grab_next:n
{
\seq_put_right:Nn \l__koudas_lgc_seq {#1}
\__koudas_lgc_grab:
}
\cs_new_protected:Nn \__koudas_lgc_grab_end:
{
\seq_if_empty:NF \l__koudas_lgc_seq { \sb{ \seq_use:Nn \l__koudas_lgc_seq {,} } }
\group_end:
}
\ExplSyntaxOff
\begin{document}
$\logistic(x)$
$\logistic{n}(x)$
$\logistic{n}{P_0}(x)$
$\logistic{n}{P_0}{k}(x)$
$\logistic{n,P_0,k}(x)$
\end{document}
Look at the last two lines: if you really think that inputting
\logistic{n}{P_0}{k}(x)
is clearer and easier than
\logistic{n,P_0,k}(x)
go for it. If this example convinces you that the latter is better, then, why not forget about all the peeks and recursion? Just use
\logistic_{n,P_0,k}(x)
as suggested at the beginning with the simple definition
\DeclareMathOperator{\logistic}{lgc}
{}
is generally not recommend as it is very confusing to users.