# Basic Gaussian Function Plot [closed]

I'm new to Mathematica and I'm trying to plot a Gaussian function (actually a sum of three Gaussian functions) using custom x-axis tick marks.

Here's what I have so far:

a0 = QuantityMagnitude[UnitConvert[Quantity[1, "BohrRadius"]]];
c1 = 0.154329;
c2 = 0.535328;
c3 = 0.444635;
a1 = 2.227660;
a2 = 0.405771;
a3 = 0.109818;
z1 = (2 * a1 / pi)^(3/4) Exp[-a1 * (x / a0)^2];
z2 = (2 * a2 / pi)^(3/4) Exp[-a2 * (x / a0)^2];
z3 = (2 * a3 / pi)^(3/4) Exp[-a3 * (x / a0)^2];
Plot[y = a0^(-3/2) * (c1 * z1 + c2 * z2 + c3 * z3),
PlotRange -> {{-15a0, 15a0}},
Ticks -> {Table[{k a0, Style[If[k > 1, Row[{k, Subscript[a, 0]}], Subscript[a, 0]],
Small]},
{k, -15, 15}], Automatic}]


I'm getting a really basic error (Plot::argr: Plot called with 1 argument; 2 arguments are expected.), but I'm not sure where I'm going wrong.

EDIT: Thanks to Alexei Boulbitch, here's my final code after edits.

a0 = QuantityMagnitude[UnitConvert[Quantity[1, "BohrRadius"]]];
Subscript[c, 1] = 0.154329;
Subscript[c, 2] = 0.535328;
Subscript[c, 3] = 0.444635;
a1 = 2.227660;
a2 = 0.405771;
a3 = 0.109818;
Subscript[\[Phi], 1] = (2*a1/Pi)^(3/4) Exp[-a1*(x/a0)^2];
Subscript[\[Phi], 2] = (2*a2/Pi)^(3/4) Exp[-a2*(x/a0)^2];
Subscript[\[Phi], 3] = (2*a3/Pi)^(3/4) Exp[-a3*(x/a0)^2];
Subscript[\[Psi], 1s] = a0^(-3/2)*(Subscript[c, 1] * Subscript[\[Phi], 1] +
Subscript[c, 2] * Subscript[\[Phi], 2] +
Subscript[c, 3] * Subscript[\[Phi], 3]);
Subscript[\[Psi], 1sActual] = a0^(-3/2) / Sqrt[Pi] * Exp[-x/a0];
str = ToString[Subscript["\[Psi]", "1s"], StandardForm];
Plot[{Subscript[\[Psi], 1s], Subscript[\[Psi], 1sActual]}, {x, 0, 7a0},
PlotLegends-> "Expressions",
Ticks -> {Table[{k a0, Style[If[k > -8, Row[{k, Subscript[a, 0]}],
Subscript[a, 0]],
Small]},
{k, 0, 7}], Automatic}]
Plot[{Subscript[\[Phi], 1], Subscript[\[Phi], 2], Subscript[\[Phi], 3],
(Subscript[c, 1] * Subscript[\[Phi], 1] + Subscript[c, 2] *
Subscript[\[Phi], 2] +
Subscript[c, 3] * Subscript[\[Phi], 3])}, {x, -7a0, 7a0},
PlotRange -> {{-7a0, 7a0}, {0, 1.35}},
PlotLegends-> "Expressions",
Ticks -> {Table[{k a0, Style[If[k > -8, Row[{k, Subscript[a, 0]}], Subscript[a, 0]],
Small]},
{k, -7, 7}], Automatic}]

• You did not specify the range of Plot's argument (presumably x); the option PlotRange serves a different purpose, check the documentation, you do not need to use the assignment operator inside plot (just specify the expression you want to plot), defining functions the way you did is generally bad practice (z1[x_] = ... would be better, so that x is explicitly an argument of Plot. Read the error message! You supplied plot with 1 argument -- the expression, you didn't give the 2nd argument: the variable and its limits. VTC as "simple mistake". – LLlAMnYP Jun 2 '17 at 8:28
• ...as "simple mistake", but realistically, consult the documentation to find out the proper syntax of Plot. Try it with a simpler example first. – LLlAMnYP Jun 2 '17 at 8:29
• Oh yeah, pi is undefined. Mathematica's symbol names are case-sensitive, you're looking for the built-in Pi. – LLlAMnYP Jun 2 '17 at 8:31

I propose that you start from this:

a0 = 1;
c1 = 0.154329;
c2 = 0.535328;
c3 = 0.444635;
a1 = 2.227660;
a2 = 0.405771;
a3 = 0.109818;
z1 = (2*a1/Pi)^(3/4) Exp[-a1*(x/a0)^2];
z2 = (2*a2/Pi)^(3/4) Exp[-a2*(x/a0)^2];
z3 = (2*a3/Pi)^(3/4) Exp[-a3*(x/a0)^2];
Plot[a0^(-3/2)*(c1*z1 + c2*z2 + c3*z3), {x, -1, 1}] and then one-by-one add your options and change the definitions. Then you will see what's wrong. One tip: this a0 = QuantityMagnitude[UnitConvert[Quantity[1, "BohrRadius"]]] creates a part of your troubles.