# Multidimensional plot of output value over all possible combinations of input variables in mathematica

In Mathematica I have a self-defined function in Mathematica:

outputval = myfunc[v1, v2, v3, v4, v5, v6, v7, v8, v9]


When the function is called as above with numeric values for the input variables, it outputs a single output value.

For each input variable I have 5 different values. I want to input all combinations of all 5 values of the 9 input variables in my function and plot them in a multidimensional space. If this problem space is too big, I could drop a few variables (set them fixed), but I would like to explore how the input variables relate to each other.

Could anybody help me as I have no idea how to do so. Thank you in advance!

• Look in the documentation for Tuples – user48983 Jun 27 '17 at 17:52

## 2 Answers

From the comments above it seems what you wanted

 list = {{0.1, 0.5, 0.9}, {10, 20, 60, 80, 100}}

comb = Tuples@list

output = Table[
myfunc[v1, v2] /. {v1 -> comb[[i, 1]], v2 -> comb[[i, 2]]}, {i, 1,
Length@comb}]


Tuples[] will always generate a list of all possible n-tuples, regardless of whether the lists do not have the same number of elements.

I reduced the problem to two variables, for purposes of computation, but you can generalize to as many variables as you need.

output = myfunc[v1, v2]

list = Table[{Subscript[a, i], Subscript[b, i], Subscript[c, i],
Subscript[d, i], Subscript[e, i]}, {i, 1, 2}]

comb = Tuples@list

Table[output /. {v1 -> comb[[i, 1]], v2 -> comb[[i, 2]]}, {i, 1,
Length@comb}]


I think that's what you want.

• What if the number of numerical values per variable are not equal? So let's say for example for v1 I have values {0.1,0.5,0.9} and v2 I have {10,20,60,80,100}. How to I evaluate the different combinations of these values in my function? Als the desired output is a list with all output values, for each combination of input values. How can I achieve this? – Peter Lawrence Jun 28 '17 at 8:15
• If my answer solved your problem, it would be great if you accepted the answer. – user48983 Jun 28 '17 at 16:59