10,267 reputation
12174
bio website
location
age 43
visits member for 2 years, 6 months
seen yesterday

1d
comment What's the difference between Inactive and HoldForm?
But couldn't the effect of Inactivate also be achieved using Hold with SetAttributes[MakeHeld, HoldAll]; MakeHeld[a_[b___]] := MakeHeld[a][b]; MakeHeld[a_] := Hold[a]?
1d
comment Why wouldn't ReplaceAll (/.) work with this list of number?
I prefer {1, 2, 3, 4} /. {2 -> 5}.
Jul
18
answered What is the order of faces on a D20? How can I optimize the order of faces on a D-n?
Jul
18
comment NMinimize gives an obvious wrong value
I notice that you minimize estimator[{l}, {1}], but then evaluate estimator[{l}]. looking at your definitions, the latter should not evaluate at all. Could it be that an earlier definition of estimator still is in effect besides your current one, and gets triggered by your test expression? (Type ?estimator to see all definitions Mathematica currently knows.)
Jul
18
revised Plot3D unable to understand input function
reapplied my formatting fixes, which got lost in an overlapping edit
Jul
18
revised Plot3D unable to understand input function
improved formatting
Jul
18
comment Plot3D unable to understand input function
BTW, what do you get for f[1,0,0,1.,1.]?
Jul
18
comment Plot3D unable to understand input function
If pre-evaluation works, an easy workaround should be Plot3D[Evaluate@f[1,0,0,y,k], {y,-3,3}, {k,-3,3}]. While that doesn't answer your question, it might solve your problem.
Jul
18
comment What is the order of faces on a D20? How can I optimize the order of faces on a D-n?
Also note that for the use of a regular polyhedron as a die, it is completely irrelevant how you distribute the numbers, as long as each number appears exactly once (if it were not irrelevant, the die would not be unbiased to begin with). Indeed, taking into account possible biases, the usual opposite-side rule is the worst you can do; since the opposite side of the most probable result will be the least probable result, opposite sides should be as close as possible to minimize the effect of unintentional bias.
Jul
18
comment What is the order of faces on a D20? How can I optimize the order of faces on a D-n?
Accordind to the normal 6-sided cube-shaped die, as soon as you add the condition that opposite sides add up to 7, there are only two possible distributions which are mirror images to each other. Quite obviously this means that you'll not find a possible distribution that dos not have a vertex adjacent to 1,2,3 — which can also be seen quite directly: opposite to 1 is 6, so adjacent to it can only be 2 to 5. Now 2 and 3 are not opposite, thus they are adjacent. Since 1, 2 and 3 are pairwise adjacent, they share a vertex. And the opposite vertex then of course is shared by 4, 5 and 6.
Jul
18
comment What is the order of faces on a D20? How can I optimize the order of faces on a D-n?
I'd use Gather with "is parallel to" as criterion. That way you'd get a list of pairs, containing sites opposite to each other. Then you could use Transpose on that list, and then Reverse on the second element of the result. Then apply Join to get back to a single list. Then the positions in the list are such that the opposite sides have indices which add to the same number (namely $d+1$ for a D$d$), so you can just give each side its index in that list as number.
Jul
18
comment Opacity limitations?
(Unrelated: The image upload palette seems to no longer work — updating to the latest version didn't help. Anyone has an idea why?)
Jul
18
comment Opacity limitations?
Strange. For me, showFrames[wafer[]] gives this, and showFrames[{polycircle[],waver[]}] gives this. I think the latter is what you wanted, right? BTW, I'm using version 8.0.0.0.
Jul
18
comment Changes to colouring in Mathematica 10
See the section "Module"/"Advanced usage" in this answer for an example of a closure. Anyway, after reading the documentation of DynamicModule I think I now figured out what the problem with Module+Manipulate probably is: Dynamic content (like Manipulate) is stored across sessions. However a normal Module variable is not stored that way. I guess that would create problems as soon as you save the notebook and later open it in a new instance of Mathematica.
Jul
18
comment Changes to colouring in Mathematica 10
… indeed, exactly this "keeping alive" part is what allows you to implement closures using Module.
Jul
18
comment Changes to colouring in Mathematica 10
But then I don't understand why it wasn't made red in my original example: Try adding a Print statement like this to reveal the module's local variable name: Module[{v=0},Print[Hold[v]];next[]:=v++] and then evaluate the variable outside the module; you'll see it has still the value assigned in the module. The same is true for Module[{v=1},Hold[v]] (here you get the variable name right in the result, so no Print is necessary to reveal it). Also note that while the behaviour with Block and Manipulate is pretty bad, I don't see an issue with the corresponding Module behaviour; …
Jul
17
comment Changes to colouring in Mathematica 10
Maybe I misunderstood the error class description (on second reading I'm no longer sure). Does the following give a red v? Module[{v=1},Hold[v]]? What about Module[{v=1},v]? And Module[{v=1},v;0]? And Module[{v=1},Hold[v];0]?
Jul
17
comment Changes to colouring in Mathematica 10
I think the point is that A (or rather the temporary variable A$xxx generated by Module, where xxx is some number) will be kept alive by the Manipulate even after returning from the Module. Now the variable won't go away as long as it is referenced, which I actually consider an useful feature (it allows you to implement closures). At least that's how it is in Version 8; one would hope that it didn't change in v10. Does v10 also mark the v in the following code red? Module[{v=0},next[]:=v++]
Jul
16
comment Struct equivalent in Mathematica?
@mcandril: I've just now seen your comment. In case it's still relevant for you: I think simply using //. instead of /. would solve that issue. For example, {a,b} /. { a->1, b->x+a } gives {1, a + x}, but {a,b} //. { a->1, b->x+a } gives {1, 1 + x}.
Jul
2
awarded  Inquisitive