Sometimes I want to use a function like f(x,y,z,w), where x,y,z,w are themselves vectors of potentially different lengths. But sometimes when I call solvers (e.g. NLSolve, Optim, Implicit Differentiation, JuMP) or other functions from packages, they want me to pass in a function with just one argument or perhaps 2 arguments, but I think not, say, 4 arguments.
What is the recommended way to deal with this? I could join x,y,z,w into one big vector using vcat and then pass it into the solvers as a single argument, but then it might be annoying to have to keep track of which part parts of the concatenated vector correspond to which of the four initial vectors.
I know this is a broad question, but does anyone have suggestions on this? Thanks
ArrayPartition from RecursiveArrayTools is a nice way to handle this. It behaves like the concatenated array but allows access to the original arrays by property name.