whuber
Reputation
17,526
Top tag
Next privilege 20,000 Rep.
Access 'trusted user' tools
 Dec 4 comment NDSolve and {C, K, Slot} and other built-ins as a variable name @Oleksandr That's right, but MMA differs from C by having many thousands of "reserved words" (although, arguably, they are all identified by one simple rule), by allowing them to be overloaded--which is not the case for a true reserved word--and, as exemplified by this question, by not issuing informative error messages when such words are misused. (This is not to defend the coding practice exhibited here, though.) Dec 4 awarded Custodian Dec 4 reviewed Leave Closed Inputting abbreviated units Dec 4 reviewed Looks OK Preserving labels when using graph functions Dec 4 reviewed Leave Open How to deal with WebServices error “any is not supported in sequence”? Nov 30 comment Finding the intersection of two date lists In some ways it's good that converting strings to dates is the rate-determining step: that means we shouldn't be too concerned about optimizing the join itself, and that gives us the flexibility to craft code that executes correctly in most circumstances. It still looks like a good idea to do the string-to-date conversion, despite the time it takes, because that avoids subtle problems created by potential failures to match two different strings that otherwise represent the same date. Alternatively: do your database operations with a database management system! Nov 29 answered Finding the intersection of two date lists Nov 29 comment Computation of parametric integral Are you sure you didn't mean to integrate (g(u^(g - 1)))/(1 + u^g) instead? It would be a whole lot easier ... :-). Nov 29 comment Computation of parametric integral You could evaluate the integral numerically over a range of values of $g$ and interpolate that to get a working "closed form" function. Parameterize it as $g = \exp(\gamma)$ and evaluate it at roughly equally-spaced values of $\gamma$. To see what's going on, look at LogLinearPlot[ NIntegrate[(g^(u^(g - 1)))/(1 + u^g), {u, 0, 1}, WorkingPrecision -> 50], {g, 0.01, 100000}, PlotRange -> {Full, Full}] (and be prepared to wait a minute or two: the extra precision is needed for values of $g$ greater than $1000$ or so, for obvious reasons). (The limit at $g\to\infty$ is $1$.) Nov 29 comment Restricted accumulation of values @Rojo Here's a fix. Not only is it straightforward, it's fast: Block[{sums = Accumulate[data], k, i}, k = Position[sums, x_?Positive, 1, 1]; i = If[k == {}, 0, Part[k, 1, 1]]; Take[sums, i]~Join~Drop[data, i]]. Nov 29 comment Restricted accumulation of values The second method is very fast but is correct only assuming the cumulative sums remain positive forever after they first turn positive. Nov 29 comment Solving a large equation set Isn't this a duplicate of mathematica.stackexchange.com/questions/15360? Nov 28 awarded Nice Answer Nov 27 comment Replacing functions This question is quite puzzling, because neither Sin[x] nor x can reliably be construed as "functions." Shouldn't the first example return Sin[x][x]-3? If that seems silly, suppose Sin were a function that returns a function, as in sin[x_]:=Function[{y},y+x]. Now both sin[x][x] and sin[x] make sense, but only the former conforms to the problem statement in the first line (and evaluates to x+x, by the way). Nov 27 awarded Nice Answer Nov 27 comment Insert $+$, $-$, $\times$, $/$, $($, $)$ into $123456789$ to make it equal to $100$ @VF1 What specific expression are you suggesting? Nov 26 comment Insert $+$, $-$, $\times$, $/$, $($, $)$ into $123456789$ to make it equal to $100$ Re the second part of the question: there are many more than five solutions, no matter how flexible you are in rewriting them. E.g., $34(-5\times 6 + 89)+2$ or $34(5/(6/(8\times 9))-1)+2$. Nov 26 revised Insert $+$, $-$, $\times$, $/$, $($, $)$ into $123456789$ to make it equal to $100$ added 1038 characters in body Nov 26 answered Are table headings functional? Nov 26 revised Insert $+$, $-$, $\times$, $/$, $($, $)$ into $123456789$ to make it equal to $100$ added 231 characters in body