Linked Questions

1
vote
2answers
137 views

Localised variable shows up as Global [duplicate]

Why does this local variable show up as Global? ?q Information::notfound: Symbol q not found. >> ...
3
votes
1answer
88 views

Why does AtomQ[y] define y? [duplicate]

Mathematica Version 11.2 desktop / Windows 10 Pro 64-bit ...
2
votes
1answer
88 views

Local function becomes global after Plot [duplicate]

In the code below, I define and plot a local function f. Clear[f] Module[{f}, f[x_] := 1; Plot[f[x], {x, 0, 1}]] However, ...
2
votes
0answers
34 views

Symbol created in unevaluated second argument of If [duplicate]

Apologies for the long question title, but I couldn't come up with something shorter to describe the following. Starting with a clean session, there are no symbols in, let's say, ...
242
votes
8answers
16k 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: ...
24
votes
4answers
1k views

Create an adaptive amount of local variables for error propagation

I intend to write a function which calculates the result and the error for any formula with any amount of variables using the Gauß Error Propagation. The error $\mathrm{d}R$ for a function $A(a,b,c)$ ...
20
votes
3answers
1k views

Variable scope similar to other languages

Mathematica, unlike many other languages, defines the variables in the global scope unless it is explicitly asked to define a variable in a local scope, e.g., using ...
16
votes
2answers
446 views

Why does leaving and re-entering a context lose values defined in that context?

I'm getting unexpected behavior when beginning a new context, leaving it, and then re-entering it. Specifically, when re-entering the context, symbols that had been previously defined in that context ...
18
votes
1answer
620 views

Is it possible to use Begin and End inside a Manipulate?

May be someone can explain why I can't use Begin["context`"] and End[] inside a Manipulate ...
8
votes
2answers
1k views

How to unprotect a variable in a package

In Mathematica 9, I had the function(s). I apologize for the weak formatting. ...
7
votes
3answers
529 views

Scope within Context

To define some package-wide functions/variables, what approach is recommended? I tried to use contexts with the Begin function, but this failed: ...
13
votes
1answer
796 views

Context of localised (dynamic) symbols

When you localise a symbol with Module, the created unique symbol is usually in the current context. There seems to be an exception to this which has further ...
9
votes
1answer
312 views

Why does the global variable exist here, where it was declared only in Module?

Why does Mathematica choose the mechanism that makes the global variable a here while parsing? In ...
3
votes
1answer
388 views

Call Functions From File Without Modifying Context (Sandbox)

Let's say I have file named test.m containing test[arg1_] := ( Print[arg1];) What is the best technique for calling test like ...
4
votes
1answer
429 views

Namespaces in Mathematica

In many programming languages one can define a namespace with namespace abc How can the similar be done in Mathematica? The ...

15 30 50 per page