Message Boards Message Boards

0
|
4443 Views
|
2 Replies
|
3 Total Likes
View groups...
Share
Share this post:

how can i define a function in mathematica?

Posted 10 years ago

I am new in Mathematica.

in matlab i define a function as: f(x)=x+1 then if i type f(2) answer is 3. how can i do this in mathematica.

POSTED BY: esi fn
2 Replies

It would be good for you to start to read the documentation and work through examples to learn the language. If you take the approach of trying to translate everything you know in Matlab into Mathematica that will take you a very long time to learn Mathematica in its own right and will cause you confusion at every turn.

Read the documentation. A good place to start to get an overview of things is here:

http://www.wolfram.com/language/fast-introduction-for-programmers/

And a very good recent book to learn the language as a whole is the following:

http://www.amazon.com/Programming-Mathematica-Introduction-Paul-Wellin/dp/1107009464/

POSTED BY: David Reiss

In Mathematica, if you want to define a function, say x+y+z, we have to the following, f[x_ , y_ ,z_] := x+y+z (shift+enter) f[2,1,3]=6 for further information, see documentation.

POSTED BY: suvadip mandal
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