If a value is assigned to a variable that is named by capital K it cannot be deleted. This effect can be observed directly after start of the program.
Is this a bug?
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 communityThe Wolfram Language currently uses seven single letter capital letters for various core system functions: C
, D
, E
, I
, K
, N
, and O
. Mnemonically: OINCKED
The other 19 capital letters are available to use, at least in current versions:
data = {#, Symbol[#], ToExpression[# <> "::usage"]} & /@ CharacterRange["A", "Z"];
Grid[data, Alignment -> Left, Frame -> All, BaseStyle -> "Text"]
Of these seven symbols, K
is the only undocumented symbol (in the sense that it does not have a reference page). I would consider that a bug or shortcoming in the documentation.
CODE INK
- two small meaningful words. Or maybe KODE INC
an imaginary company.
$\endgroup$
May 4, 2020 at 15:42
K
is part of the System`
context. You were removing symbols from the Global`
context only, so K
wasn't affected. It could be unset with K=.
.
That said, when doing interactive work, avoid using any symbols whose name starts with a capital letter, as these may conflict with System symbols or package symbols.
Do not set any value for K
and do not attempt to Remove
it as this will break things. K
is used as the summation index when a generic Sum
is returned. An example from the documentation of RSolve
:
RSolve[a[n + 1] == a[n] + f[n], a[n], n]
(* {{a[n] -> C[1] + Sum[f[K[1]], {K[1], 0, -1 + n}]}} *)
I do not know why K
is not Protected
. It seems like it would make sense to protect it as people regularly assign to it by accident.
If K is evaluated then click on "description of K" and you get information:
K is a default generic name for a summation index in a symbolic sum.
The bug is that this information is missing in the help.
K
of an assigned value, use K =.
$\endgroup$
Jan 26, 2020 at 1:14
K
is a built-in symbol used by internal functions as a dummy variable for integrals/products/sums, e.g.DSolve[{y'[x] == Sin[Sin[x]]}, y, x]
. Of course, you can't delete it! $\endgroup$C
is used as a dummy variable and it isProtected
. $\endgroup$