Message Boards Message Boards

0
|
8460 Views
|
3 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Show the output of defining a function

Posted 10 years ago

Hi,

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
Posted 10 years ago

Oh, Thanks!

POSTED BY: Hang Zhao

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

POSTED BY: S M Blinder
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract