celtschk
Reputation
12,835
Top tag
Next privilege 15,000 Rep.
Protect questions
 Jan 14 comment LinearSolve on non-square matrices? That applies N only to the symbol SparseArray and thus is equivalent to SparseArray@foo. You can easily verify that by noting that the result consists of integers, not of m,achine-precision numbers. Note that the point is not the application of N, but the fact that I have a sparse array with numeric values; Applying N is just a convenient way to get that. Jan 14 comment Randomly Multiply OR Divide by a Random Number? Yes, exactly: You multiply with an uniform distribution between 0.1 and 1. Which is not the same as dividing by an uniform distribution between 1 and 10. Jan 14 comment Randomly Multiply OR Divide by a Random Number? More importantly, it gives a different distribution. The inverse of an uniformly distributed variable is not uniformly distributed. Oct 29 comment Why is a symbol still found after changing its context? From further tests, it seems that everything generating a message works; not only Update[""] but also 1/0. Anyway, I now noticed something different: My previous tests had all been by directly entering into the kernel; now I tried in the notebook, and there the context assignment seems to work immediately. Oct 22 comment Why does Information[]-Function (question mark) prepend additional contexts to $ContextPath? InternalInheritedBlock[{$ContextPath},?Sin] restores the $ContextPath afterwards, I guess that should be safe. Oct 22 comment Why is a symbol still found after changing its context? Interestingly, Update with any invalid argument also seems to work (so Update["hello world"] works, but neither Update[] nor Update[Unevaluated@x] nor Update with any function related to symbols, expressions or context I've tried). Oct 20 comment Plot of function-generated lists: Why does this workaround not work? I'm comparing with the code I posted in my question (the one that gave the wrong curves). That code makes only 78 calls to f (tested on Mathematica 8.0). However I defined the function for counting as f[x_?NumericQ] := {count++; x, x^2}. Oct 20 comment Plot of function-generated lists: Why does this workaround not work? But all those do the equivalent of Plot[f[x][[1]], f[x][[2]],{x,0,1}]. That is, the function is evaluated twice (this can easily be verified by incrementing a counter in the function; with my version, there are 78 calls, with any of yours, there are 158). The whole point of that construction is that this extra call is avoided (as the calls of the actual function are expensive). Oct 20 comment Plot of function-generated lists: Why does this workaround not work? Thanks, that makes sense. I now tested the call order, and indeed, after an initial single call to each, there follows a row of calls only to fwrap1, and then another row of calls only to fwrap2. If you turn your comment into an answer, I'll accept it. Oct 20 comment Why is 13 the smaller height dimension of a Graphics? Just for the record, I just tested your code on Mathematica 8.0 (Linux), and there the minimum seems to be 12, and the only anomaly is at ImageSize height 12 where the value is 13 instead of 12. Mar 20 comment Using TimeSeriesForecast for forecasting the traffic growth Is your problem in getting the data from the Google spreadsheet into Mathematica, or is your problem in the use of TimeSeriesForecast on the imported data? Mar 20 comment Length of Union Incorrect? @Jinxed: I guess it wasn't done for that reason here (see at the end of the comment), but Do[expression,{1}] at top level is a reliable way to prevent the value of the expression not only from output, but also from being stored in Out (if you just put a semicolon at the end, it doesn't get printed, but still gets stored in Out). Just writing Do[expression] (without the {1}) also works, but has the disadvantage that the syntax highlighter tells you there is a second argument missing. However assigning the resulting Null to ConnectingList doesn't seem meaningful. Mar 19 comment Piecewise function output response interpretation The function returns 0 if neither t >= 0 nor t <= 0. For example, if you define strange /: strange >= 0 = False; strange /: strange <= 0 = False you get a strange value which is neither >=0 nor <= 0. Consequently, if you evaluate your piecewise function with t=strange, you'll get 0 as result. Mar 19 comment Why does this expression take a long time to evaluate? Mathematica recognizes unsolvable problems (although that may also take time; also I think detecting all unsolvable problems is not possible in principle), but how is Mathematica supposed to know what you consider an unreasonable time? I might be interested enough in a solution that I'm willing to wait a week to get it. Note that you can tell Mathematica to stop after a certain time using TimeConstrained. Mar 18 comment Printing names of indexed variables instead of values Also With[{i=1},HoldForm[foo[i]]] works. As does i=1;With[{i=i},HoldForm[foo[i]]]. Mar 18 comment Strange behavior of Limit in Mathematica 9 and 10 (bug?) Actually I'm surprised that it works at all, since strictly speaking the limit doesn't exist (you usually use a notation like$\lim_{\eta\to 0^+}$to indicate the extra condition that you are calculating a one-sided limit). However I don't know under which conditions Mathematica considers a limit to be one-sided. Mar 15 comment How to find Multiple Maxima/Minima FindMaximum allows you to give a starting point for the search; if you have a rough idea where to find the maxima, you could try using that. If your function is analytic, you might also calculate the derivative and solve for places where it is zero (don't forget to look at the second derivative to distinguish maxima/minima from saddle points). Feb 18 comment Can Mathematica's random number generation be improved? @JEP: The headers random and chrono were added to C++ in the C++11 standard. It might be that your C++ compiler doesn't support C++11, or that you have to give a special flag to compile C++11 code. Oct 29 comment High-Precision NSolve Does NSolve[SetPrecision[f1[x]==f2[x], 100], x, WorkingPrecision->100] work? (On 8.0.0.0, your version gives no warning and a result of {{}}, so I can't check myself). Oct 28 comment Is this an error/bug with Plot Command? @ChipHurst: Both seem not to be available at Mathematica 8; however I've found them in the web documentation. CubeRoot clearly wouldn't be a replacement for realpower, covering only the very special case$x^{1/3}$. Surd (which IMHO is a contender for the most unintuitively named Mathematica function) gives the more general case$x^{1/n}$; while it would certainly be a better building block for realpower`, it's however not a full replacement because it doesn't handle e.g.$x^{2/3}\$ (which is the case from the question).