Tag Info

New answers tagged

4

Note: shown below is an answer to the first version of the OP's question Here is a simple example using scoping constructs, namely Block in this case. The idea is that you can indicate symbols to make local to Block, which implements dynamic scoping: take a look at the "Background and Context" section of its docs for a more complete explanation. Symbols ...


4

As @MarcoB states, you should probably use scoping constructs... If you're opposed to that idea, you can set the Notebooks default context to be Unique to Each Cell Group. I wouldn't recommend that, but it works. You can set that under Evaluation > Notebook's Default Context > Unique to Each Cell Group: Note, to escape this, you need to specify ...


1

I interpret this question as asking how define a function that works like the built-in functions Part, AppendTo, and PrependTo; i.e., a function that performs non-standard argument evaluation because it has been given one of the attributes from the Hold family of attributes. Normally, in what is referred to as standard evaluation, all the actual arguments ...


1

I think that you are looking for something analogous to various modify-in-place functions such as AddTo, AppendTo, PrependTo, AssociateTo, SubtractFrom, Increment, Decrement, but for general function application. Being aware of Apply and bearing in mind the difference in meaning between simply "function application" and the specific operation of Apply I ...


2

You can use Inactivate with TraditionalForm. Inactivate[h = (R.omega + x).x] // TraditionalForm Inactivate prevents the operations from executing and TraditionalForm gives the formatted output. Hope this helps.


0

Thank you for your replies, they will be useful in the future. I found the solution to my specific problem however. One can use: Distribute[(HoldForm[R].HoldForm[omega]+HoldForm[x]).HoldForm[x]] Albeit cumbersome, it does the trick. To avoid it one can use @march or @MariusLadegÄrdMeyer solutions! Thank you.


5

There will be more clever answers from people who better understand Mathematica's order of evaluation and how to use Hold and such, and so I can't answer your question in exactly the way that you've phrased it, but here's how I go about doing these types of things. First, instead of declaring the values of x, omega, and R as you've done, make a list of ...


5

As you've seen, a definition like u = u[x,y,z] is not generally appropriate in Mathematica because the principle of the Mathematica evaluator is to repeatedly apply all known definitions to an expression until the result no longer changes. Here, the recursive definition is repeatedly applied, with no termination condition. If you're just looking for a ...


2

You can insert your Manipulate[...] in a DynamicModule[{lower,upper},...]: DynamicModule[{lower, upper}, Manipulate[ Refresh[ lower = distPlotRange[distribution, -1, 4]; upper = distPlotRange[distribution, 1, 4]; fillRange = {Max[#[[1]]], Min[#[[2]]]} &[ Transpose[{fillRange, {lower, upper}}]];, TrackedSymbols :> {distribution} ...


2

One can localize the scope of variables to Manipulate by adding them as arguments to Manipulate with ControlType None. For your case Manipulate[Refresh[lower = distPlotRange[distribution, -1, 4]; upper = distPlotRange[distribution, 1, 4]; fillRange = {Max[#[[1]]], Min[#[[2]]]} &[ Transpose[{fillRange, {lower, upper}}]];, TrackedSymbols :> ...



Top 50 recent answers are included