12
$\begingroup$

The first post in "Mathematica Weekly Newsletter - Tuesday, December 30, 2014" really attracted my attention as I was always looking for a complete list of built in Mathematica functions with short definition. This post provided me a starting point. As we all know Link 1 and Link 2 provide us Alphabetical Listing of all built in Mathematica functions.

With the help of the post Link 3, I can write the following codes:

    firstletters = {"A*", "$A*", "B*", "$B*", "C*", "$C*", "D*", "$D*", 
   "E*", "$E*", "F*", "$F*", "G*", "$G*", "H*", "$H*", "I*", "$I*", 
   "J*", "$J*", "K*", "$K*", "L*", "$L*", "M*", "$M*", "N*", "$N*", 
   "O*", "$O*", "P*", "$P*", "Q*", "$Q*", "R*", "$R*", "S*", "$S*", 
   "T*", "$T*", "U*", "$U*", "V*", "$V*", "W*", "$W*", "X*", "$X*", 
   "Y*", "$Y*", "Z*", "$Z*"};
functionslist = Flatten[Names[#] & /@ firstletters];

Now I hope that I have a complete list of mathematica functions in my functionslist (if it does not have a complete list of functions, please help me how to get it). Length[functionslist] gives me 5267 number.

Now I want each function with short definition. For example functionslist[[1]] gives me "AASTriangle". If I type

?AASTriangle

I get the following:

(*AASTriangle[\[Alpha],\[Beta],a] returns a filled triangle with angles \[Alpha] and \[Beta] and side length a, where a is adjacent to one angle only. >>*)

I wonder why

?(functionslist[[1]])

does not give me the same result as above?

I am trying to create a notebook with all functions and their short definitions. If I could make this, it would make my life easy. Please help.

Sorry, for this lengthy question.

$\endgroup$
  • 1
    $\begingroup$ I'd use what Bill showed, but another option is Information[Evaluate[ToExpression[functionslist[[1]]]]] $\endgroup$ – Nasser Dec 31 '14 at 4:36
  • $\begingroup$ Column[Information /@ functionslist] $\endgroup$ – Bob Hanlon Dec 31 '14 at 5:01
  • $\begingroup$ Closely related: (8126) $\endgroup$ – Mr.Wizard Dec 31 '14 at 7:35
20
$\begingroup$

Perhaps the simplest way is to use the built in function Information, which is the programmatic form of ??

Information[#, LongForm -> False] & /@ functionslist

gives a long list of (short) function definitions. By the way... it's easy to figure this kind of thing out -- in this case, I highlighted the symbol ?? (double question mark) and pressed the F1 key to bring up the help. That brought me to the function Information. I had first tried help on the single question mark (which brought me to the function Definition) which didn't seem quite right.

Here is the very start of the output...

enter image description here

$\endgroup$
  • $\begingroup$ @ bill s, you are genius. Thank you. I would like to leave this question if I could get some formatted results. Thank you for your answer. $\endgroup$ – ramesh Dec 31 '14 at 4:31
  • $\begingroup$ Any Idea why we get "Attributes[ExternalFunctionName]={Protected,ReadProtected}" or "Attributes[OverwriteTarget]={Protected}" in some cases? $\endgroup$ – ramesh Dec 31 '14 at 4:52
  • $\begingroup$ It looks like most of these have some form of Protected attributes, so probably is related to that. I imagine you could set up some sort of filter (Select, DeleteCases or some such) to remove them if necessary. But it's hard for me to imagine what this is going to be used for... it's long and quite unwieldy. Why not just use the help? $\endgroup$ – bill s Dec 31 '14 at 13:09
  • $\begingroup$ @ bill s, thanks for update. I am trying to make a small book with all these functions so that I can review in my leisure time. $\endgroup$ – ramesh Dec 31 '14 at 13:37
7
$\begingroup$

You can also use the usage messages:

usageInfo = With[{func = Symbol[#]}, func::usage] &;

cF = Column[Style[#, 16, "Usage", Background -> None] & /@ #,
            Dividers -> All, Background -> {{LightBlue, LightOrange}}] &;

usageInfo /@ functionslist[[;;8]] // cF

enter image description here

Alternatively, make the usage message content a Hyperlink to the docs page:

usageInfo2 = With[{func = Symbol[#]}, 
    Hyperlink[Style[func::usage, 14, "Panel", Background -> None], 
     "paclet:ref/" <> ToString[func], ActiveStyle -> None]] &;

usageInfo2 /@ functionslist[[;; 8]] // 
       Column[#, Dividers -> All, Background -> {{LightBlue, LightOrange}}] &

enter image description here

$\endgroup$
  • $\begingroup$ @ kguler, thank you for taking your time to answer this question. Your answers are always very detail and informative. As always, a big thank you. $\endgroup$ – ramesh Jan 3 '15 at 5:02
  • $\begingroup$ @ramesh, my pleasure.. $\endgroup$ – kglr Jan 3 '15 at 5:06

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.