Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Favorites infavorites:mine
infavorites:1234
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with Search options user 3246

Questions on the manipulation of List objects in Mathematica, and the functions used for these manipulations.

3
votes
Of the solutions so far, those based on IntegerPartitions by @Xavier and @march are orders of magnitude faster than those based on Tuples (@djphd and @eldo). Just for interest, the following method ba …
answered Dec 3 '15 by KennyColnago
1
vote
You could use the code HilbertCurve3D[n] by Michael Trott (page 93 of The Mathematica Guidebook for Programming) from this question. Given input n, the function returns $2^{3n}$ orderly points within …
answered Jan 8 by KennyColnago
15
votes
Because your selector is 0 or 1, SplitBy can be used as follows. Select[SplitBy[mylist*selector, Positive], #[[1]] > 0 &]
answered Nov 28 '15 by KennyColnago
3
votes
Hector can beat his own code with: HectorSymms[n_Integer?Positive]:=Flatten[Table[Thread[{i,Range[i,n-i]+1}],{i,1,n/2}],1] On my system, the timing forfasterSymms[1351]is 0.233s, whileHectorSymms[1 …
answered Nov 20 '13 by KennyColnago
1
vote
Late, but a slightly different approach avoidingSquareFreeQ, PrimeOmega, and PrimeNu. See Sloane's A143658, the number of squarefree integers not exceeding $2^n$. Fast, since the sum is only to the sq …
answered Nov 13 '13 by KennyColnago
3
votes
Something with rules: Partition[{a, b, c, d, e, f, g, h, i}, 3] /. {x_, y_, z_?AtomQ} -> {{x, y}, z}
answered Aug 25 '15 by KennyColnago
5
votes
Pick is typically faster than Select. On large lists, I would recommend Pick[list, Total[Mod[Total[list, {2}], 2], {2}], 0] which is 10 or 20 times faster than these variations. Select[list, Mod[T …
answered Mar 9 '18 by KennyColnago
2
votes
You could use Pick and UnitStep as follows: index = Pick[Range[Length[a]], UnitStep[10 - a], 0]
answered Aug 31 '16 by KennyColnago
7
votes
Pick is usually fast, and parallel processing may help, depending on your computer. ParallelTable[Total[Pick[values, indices, k]], {k, Union[indices]}]
answered Feb 20 '17 by KennyColnago
4
votes
This is a small version of a PE problem which asks for counts of certain solutions. If the OP is interested, there is a generating function approach to finding such counts. Consider the product of bin …
answered Oct 29 '13 by KennyColnago
4
votes
A double Transpose might be considered "beautiful", and it certainly can be very fast too. Transpose[Transpose[{{-1, 0}, {1, 0}, {0, -1}, {0, 1}}] + {a, b}]
answered Apr 21 '16 by KennyColnago
1
vote
The prime factors of an input integernare returned byFactorIntegerin the first positions of a list of pairs. The second position in each pair is the exponent of the corresponding prime, which you want …
answered Mar 17 '14 by KennyColnago
6
votes
Using v10.4.1, Reduce returns 2^17=131072 solutions beginning with these 5. With[{a = 7946761, m = 130356633908760178920}, x /. {ToRules[Reduce[x^2 == a, x, Modulus -> m][[Range[5]]]]}] (* {28 …
answered Oct 17 '16 by KennyColnago
9
votes
Check out the answer here, by @s0rce and @DanielLichtblau, for an ingenious use of FrobeniusSolve. KnapsackLikeProblem[list_List, n_Integer] := With[{s = FrobeniusSolve[list, n]}, Map[Flat …
answered Nov 13 '16 by KennyColnago
3
votes
I think your sol is trying to find the Lagrange points of the system. As pointed out, NSolve can fail to give all 5 Lagrange points. Use LagrangePoints[m] below to get solutions for all 5 points, rega …
answered Dec 8 '15 by KennyColnago

15 30 50 per page