1

When I enter f(x) in Mathematica, the f(x) appears as f (x). There's too much space between f and (x). How do I enter f(x)? For eg) ab appears normal in Mathematica but when I enter f(x) there's extra space between f and (x).

David G. Stork
  • 41,180
  • 3
  • 34
  • 96
  • 3
    Mathematica uses square brackets instead of parentheses for functions. Try f[x] rather than f(x). – JimB Aug 23 '18 at 04:30
  • I'm practicing maths on my computer so the symbols need to be same. – user2134128 Aug 23 '18 at 04:33
  • 8
    If you're practicing formatting mathematical statements, Mathematica may not be the best tool for that. Maybe try LaTeX or a similar system, such as LibreOffice's mathematical formula editor. Mathematica needs to adhere to certain conventions to be usable as a language, and one of these conventions is that functions are written f[x]. This is because Mathematica allows and intends for f(x) to be interpreted as f * x, which is where the extra space comes from. – eyorble Aug 23 '18 at 04:48
  • The spacing will be fine as long as you make sure you're entering the expression in TraditionalForm. You can do this in an ordinary input cell by following the steps I described in this answer. But you have to distinguish between input cells and mathematical typesetting. If you want solely the latter, it would be better to choose an appropriate cell style from the Format menu first. – Jens Aug 23 '18 at 06:04
  • Thanks. Going to Cell -> Convert to -> Traditional Format worked. – user2134128 Aug 23 '18 at 06:38
  • 1
    Do note that ab in Mathematica is interpreted as a single symbol, not $a\times b$. – user202729 Aug 23 '18 at 08:58

1 Answers1

11

You can use f(x) in Mathematica. These are the steps. Open preferences, and look for CommonDefaultFormatTypes then change the Input and Output to TraditionalFormat, like this

Mathematica graphics

Mathematica graphics

Mathematica graphics

Now you can write

  Plot(sin(x),{x,-Pi,Pi})

and

f(x_) := x^2;
Plot(f(x), {x, 0, 2})

and it work

Mathematica graphics

You'll get this message from Mathematica first time

Mathematica graphics

You can click Always so it do not show again.

I would not use this method as it can cause problems as the message above says, but it is something you can try if you want to enter math as traditional format.

Nasser
  • 143,286
  • 11
  • 154
  • 359