15,096 reputation
12984
bio website quantdec.com
location Northeastern US
age 14
visits member for 2 years, 6 months
seen yesterday

Consultant (environmental and spatial stats a specialty), expert witness, and teacher. I can be reached through (outdated but still valid) links posted on my web site.

Twitter: @WilliamAHuber // ASA-P website: http://amstatphilly.org/


Why waste time learning, when ignorance is instantaneous?

--T(iger) Hobbes.

For any complex problem there is a simple solution. And it's always wrong.

--[Mis?]attributed to H.L. Mencken by Dava Sobel, Longitude.


Jan
9
answered How to expand a function into a power series with negative powers?
Jan
9
comment Evaluate multivariable function
I changed some "=" to "-" in the first formula but otherwise left it alone, even though it disagrees with your Mathematica input in quite a few places. You might want to check that you typed the correct formula into MMA. In particular, the two of you may disagree sharply about the interpretation of "x-y/2", because it rarely equals $\frac{x-y}{2}$.
Jan
9
revised Evaluate multivariable function
added 78 characters in body
Jan
8
comment RecurrenceTable with vector
Although you say you see the same problem "using MapThread", in MMA 8 this succeeds: RecurrenceTable[{x[n + 1] == MapThread[Times, {{1, 2, 3}, x[n]}], x[0] == {1, 2, 3}}, x, {n, 3}]. (This expression was prompted by @b.gatessucks' answer.)
Jan
8
comment RecurrenceTable with vector
(+1) The truly curious thing about this work-around is if you merely leave List out of the definition of g, the RecurrenceTable expression does not work (it returns an empty list). Tracing the evaluation reveals the problem: {1,2,3}*x[n] is expanded as {x[n], 2 x[n], 3 x[n]}, because MMA does not (yet) know that x[n] is a list at the time of expansion.
Jan
8
comment Correct way to populate a DiagonalMatrix?
I see now--I misinterpreted your intention. You are correct, and you are likely correct that what you would personally do is probably what the OP ought to do.
Jan
8
comment Correct way to populate a DiagonalMatrix?
I read your answer, but I think you missed my point: Range[0.0, 1.0, 0.1] will indeed have 0.0 and 1.0 at the endpoints rather than 0 and 1. It's truly a minor thing, but I thought that this would be clearer and simpler than tacking on the 0 and flattening the list, that's all.
Jan
8
comment Plotting a 3D sphere i.e. how to vizualise the spanned volume $\int_0^{2\pi}\int_0^{\pi} d\theta d\phi$?
Have you read the help page for SphericalPlot3D?
Jan
8
comment Ignore missing data while doing a Mean
The question does make sense but it has an important ambiguity. Literally, a is a list of two elements and the first element contains an Na. Thus, "ignoring the Na values," its mean equals its second element, {{0,3}, {2,5}}. The example, though, suggests--inconclusively--that this list is supposed to be thought of as a list of ordered pairs (each of which is a list of two elements) and that the means should be obtained independently for each component. That's why we need more information in order to answer this question objectively.
Jan
8
comment Define an 'inner product' with AngleBracket
@Rojo That's a good point. Although the OP hasn't asked for it, in general an inner product is sesquilinear, not bilinear, so it may be of use to illustrate a solution--as here--that would apply in full generality.
Jan
8
comment Define an 'inner product' with AngleBracket
By definition, the arguments of an inner product have to be elements of the same vector space. Because 0 is not the same as {0} which is not the same as {0,0}, which is not the same as (say) an $L^2$ integrable complex-valued function on a space--all of which could be considered vectors--it should not be the case that $\langle 0,v\rangle = 0$: that expression is, in general, nonsensical. To avoid hidden surprises, consider creating an appropriate vector type and defining AngleBracket as a (sesquilinear) bivariate function of vectors.
Jan
8
comment How to convert from and to UTM coordinates in Mathematica?
The output of GeoProjectionData is not correct for the UTM system: the value of GridOrigin is wrong (it should be {500000,0} and so is the value of CentralScaleFactor (it should be 0.9996).
Jan
8
reviewed Leave Open How do I plot a 3D vector field using a data file with three x y z columns?
Jan
8
comment How do I plot a 3D vector field using a data file with three x y z columns?
@user That was such a substantial change that you should roll this question back to its original and post your modification as a new question. Please consider upvoting and accepting this reply, too, because you have acknowledged that it answers your original question.
Jan
8
reviewed Close Coding mistake?
Jan
8
comment Correct way to populate a DiagonalMatrix?
(1) The SparseArray solution is a lot faster--a couple orders of magnitude. (2) It does not necessarily take much RAM. E.g., making an ArrayPlot with dimensions $10^5$ (involving $10^{10}$ floating point entries) required only about $70$ Mb. (3) If you don't want true zeros or ones at the end of the range, just use Range[0.0, 1.0, 0.1]. If you're concerned about floating point imprecision, Range[0,10]/10.0 should do fine.
Jan
7
comment xkcd-style graphs
Mathematica 9 users please see the follow-up post at mathematica.stackexchange.com/questions/17272/… concerning slower speeds.
Jan
7
comment Correct way to populate a DiagonalMatrix?
+1 for the edit. But have you honestly compared the timing by forcing an evaluation of both results, such as with an ArrayPlot? When I do that, I find the compiled solution is only 25% faster. That's a nice achievement, but because it is so little, I would in many cases prefer a clear simple native Mathematica solution to a compiled (and perhaps obscure) solution. As you hinted, speed isn't everything!
Jan
7
comment Correct way to populate a DiagonalMatrix?
+1 Given that the final matrix is not sparse, it is noteworthy that the SparseArray representation of the diagonal matrix gives a faster calculation.
Jan
7
comment Efficient code for the Ten True Sentences puzzle
@Silvia Thank you--it seems like almost any one-line function I can write has already been incorporated in the software somewhere :-).