Tagged Questions
4
votes
1answer
108 views
Module with “local functions”
I am trying to use a Module having "local functions", i.e., those which I need to define only inside this module.
So I tried this:
...
0
votes
0answers
60 views
What's the best practice for nested local constants? [duplicate]
Possible Duplicate:
How to avoid nested With[]?
I have many situations where I have a constant that is local to a function, with other constants that are computed from it. I see that I can ...
30
votes
3answers
666 views
Why modules with no variables?
I was reading some code, in particular, recipe 4.13 on unification pattern-matching in Sal Mangano's Mathematica Cookbook, and there were many instances of Modules with no variables in them, such as
...
9
votes
3answers
462 views
How to use local variables with indices in a Mathematica Block environment?
I have the following code:
Subscript[f, i_][x_] := Block[{a},
Subscript[a, i] = 3 x;
Subscript[a, 1]
]
If I evaluate for example ...
60
votes
7answers
2k views
What are the use cases for different scoping constructs?
Mathematica includes three functions that I know of which can be used to effectively (if not actually) define a variable and give it a value within a local scope: ...
