# Tag Info

3

The cause is the variable name confusion. It is true that each DynamicModule creates different symbol names. However, a new symbol name is generated again in Dynamic. For example, try running this code and slide the slider: DynamicModule[{x = 0, f}, f[] := Print[SymbolName@f]; f[]; Slider[Dynamic[x, f[] &]]] (* f$400707 *) (* Slider *) (* f$\$3152 *) ...

10

Why is this happening The explanation was basically given by ciao in comments. You can also find a lot of information on this in this great answer of Mr.Wizard. I will perhaps try to view it from a somewhat different perspective. To understand what happens, one should go back and consider what happens when we enter and execute some code. The steps are ...

1

Animate[Show[ ParametricPlot3D[{0.5 Sin[q], 0.5 Cos[q], 50 - (0.1 + Sin[t Pi]^2) q}, {q, 0, 50}, Axes -> False, PlotRange ->{All, All,{-10, 50}},BoxRatios->{1, 1, 10}], Graphics3D[Cuboid[{-0.5, -0.5, 50-(0.1 + Sin[t Pi]^2) 50}]]] ,{t,0, 4}]

7

You can safely ignore the warning and red highlighting. It simply tells you that the variable will be injected into Block by the top-level rule (your function), rather than being the actual symbol originally present in Block's declaration list. Which is exactly what you want here. In most cases, things like that happen due to a programmer's mistake, which ...

2

Begin may be what you need here, as it allows you to define variables inside a given Context: a = 3; Begin["MyContext"]; {a, b, c} = {1, 2, 3}; Print@{a, b, c}; End[]; Print@{a, b, c} Print@{MyContexta, MyContextb, MyContextc} {1,2,3} {1,b,c} {MyContext`a,2,3} There are a couple of important caveats: If you have already given a ...

0

The error is in: fun1[p_] := p^2 + p - 1; fun2[p_] := p^3 - p^2 + p + 1 The separator doesn't ";" , is ",".

Top 50 recent answers are included