0
$\begingroup$

I'd like to ask you guys what is the best way to write a function having a sequence of arguments?

If a function has $x$ and $y$ as its arguments then we write, $$ f\left(x,y\right) $$ What if we have a function that takes $x_i$, $\forall i=1,\cdots,N$ ? I can try $$ f\left(\mathbf x\right), $$ where $\mathbf x = [x_1, x_2, \cdots, x_N]^\mathsf T$.

How about that $f$ takes $\mathbf x_i$, $\forall i=1,\cdots,N$ ? Is it just okay that $$ f\left(\mathbf x_i\right), \forall i=1,\cdots,N ? $$

Otherwise, $$ f\left(\mathbf X\right), $$ where $\mathbf X = [\mathbf x_1,\mathbf x_2, \cdots, \mathbf x_N]^\mathsf T$.

But, I don't like to introduce a new symbol $\mathbf X$, and even in the function $f$, the $\mathbf x_i$s are manipulated individually not all together as a matrix, e.g., $$ f\left(\mathbf x_1, \mathbf x_2, \cdots, \mathbf x_N\right) = \sum_{i=1}^N \sigma\left(\mathbf W\mathbf x_i + \mathbf b\right), $$ something like that.

Listing all the arguments as above is too verbose to me. Which way do you prefer to write a function like that? 😎

$\endgroup$
2
  • 1
    $\begingroup$ Have you considered writing $f:(\mathbb R^N)^N\to \mathbb R^N$? $\endgroup$ May 14 at 4:28
  • $\begingroup$ @JackozeeHakkiuz Yes, of course. The first introduction of $f$ can be written in that way. But, how about when I define $f$ explicitly, what $f$ takes specifically and which operations are applied to those arguments? I need some simple and neat ways to do it. $\endgroup$
    – Minsik Seo
    May 14 at 15:21

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.