Reputation
59,998
Next tag badge:
228/100 score
17/20 answers
Badges
7 106 237
Newest
 Good Answer
Impact
~835k people reached

Jan
26
comment What is the fundamental difference between “PlotPoints” and “MaxRecursion”?
FYI the documentation for Plot states it fairly clearly - "Plot initially evaluates f at a number of equally spaced sample points specified by PlotPoints. Then it uses an adaptive algorithm to choose additional sample points, subdividing a given interval at most MaxRecursion times. "
Jan
25
comment Erroneous color function for ContourPlot when the function has a small positive region and the PlotRange is specified manually
The problem can be reproduced using e.g. 0.05 - 0.005 (x^2 + y^2) as the function to be plotted.
Jan
22
comment Subset-type function construction
Yes please leave it open for a day or so, this sort of question is usually very popular and it will be good to see alternative approaches.
Jan
22
comment Subset-type function construction
FYI in your original code Flatten[{#[[1]] -> #[[2]]} & /@ Transpose@{c, a}] can be written more succinctly as Thread[a -> c]
Jan
22
comment Subset-type function construction
Looks like we had similar ideas for a fix :-)
Jan
22
comment Finding mean brightness, standard deviation, count of pixels in gray scale images
All good points of course.
Jan
22
comment Finding mean brightness, standard deviation, count of pixels in gray scale images
The slowest part is probably importing the images. For the single image case the OS will cache the file in memory so repeated timings will be faster.
Jan
18
comment ReplaceAll behavior change from 10.2 to 10.3
See this for some more on RuleCondition
Jan
18
comment ReplaceAll behavior change from 10.2 to 10.3
Looks like a bug to me. Other workarounds would be forcing evaluation at replacement time using RuleCondition[a + b] as the RHS of the rule, or afterwards using eg Map[Identity, replace[l1], -1]
Jan
16
comment Plot contour lines on a sphere
@MichaelE2, thanks, I hadn't spotted that.
Jan
16
comment How does Mathematica calculate $\sin(\pi/5)$?
Have a look here
Jan
16
comment Plot contour lines on a sphere
The parameters theta and phi are #4 and #5 in the mesh function.
Jan
11
comment Why do Plot and ParametricPlot handle PlotStyle differently?
I don't think nested lists are a documented syntax for Plot or ParametricPlot, so I'm not sure that you can consider one behaviour correct or the other incorrect. They are different functions and they handle unsupported inputs differently. IMO flattening the lists is the correct approach.
Jan
11
comment Why does the function Image not yield a proper output?
@george2079, or ToExpression@ToBoxes@TreeForm@{1, 2, 3}
Jan
9
comment Compilation error: “Could not complete external evaluation at…”
The Compile is fine, but you only need to compile once. f = Compile[...] then use f in Meaner2. Also what size is the array?
Jan
9
comment Compilation error: “Could not complete external evaluation at…”
A quick observation - you are running the C compiler each time Meaner2 is called.
Jan
7
comment How to make FlattenAt work with Span?
You could use List /@ Range[Length@li][[sp]] to accommodate All and negative positions in the span.
Jan
5
comment For-loop function problem
You might want to check out FixedPoint as a replacement for the While loop.
Jan
4
comment For-loop function problem
I'm voting to close this question as off-topic because the code implements an infinite loop and therefore running indefinitely is the correct behaviour.
Jan
4
comment For-loop function problem
This is not a problem with memory or with Mathematica's loop functions. The problem is that your code contains a While loop which terminates only when dE <= endPoint, a condition which is never true for the k=13924 point in trueAnomaly[3*58944, 58944, 0.8]. At this point instead of converging to a single fixed value, e1 stabilises on a cycle of 3 values.