Message Boards Message Boards

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

Is it posiblle to use something alike f@() to instead of function call f[]

Posted 10 years ago

I learned C and Java before learning Mathematica. So I don't like using f[] to call a function. Is it posiblle use other symbols to instead of f[]?

Prime@4 (worked!, return 7)

Plot@( x, {x, 0, 6 Pi} ) (Syntax::sntxf: "(" cannot be followed by "x,{x,0,6Pi})".)}

Plot @@ {Sin@x, {x, 0, 6 Pi}} (worked!)

POSTED BY: Cody Luo
2 Replies
Posted 10 years ago

Here are three ways of calling a function:

f[n_] := n + 5

f[10]
f@10
10 // f

All we give 15.

POSTED BY: Priyan Fernando

Plot @@ {Sin@x, {x, 0, 6 Pi}}will work most of the time. However, this syntax does not protect the variable x from ouside assignments: x = 1; Plot @@ {Sin@x, {x, 0, 6 Pi}} will give an error, because the x will be given the value 1 before Plot starts its job.

POSTED BY: Gianluca Gorni
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