Tag Info

New answers tagged


I suppose this is what you need. So the first thing is to use Module since With injects values into held expressions. Moreover PrePrint is probably to late to catch "5+7". So I'd go with $Pre: $Pre = Function[expr, Module[ {expr$ = ToString[Unevaluated[expr], InputForm]}, MSPToExpression[expr$] ], HoldAllComplete ]


Instead of an underscore, a "throwaway" symbol can be used. For instance, f[x_] = {x^2, x^3, x^4, x^5}; {a1, z, z, a2} = f[2] a1 and a2 have their desired values, and the others are overwritten into z at the cost of only a single symbol.


I would recommend to write a1 = f[2][[1]] 4 Clear[a1] {a1, _} = f[2]; also assigns 4 to a1 but produces an error message which you can turn off temporarily with Quiet: Quiet[{a1, _} = f[2]]; a1 4


Copy and paste this text: ☒ It's an odd font but works fine in MSWord.


The problem is that the global symbols hidden in the definition of ab are not localized in the Manipulate. Manipulate reassigns the a and b that appear in the code passed to Manipulate by Evaluate[Delete[ab, 0]] to localized DynamicModule symbols, which are then remapped to front-end dynamic variables whenever the Manipulate output is instantiated in the ...


You might consider this simple form, which cuts the Gordian knot by making each control show its current value. ctrls := {{a, 10, 100}, {b, 0, 10}}; Manipulate[a*b, Evaluate[Sequence @@ (Append[#, Appearance -> "Labeled"] & /@ ctrls)]] This will work no matter how many controls are specified in the list curls as long as each element of the list ...

Top 50 recent answers are included