Tag Info

New answers tagged

5

Just for fun: data = {{1, 2}, {3, 1}, {1, 5}, {6, 2}, {7, 3}, {4, 4}, {5, 4}, {0, 0}, {2, 3}, {6, 7}}; g = Cases[ Subsets[data, {2}] /. {{{x_, a_}, {x_, b_}} :> UndirectedEdge[{x, a}, {x, b}], {{a_, y_}, {b_, y_}} :> UndirectedEdge[{a, y}, {b, y}]}, UndirectedEdge[_, _]]; gr = Graph[data, g, VertexLabels -> "Name"] ...


1

I'm going with this, which tranposes the data, finds the unique values for X/Y using union and then selects X, and then Y, points which match each value: With[{tr = Union /@ (data\[Transpose])}, {Cases[data, {#, _}] & /@ First@tr, Cases[data, {_, #}] & /@ Last@tr}] {{{{0, 0}}, {{1, 2}, {1, 5}}, {{2, 3}}, {{3, 1}}, {{4, 4}}, {{5, 4}}, ...


3

Update On reflection I think using ConnectedComponents as referenced in the accepted answer to (4843) and used by ubpdqn in his answer is probably the best approach. Here is my implementation of that idea. fn2[data_] := UndirectedEdge @@@ Partition[#, 2, 1, 1] & /@ GatherBy[data, #] & /@ {First, Last} // Flatten // Graph // ...


0

I post this for illustration. As @Xilin has commented there is a combinatorial explosion from early. If some small number cases are desired and assuming $1\le a_0\le p-1$ and all polynomials of degree $1\le k\le n$, poly[p_?PrimeQ, n_, x_] := PowerRange[1, x^n, x].# & /@ ({##, 1} & @@@ Tuples[({Range[p - 1], ##} & @@ Table[Range[0, p - ...


1

You can do this, it's just that you're going to get a lot of polynomials. If your description of what you want is accurate, it's $(p-1)\times p^{k-1}$ polynomials for each $k$ and add that up for every $k ≤ n$. With $n = 5, p = 7$, you'll get 16806 polynomials. With $n=10, p=11$, the number is $25937424600$.


9

Subsets function takes optional third argument with "standard sequence specification", described for example in details of Take function. Using this third argument you can take subsets "in chunks". For example, following code gives three 5-combinations from positions 90000 to 90002, from all 8250291250200 5-combinations of set of 1000 elements: ...


1

You could also define your own binomial coefficient function, e.g. bn[n_, k_] := Fold[(n - #2 + 1) #1/#2 &, 1, Range[k]] so, Grid[{HoldForm[Binomial[n, #]], bn[n, #]} & /@ Range[0, 8], Frame -> All]


5

Solution of my problem is FunctionExpand[Table[Binomial[n, k], {k, 1, 8}]]



Top 50 recent answers are included