Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

When you type a function in Matlab, quickly a suggestion box comes up showing functions similar to the one you're typing. I thought that Mathematica didn't have this but one day, I typed half of a function and the went to the kitchen when I got back, the suggestion box was there. I'm not sure if it appears after some time or if I accidentaly pressed some key.

share|improve this question
    
By default, you don't need to do anything in Mathematica 9: as soon as you begin typing a function name, a possible list of completions will pop up without your doing anything. And this "predictive interface" allegedly learns from which completions you use most often. –  murray Dec 21 '12 at 15:34

3 Answers 3

up vote 19 down vote accepted

Do you mean CtrlShiftK?

After typing Plo, press the key combination CtrlShiftK and a window will appear with possible options:

enter image description here

As pointed by Yves,CtrlK will also work,but CtrlShiftK will work differently if you finish the function name. For an example,

  1. Type Plot3D;
  2. Use CtrlShiftK;

Mathematica will show:

enter image description here

share|improve this answer
3  
...and it's quite useful since Mathematica functions average about 57 times more letters than Matlab's –  Rojo Jun 6 '12 at 5:09
    
This is perfect, and it was exactly the kind of thing I was searching for. I guess my hypothesis of accidentaly pressing the keys is fairly invalid now. I also remember that the box I saw was pretty different, an allucination maybe? –  Vladimir Putin Jun 6 '12 at 7:30
1  
Perhaps we should employ infinite monkeys to get all of them funky shortcuts ;-) –  Yves Klett Jun 6 '12 at 9:06
    
+1 because I keep forgetting to use Ctrl+Shift+K! That could really improve my speed of entry. Now I just need to figure out how to make it give me ~infix~ ... :^) –  Mr.Wizard Jun 6 '12 at 9:52
    
And on the Mac it is Cmd+Shift+K. –  Mike Z. Jun 6 '12 at 10:02

Besides the nice real handy option suggested by @yulinlinyu (more here) you can also use text-based interface to find completion for your half-typed function. It is not that fast, but has its own advantages. Try executing this:

?Plot*

enter image description here

and you'll get this nice table of possible functions that complete your input. If you click on any you'll get short definition - as you can see below. And if you click on >> sign at the very end you'll get full Documentation Center article. Sometimes this is really handy, because you can take time clicking various definitions and do completion from other side:

?*Graph

enter image description here

This is how, for example, I discovered that Mathematica supports the awesome DeBruijnGraph (definition shown above). And of course you can generalize further:

enter image description here

share|improve this answer

Sometimes instead of handy shorthands like in the other answers, you'll find more useful Names giving a list of the names of symbols matching the string, (it's case sensitive of course) e.g.

Names["Gro*B*"]
Names["Gro*b*"]
{"GroebnerBasis", "GroupActionBase", "GroupPageBreakWithin"}

{"GroebnerBasis", "GroupMultiplicationTable", "GroupOrbits",
 "GroupSetwiseStabilizer", "GroupStabilizer", "GroupStabilizerChain"}

If you want to look at the documentation of a given name :

  1. highlight its name e.g GroupActionBase
  2. then press F1

Names can be useful in many cases e.g. when you'd like to select only names with special Attributes, or to figure out how many specific symbols there are.

Select[Names["G*"], MemberQ[Attributes[#], NumericFunction] &]
{"Gamma", "GammaRegularized", "GegenbauerC", "Gudermannian"}

To count the number of names let's define :

f = Length @ Names @ # &;

e.g. in Mathematica 8

f /@ { "*G*", "Gr*", "Gra*", "Graph*", "*Graph*" }
{348, 99, 56, 52, 113}

in Mathematica 7 there were less of them

f /@ { "*G*", "Gr*", "Gra*", "Graph*", "*Graph*" }
{200, 64, 34, 30, 38}
share|improve this answer
    
Did you evaluate the last piece of code in Mathematica 7, or is there a way to tell Mathematica to pretend it is version 7? –  Michael Wijaya Jun 7 '12 at 13:00
    
That was evaluated in Mathematica 7 and 8 respectively. You can find e.g. New in 8.0: Alphabetical Listing : reference.wolfram.com/mathematica/guide/… so it is possible to count the new functions programmatically, although I found it more straightforward to evaluate f in the both versions separately. –  Artes Jun 7 '12 at 13:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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