# Tag Info

7

A brute force solution is to check all possible values of this function. num = {1/10, 1/2, 4/7, 3/5, 2/3}; pow = {0, 1, 2, 3, 4}; To obtain value for one combination use the Inner function Inner[Power, num, pow, Plus] (* => 2222701/992250 *) Then we apply function Inner[Power, num, #, Plus]& on all permutations prm = Permutations[pow]; val = ...

6

We can use one of the zeroCrossing functions from the answers to this question to construct solutions to where an ordered list of points representing a curve crosses a surface $f(x,y,z)=0$. There are some very nice answers to the linked question with good explanations of the solutions. Use one that returns an interval of indices where the crossing takes ...

5

If you want to find the position of something in a given expression, you should use Position. In this example, you could simply write: Position[{1, 2, {}, {}, 3, 5}, {}] (*{{3}, {4}}*) I have to mention that this not the whole power of Position: the second parameter of Position can be a "pattern"(which may be not known by a matlab coder:)), look up the ...

4

An answer has been given in the comments to the OP, but I will elaborate on it a little. I will make use a reduced data set to make this answer a little more concise. a = Table[{a x1 + b x2 + c x1, a y1 + b y2 + c y1, a z1 + b z2 + c z1}, {a, -1, 1}, {b, -1, 1}, {c, -1, 1}]; This produces a list of depth 4: ArrayDepth[a] 4 but what is wanted as ...

4

Let's demonstrate quite a straightforward approach: With[{ lst = #1^0 + #2 + #3^2 + #4^3 + #5^4 & @@@ Permutations[{1/10, 1/2, 4/7, 3/5, 2/3}]}, Position[lst, Max @ lst]] {{12}} Permutations[{1/10, 1/2, 4/7, 3/5, 2/3}][[12]] {1/10, 4/7, 2/3, 3/5, 1/2} #1^0 + #2 + #3^2 + #4^3 + #5^4 & - a pure function of 5 variables, an ...

4

A variation: mySet = {1/10, 1/2, 4/7, 3/5, 2/3}; perms = Permutations[mySet]; powersums = Total[Transpose @ perms^Range[0, 4]]; Extract[perms, Position[powersums, Max[powersums]]] {{1/10, 4/7, 2/3, 3/5, 1/2}} Another variation (beware: slower on large sets): Last @ Sort @ With[{perms = Permutations[{1/10, 1/2, 4/7, 3/5, 2/3}]}, ...

3

Too long for a comment... One can treat it as an integer nonlinear program. I've not proved this in elaborate detail, but I believe it remains a correct formulation when we relax the integrality constraint, as I do below. This is, I will say, FAR slower than even brute-force enumeration. It has the possible advantage of generalizing to cases where brute ...

2

Many functions work with lists (what you call sets) just as well as numbers. s = {1/10, 1/2, 4/7, 3/5, 2/3}; p = Range[0, 4]; perm = Permutations[s]; totals = Total[#^p] & /@ perm; maxPos = First[Flatten[Position[totals, Max[totals]]]] perm[[maxPos]] In the totals step, we do the $S_{i}\hat{}p_{i}$ calculation for all the permutations of the list $S$. ...

Only top voted, non community-wiki answers of a minimum length are eligible