I would like to understand why in the following code, my variable
Λ is recognized by the system but not
In fact for me
Λ shouldn't be recognized as it is defined in a function.
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.Sign up to join this community
I would like to understand why in the following code, my variable "Lambda" is recognized by the system but not "n".
Not quite correct, you just showed
n isn't in
Global` context. When could it happen? That is, when could
n not be in
Global` and still be displayed as
n is on
$Context. Those values affect typesetting, see:
PacletManager`foo; (*PacletManaget` is loaded on startup so it is on $ContextPath*) foo = 1; Context @ foo
You need to read:
in fact for me Lambda shouldn't be recognized as it is defined in a function.
It is not defined, it is mentioned, symbols are created just by parsing input.
Quite often common names like
n, x, i, k, foo, bar will exists in
$ContextPath but that won't prevent them from being scoped in different functions as it is a task for scoping constructs, your function takes care of that.