463 reputation
29
bio website
location
age
visits member for 2 years, 3 months
seen Mar 10 at 4:02

Feb
14
comment NMinimize seems to call function with the same values multiple times
@FrederikZiebell I don't understand your comment. I stated that the above code seems to always returns True in my computer. Are you saying that it returns False in yours?
Feb
13
comment NMinimize seems to call function with the same values multiple times
I find the memoization works: ClearAll[f, g]; g = {}; f[x_?NumericQ] := f[x] = (g = {g, x}; x^2); NMinimize[f[x], x, Method -> "RandomSearch"]; DuplicateFreeQ[Flatten[g]] returns True.
Jan
25
awarded  Yearling
Jul
23
answered How to define a function based on the output of DSolve?
May
24
comment Unexpected behavior of Unevaluated
I think the point is that in the example you constructed, when Sequence is removed, this happens after the Unevaluated head would have been taken into account. Hence (together with the fact that when Sequence[] is spliced, it does not triggers a re-evaluation of the entire expression), the inherited Unevaluated head remains.
May
24
comment Unexpected behavior of Unevaluated
@Jacob, I removed the attribute to make that point.
May
24
comment Unexpected behavior of Unevaluated
OK, so if we were to do: ClearAttributes[Unevaluated, HoldAllComplete]; SetAttributes[Unevaluated, HoldAll]; g[_Symbol] := "yay"; x=4; g[Sequence[Unevaluated[x]]] then this still evaluates to g[Unevaluated[x]]. Then, it seems that it is not about updates.
May
24
comment Unexpected behavior of Unevaluated
You seemed to have raised several issues in the body of your question. I tried to answer the actual question you asked at the end of it (which is the same as how you started). The update issues seemed to be a different point/question.
May
22
revised Unexpected behavior of Unevaluated
added more discussion, and linked to another answer.
May
22
revised Unexpected behavior of Unevaluated
minor corrections
May
22
answered Unexpected behavior of Unevaluated
Mar
12
revised How to paint part of DateListPlot?
added graph
Mar
12
answered How to paint part of DateListPlot?
Mar
6
comment Enforcing correct variable bindings and avoiding renamings for conflicting variables in nested scoping constructs
@Leonid Thanks.
Mar
6
comment Enforcing correct variable bindings and avoiding renamings for conflicting variables in nested scoping constructs
I am still not clear about what constitutes a conflict of variables. For example why Module[{body}, Function[x, body] /. body -> 2 x] and Module[{ }, Function[x, body] /. body -> 2 x] give different answers? It seems that in the first one, Module renames x, as it detects body inside Function, and this doesn't occur in the second one.
Mar
6
comment Enforcing correct variable bindings and avoiding renamings for conflicting variables in nested scoping constructs
Right. Although in some cases that may be also what you want to achieve when evaluating f[x] (i.e., treating x as the function variable).
Mar
6
answered Enforcing correct variable bindings and avoiding renamings for conflicting variables in nested scoping constructs
Jan
25
awarded  Yearling
Jan
15
comment Cannot plot Quantity values with DateListPlot
You can also do: DateListPlot[QuantityMagnitude[gasPrices]] to remove the units.
Jan
10
comment Ignore missing data while doing a Mean
And I just noticed that you may also want to wrap na -> Sequence[] with parenthesis, so that it works when na is an integer.