1,342 reputation
524
bio website
location United States
age
visits member for 2 years, 10 months
seen 12 hours ago

Oct
25
comment Can mathematica simplify an expression setting simplified answer equal to zero?
Perhaps this is what you are looking for? Is is possible to have mathematica move all terms to one side of an equation?
Oct
6
comment Factorisation diagrams
This reminds me of Richard Schwartz's book You Can Count on Monsters.
Sep
17
comment Image of input and output cells is not exported correctly
@halirutan On my machine, the drop-down menu works as expected.
Aug
19
comment Plot Log scale on X-Axis?
Is LogLinearPlot what you are looking for?
Aug
19
comment Determining all possible traversals of a tree
@Andrew We can also replace the first definition of f by f[tree_List] := List@@@Flatten@Apply[lst, f[{}, tree], {-2}];. Now f will work for {423,{53,66,424}} as well as {423, {{53, {39, {66, {67, 81, 423}}, 423}}, {66, {67, 81, 423}}, {424, {25, 40, 423}}}}.
Jul
3
comment Convert head Times to List
I am just wondering if you have a rule of thumb to recognize when to use Hold as opposed to Unevaluated.
Jul
3
comment Convert head Times to List
Generally. I know that Unevaluated dissolves after we pass it through a function, but are there other considerations to keep in mind?
Jul
3
comment Convert head Times to List
When should we use Unevaluated as opposed to Hold?
Jun
28
comment Mathematica for Computer Scientists
Gray's "Mastering Mathematica" has a nice chapter on rule-based programming followed by a discussion of substitution and Lambda calculus, so you may want to check that out.
Jun
18
comment Implementing a function which generalizes the merging step in merge sort
I am still developing my feel for efficient programs, so it helps to look at other implementations even if they are not the fastest possible. Leonid's commentary also adds value to your answer. +1
Jun
17
comment Implementing a function which generalizes the merging step in merge sort
I think I know what is going on now. There is some caching going on in the previous section, thus the comment on clearMergeJITCache.
Jun
17
comment Implementing a function which generalizes the merging step in merge sort
You evaluated mergeList[huge1,huge2,Less,CompileToC -> True]//Short//AbsoluteTiming twice at the beginning of the Benchmarks section, but the timing results are significantly different. Am I missing something here?
Jun
17
comment Implementing a function which generalizes the merging step in merge sort
The difference in performance is astounding: 0.12s vs 1.23s for lists of lengths 10000 and 1.13s vs 146.60s for lists of length 100000. I find it reassuring that even without making significant changes to the straightforward recursion, I can get major performance boost by switching to linked lists. Perhaps reading The Little Schemer did not cause too much harm.
Jun
17
comment Implementing a function which generalizes the merging step in merge sort
@Rojo Thanks for pointing out the ambiguity. I edited the question.
Jun
17
comment Implementing a function which generalizes the merging step in merge sort
@Rojo For MergeList, the two lists need not be sorted. For example, MergeList[{2, 5, 1}, {3, 4}, LessEqual] evaluates to {2, 3, 4, 5, 1}.
Jun
15
comment How to substitute numeric values in a symbolic Jacobian matrix?
+1 for explaining what went wrong in M.J.'s code and the use of ArrayRules + ArrayPlot.
Jun
14
comment How to substitute numeric values in a symbolic Jacobian matrix?
@J.M. I did not know that variables for D need not be a symbol. This is good to know.
Jun
13
comment Interprocedural optimization
It is possible to compute PrimePi[n] without enumerating all prime numbers less than $n$. See for example Lehmer's recursive formula.
Jun
13
comment Checking if the roots of a function are real
You can try checking that the imaginary part is zero. We can get the list of roots using x /. {ToRules[Reduce[LegendreP[6, x] == 0, x]]}. Then we map Im to each root using Map[Im,%], which gives {0,0,0,0,0,0}. This seems to suggest that the roots are real, but I am not 100% sure.
Jun
13
comment Splitting a list
@BrettChampion At one point I made a list of things I liked about Mathematica, and it included the fact that everything is an expression. Lisp popped up when I researched the roots of this feature. On a related note, that book really did teach me to write recursions! (Always ask null?, etc.)