# Manipulate[Plot[A[X]…, returns no output [duplicate]

Here is my simple code:

A[X_] := a*X^2 - b/a^2* X^3;

B[X] = A[X]^2;

Manipulate[Plot[B[X], {X, 0, 10}], {a, 1, 3}, {b, 0, 2}]

After running the cell I get a frame of a plot with two sliders for a and b, but no graph. I know If I replace B[X] with (aX^2 - b/a^2 X^3)^2 in the Manipulate[Plot[..., it'll work. However without this replacement, I'm wondering if this is a limitation of Manipulate or I'm not doing something right.

• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – Michael E2 Jul 2 '16 at 0:39

## Example

Description

There is a number of errors in your code.

Manipulate[Plot[B[X], {X, 0, 10}], {a, 1, 3}, {b, 0, 2}]


In code above, you have a Manipulate which has three controls (X, a and b). The subject of your manipulation is Plot[B[X]], where B[X] takes a single argument X. Therefore, a and b are not utilized; hence an empty Plot.

Recommendation

Avoid using capital letters for your variable declaration. It's considered bad practice. Additionally, you may run into conflicts with in-built functions.

Code

A[x_, a_, b_] := a*x^2 - b/a^2*x^3;

B[x_, a_, b_] := A[x, a, b]^2;

Manipulate[Plot[B[x, a, b], {x, 0, 10}], {a, 1, 3}, {b, 0, 2}]


Output

• I'm sorry from being picky but while this gives one workaround it doesn't give the explanation. "B[X] takes a single argument X. Therefore, a and b are not utilized; hence an empty Plot." - not true, a and b are localized so they are different from those from definitions. Use LocalizeVariables->True, fix B[X]= to B[X_], add a;b; just before Plot so that Manipulate is aware it should be updated and it will work. While it isn't handy it shows that your explanation is missleading. – Kuba Jul 2 '16 at 8:52
• @Kuba please, there is nothing to apologise for. To be honest, I didn't even know about LocalizeVariables`. So, please do edit the answer as you find it appropriate to reduce any ambiguity and improve its quality. I will read-up about it! – e.doroskevic Jul 2 '16 at 10:54