4
$\begingroup$

I'm trying to clear out some variables that I've previously used, so that I can use them again. I tried this in a different notebook and it worked, however, now, a command like :

Clear["a*", "b*", "c*", "m*", "A*"];

for some variables a1,a2,a3....gives:

Clear::wrsym: Symbol AbelianGroup is Protected.
Clear::wrsym: Symbol Abort is Protected. 
Clear::wrsym: Symbol AbortKernels is Protected. 

The thing is , the calculation still works, but I can't get rid of this error.

$\endgroup$
3
  • 1
    $\begingroup$ Have a look at Google clear variables mathematica, and using uppercase for variables is a verry bad idea $\endgroup$
    – user9660
    Commented Feb 1, 2016 at 14:28
  • $\begingroup$ See also Defining Variables the part about, so you can get rid of the error by choosing lowercase variable names. $\endgroup$
    – user9660
    Commented Feb 1, 2016 at 14:31
  • 1
    $\begingroup$ When you Clear[A*] you're trying to clear the definition of symbols built into Mathematica as well as your own and it complains (e.g. Abort is a Mathematica function). As the others have written if you stick to naming your own symbols starting with only lower case (e.g. myFunction not MyFunction) you should be safe. $\endgroup$
    – Ymareth
    Commented Feb 1, 2016 at 14:35

1 Answer 1

7
$\begingroup$

Add the Global context:

Clear["Global`a*","Global`b*","Global`A*"]

The built-in (hence protected) command are of System scope:

Context[AbelianGroup]
(*returns: System`*)
$\endgroup$
1
  • $\begingroup$ Works, thank you! $\endgroup$
    – PhysNerd90
    Commented Feb 1, 2016 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.