Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been playing around with dynamic input fields; here's a basic example, which just consists of an input field where the user can enter a function and then a button that can be clicked to graph the function. What I'm wondering is: is there a way to allow free-form linguistic input to be entered in the input field? Right now, I must enter regular Mathematica syntax like Cos[x] to get a graph, but I'd really like to be able to enter something like "cos x". (Ultimately, I'd like my dynamic module to do more than just graph the function, which is why I don't want to just use Wolfram Alpha directly.)

DynamicModule[{graph, f, button},
 graph = Plot[1, {x, 0, 1}, PlotRange -> {0, 0.1}, Axes -> False, 
   ImageSize -> 480, Background -> White];
 f = Cos[x];

 button = Button["Graph!",
   graph = Plot[f, {x, -3, 3}, ImageSize -> 480, Background -> White];

    {InputField[Dynamic[f]], button},
    {Dynamic[graph], SpanFromLeft}},
   Spacings -> {2, 1}, Alignment -> {Left, Baseline}


share|improve this question
up vote 7 down vote accepted

I believe that Mathematica feeds the input string in free-form linguistic input to the function WolframAlpha. Try something like

 If[in =!= "", WolframAlpha[in], "Enter input"],
 {{in, ""}, InputField[Dynamic[in], String] &}

Manipulate output

Response to comment

I can't find a definitive statement in the documentation that an internet connection is required for all free-form linguistic input, but the following suggests that it is (just as I thought, too).

Mathematica graphics

share|improve this answer
Thanks, this helps. I really just want the input form of the function, and it looks like I can get it by doing something like WolframAlpha[f, {{"Input", 1}, "Input"}] This is a separate question, but does all of the free-form linguistic input require an internet connection? I see that the WolframAlpha command certainly does, and ideally I'd use something that worked offline as well. – Janet Oct 10 '13 at 23:56
@Janet I believe an internet connection is required. See update. – Michael E2 Oct 11 '13 at 0:20
Thanks! The same thing happens when I try it offline, so that must just be how it is. – Janet Oct 11 '13 at 1:16

Your Answer


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.