38,209 reputation
554157
bio website
location
age
visits member for 2 years, 4 months
seen 7 mins ago

May
21
comment Extract a list of all built-in functions used in a notebook
@LaraJordan, ah okay. I only tested it with the simple example in the question.
May
21
comment Extract a list of all built-in functions used in a notebook
Nice. I forgot about Cells...
May
21
comment Get subgraphs: communities of graph g
FYI you can use the notation 1 <-> 2 for undirected edge.
May
21
comment A fast way to compare interval
Finally, I note that this solution relies on checking interval intersections only between adjacent list elements. So for example Tentative7[{{1, 10}, {2, 4}, {6, 8}}] returns {2} instead of {2, 3}. Is this the intended behaviour?
May
21
comment A fast way to compare interval
Secondly, your GIMQ function may be more succinctly written as GIMQ[{{a_, b_}, {c_, d_}}] := a <= c && b >= d
May
21
comment A fast way to compare interval
A couple of points - firstly please be aware that List is a terrible choice of variable name (as you used in LIP) because it is the symbol used by Mathematica as the head of lists. While it doesn't cause any problem here, it is generally good practice to avoid using built-in symbol names for your own variables.
May
21
comment A fast way to compare interval
I'm surprised you find Rasher's and my solutions so slow on a list of length 2000. For me they both take a fraction of a second. Perhaps your ListT is not a packed array. Try evaluating ListT = Developer`ToPackedArray[ListT]; and run the benchmarks again.
May
20
comment Building adjacency matrix from set data
In your example you have a unique symbol for each player and game. When you have thousands of players do you intend to use thousands of symbols? Does the actual data consist of hundreds of expressions like g1 = {p1, p3, p5} ?
May
19
comment How to do memoization together with evaluation of a complicated function
Oops, sorry, missed that. Maybe Function instead: (f[x_] := f[x] = #) &[test[x]]
May
19
comment How to do memoization together with evaluation of a complicated function
How about With[{t = test[x]}, f[x_] := f[x] = t]
May
19
comment A fast way to compare interval
It is still not clear. Please could you include what the result should be for your example ListT and check that the posted code actually generates that result.
May
19
comment How to optimize my code?
Is it necessary to use exact arithmetic? For example try using 20.0 as the radius. By the way you did not include a definition for coordinateList so your code does not run.
May
17
comment Exp is slower for some number ranges
It appears that Exp[I x] slows down for Abs[x] >= 512. The transition is clearer like this: w = ConstantArray[N[I], {5000000}]; t = Table[{n, Timing[Exp[n w]][[1]]}, {n, 510, 514, 0.1}]
May
15
comment How do you add options to a function that is being mapped?
I edited this answer slightly as I felt it was misleading to say that you need to use a pure function.
May
14
comment Drawing pairs (graph, circle packing)
The second version improves things by using constraints to insist that the circles on connected vertices touch each other. The original vertex positions go in as a starting point to FindMaximum, which seeks a local maximum (whereas NMaxmimize looks for a global optimum). It can still give unsatisfactory results, with overlapping circles for non-edges. I think this means that FindMaximum has found a local maximum which is not a global optimum. I guess this could be remedied with more constraints.
May
14
comment Drawing pairs (graph, circle packing)
The original algorithm is not very good - it doesn't constrain the circles on connected vertices to touch, it just attempts to minimize the gaps. At the same time it is trying to minimize the movement of the vertices from their initial positions (which is not really what we want to do). So it reaches a point where it will sacrifice the circle-packing in order to avoid rearranging the vertex positions.
May
11
comment Distribution of 10 points within a unit square
@Mr.Wizard, perhaps with sufficient runs with different random seeds! Otherwise it probably needs someone who really understands numerical optimization. Personally I just treat NMaximize as a black box full of magic.
May
11
comment Simplify with Assumptions Sqrt[(expr)^2]
@Mr.Wizard, I have no experience with it - I just checked the system options to see if there was anything that might be responsible for the behaviour change between 4 and 5 variables.
May
11
comment Distribution of 10 points within a unit square
@RahulNarain, thanks! I've just added your solution to my post.
May
11
comment Contour coloring and (List)ContourPlot projection
You should also consider future visitors to the site. What if someone is searching for how to put a border around streamplot arrows - they probably won't expect to find the answer under a question about "Contour coloring"!