Reputation
93,217
Next tag badge:
893/400 score
79/80 answers
Badges
6 248 525
Newest
 graphics
Impact
~1.2m people reached

5h
comment OptionsPattern[] taken as a Replacement Rule
@AlexeyPopkov I wrote it in a confusing way, so you thought that some colons that were just punctuation in the text were actually code. I rewrote it to avoid confusion: I put the code at the beginning of each line.
7h
comment Existence of edge in graph
Hm, actually I was wrong and it turns out that in mixed graphs -> is interpreted as strictly undirected. In directed ones it's interpreted as directed and in undirected ones it's interpreted as undirected.
7h
comment Existence of edge in graph
The way the answer is phrased now seems to imply that -> represents a directed edge but it doesn't ... it could also be undirected.
7h
comment Existence of edge in graph
It would be good to mention the non-obvious property that UndirectedEdge[a,b] (same as a <-> b) tests for an undirected edge only (but not directed), DirectedEdge[a,b] tests for a directed edge only (but not undirected) and Rule[a, b] (same as a -> b and different from DirectedEdge[a,b]) test for either/both. This is important when it is not known beforehand if the graph is directed or if working with mixed graphs. Oh, and this important property is of course not documented ...
12h
comment What's wrong with naming a rule?
I think that Manipulate itself has special support for %, i.e. Out, and expands it as a special case.
12h
comment What's wrong with naming a rule?
I think this is really weird and I don't understand it at all. I can see why the rl version does not work. It is because Manipulate is HoldAll, so its arguments are not evaluated immediately. You'd think that Evaluate fixes this, but it doesn't because it does not appear in the first level inside Manipulate. It is nested within PolarPlot, so it cannot override the HoldAll attribute of Manipulate. But I cannot see any reason why the % version would work!! There is something very strange going on. None of the 'answers' below explain the behaviour at all.
1d
comment Why is `FindCycle` crashing for this graph?
@Andrew M10.4.1 for OS X, it's at the top. @Bob: Since M10.3, most (all?) Graph-processing functions accept a rule list as an alternative graph specification.
1d
comment Why is `FindCycle` crashing for this graph?
I think you should report it to Wolfram even if not everyone can reproduce the crash. Memory corruption bugs don't always result in a crash, but that does not mean that the bug is not there.
1d
comment Why is `FindCycle` crashing for this graph?
Doesn't crash with v10.4.1 on OS X. Anyway, if you see a crash, that's a bug. If you can reproduce it, report to to support: wolfram.com/support
Apr
28
comment How to perform this nth derivative operation in MMA?
Derivative[n][f][s]. But it's not clear at all to me what you are trying to do.
Apr
26
comment Map vs listable
g[{1, {2, 3}, 4, f[x]}] is a good example to include too. This cannot be done with Map at all, not even by mapping at level -1.
Apr
26
comment How to generate higher dimensional convex hull?
@MauricioLobos Well, it just gives you the facets, not anything Mathematica-specific. BoundaryMeshRegion and MeshRegion only support 1D, 2D and 3D regions... I'm not sure how to handle such a thing as a proper region. Maybe instead of that you could convert the constraint to a set of inequalities? Sorry, I don't know enough about what works well for this type of optimization problem ...
Apr
26
comment How to generate higher dimensional convex hull?
Besides Qhull, CGAL also does this. You could consider writing an up-to-date, easy to use LibraryLink interface to one of them ;-)
Apr
26
comment How to use `Except[]` inside of `Pick[]`
Related: mathematica.stackexchange.com/questions/59272/…
Apr
26
comment How to understand the different output of two UnsetShared?
@luyuwuli Yes. A shared variable is always evaluated on the master kernel and is always set on the master kernel. Normally you use DistributeDefinitions (this actually happens automatically with most parallelization functions except ParallelEvaluate), which creates independent copies of symbols on the subkernels.
Apr
26
comment How to understand the different output of two UnsetShared?
@luyuwuli Generally: try to avoid SetSharedVariable and SetSharedFunction because they might slow down your program so much that it will perform worse than the non-parallel version. Yet there are certain cases when these are still useful, e.g. if the subkernels do a very slow piece of computation that might take a few seconds to complete, and at the end of this they report their progress to the master kernel. In most cases that I deal with the performance hit is too much though.
Apr
26
comment How to understand the different output of two UnsetShared?
@luyuwuli Ideally you would design your algorithm in a way that subkernels do not need to communicate with each other at all. They are assigned tasks by the master kernel, they complete the tasks and return the result. But sometimes this is not possible. Some algorithms require communication between the parallel threads. In all cases, this brings a performance hit. In Mathematica it brings a big performance hit. But if the communication is minimized, it might still be worth doing it and parallelization may still provide a speedup.
Apr
26
comment How to understand the different output of two UnsetShared?
This behaviour is new in 10.4 (and I can confirm it with 10.4.1). In 10.3.1 I get only z printed after the first UnsetShared. I smell a bug. Can you contact support and report it to them? If they respond, can you let us know their response?
Apr
25
comment Mathematica Precisions vs Doubles in C/C++
@romanovzky I don't know much about linear algebra software, but I think that Armadillo's results may be influenced by the underlying BLAS/LAPACK implementations. I'm on OS X using it's built-in Accelerate framework (the default for Armadillo). On Linux Armadillo would be using some other BLAS depending on its configuration.
Apr
24
comment ParallelTable and DistributeDefinitions
@EmilioPisanty You know why that is. Describing every corner case is not always the most useful answer to a question.