0
$\begingroup$

How can I know the list of predefined functions ? Because often when I'm defining a function it already exist as c[n,k] gives $\binom{n}{k}$, and I also had problem with defining a function F. In general, is it possible to erase all functions ?

$\endgroup$
1
  • $\begingroup$ To find out if a function is built-in, search the documentation. For your example, search for Factorial in the documentation. Looking at the See Also sections shows Binomial which is the built-in function for which you are looking. $\endgroup$
    – Bob Hanlon
    Jan 27 '18 at 15:14
6
$\begingroup$

Erasing all functions would be catastrophic. You can find out if a symbol f has a definition by evaluating:

?f

All symbols with built-in definitions have names that start with capital letters or "$", so the common convention is to start your own symbols with lower case letters.

$\endgroup$
1
  • $\begingroup$ Thank you, it's very helpfull :-) $\endgroup$
    – Surb
    Jan 27 '18 at 15:09
5
$\begingroup$

It seems from the examples that it is the symbols the user has previously defined, either manually or through init.m etc., that are at issue.

ClearAll["Global`*"] or Clear["Global`*"] are in the docs of those commands under "Generalizations & Extensions". These clear all symbols you have used (in the default global context). Built-in functions are in the System` context and will not be affected by these. Both commands clear any definitions/values, but ClearAll in addition clears other things such as Attributes. Some people use Quit[], which quits the kernel (and effectively restarts it).

This will show you which symbols you have used have definitions:

Pick[Names["Global`*"], GeneralUtilities`HasDefinitionsQ /@ Names["Global`*"]]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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