# Why is g[x] handled differently as f[x] from Mathematica? [closed]

When I execute this code:

\[Sigma] = 0.3;
\[Mu] = 5;
xmax = 10;
f[x_]= Exp [-(1/2) ((x - \[Mu])/\[Sigma])^2]/(\[Sigma]*Sqrt[2*\[Pi]]);
Plot[f[x], {x, 0, xmax}, PlotRange -> {0, +2}]


I get the plot: But when I change f to g..

\[Sigma] = 0.3;
\[Mu] = 5;
xmax = 10;
g[x_]= Exp [-(1/2) ((x - \[Mu])/\[Sigma])^2]/(\[Sigma]*Sqrt[2*\[Pi]]);
Plot[g[x], {x, 0, xmax}, PlotRange -> {0, +2}]


I do not get anything: Do we always have to use f as the function being plotted? Or am I missing something important here?

• Works for me. I think you have a cached definition. Try Clear[g] and give it another go – b3m2a1 Jan 14 at 22:25
• Ohh, I didn't know that there is such a thing. I will check. Can I disable caching completely? – Gouz Jan 14 at 22:27
• Nah. It's how the functions are built into the system. Basically a bunch of pattern rules. But that means you might have an extant pattern for g or one of the constants or something that's getting in the way. – b3m2a1 Jan 14 at 22:28
• It worked. Thanx – Gouz Jan 14 at 22:30
• I always start my function definitions with ClearAll[g] (for func. g). That's how I disable cached definitions. – Michael E2 Jan 14 at 22:47