Message Boards Message Boards


Show the output of defining a function

Posted 9 years ago
3 Replies
1 Total Likes


Do you know how to let mathematica show the output when you are defining a function? I'm using Mathematica 10, and whenever i define a function, mathematica just shows input[1], and never gives the output[1], though the definition is executed successfully. I want to know how to let mathematica show the output. Thanks for your help! :)

POSTED BY: Hang Zhao
3 Replies

A correct way to look at the definition is with ?f.

If you define f[x_]=x^2 (without colon) you will see the output straight away.

If you define f[x_]:=x^2 (with colon) there is no output.

In most common situations the input f[x] will give the answer you expect, but not for example when f[x_]:=RandomReal[].

Look up SetDelayed and Set in the documentation.

POSTED BY: Gianluca Gorni

After you define f[x_]:= . . ., input f[x]

POSTED BY: S M Blinder
Posted 9 years ago

Oh, Thanks!

POSTED BY: Hang Zhao
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract