# Manipulate not showing the four curves I want to manipulate

I've tried to display four functions in a single plot without success and I don't know how I should change my code in order to see the function. Indeed when I run the command I just see the axises but not a single function... Thanks in advance for any tip that might help me with my problem, I link the do-file to the post for you to be able to see my attenpt to do this.

0 < θA
0 < θB
0 < θC
θA > θB
θB > θC
0 < β < 1
0 < cA
0 < cB
0 < cC
0 < Fb
0 < Fc
0 < q1A
0 < q2A
0 < q1B
0 < q2B
0 < q2C
0 < τ
0 < b < 1
0 < p
p < 1
0 < a
c > 0

πAC =
(((1 + β (1 - p)) (a - τ*θA)^2)/(4 (b + c)) +
(β p (a - τ*θC)^2)/(4 (b + c))) - β p*Fc
dAC = d*((1 + β (1 - p)) eA)^2 + d*(β p*eC)^2
dAC =
d*(θA*((1 + β (1 - p)) (a - τ*θA))/(4 (b + c)))^2 +
((β p (a - τ*θC))/(4 (b + c)))^2
csAC =
((1 + β (1 - p)) (a (b + 2 c) + bτ*θA) (a - τ*θA))/(8 (b + c)^2) + (β p (a (b + 2 c) + bτ*θC) (a - τ*θC))/(8 (b + c)^2)
wAC = πAC + dAC + csAC

πAA = (1 + β) ((a - τ*θA)^2/(4 (b + c)))
dAA = d*(eA)^2 + d*(eA)^2
dAA = d*2 (θA*(a - τ*θA)/(4 (b + c)))^2
csAA = ((1 + β) (a (b + 2 c) + bτ*θA) (a - τ*θA))/(8 (b + c)^2)
wAA = πAA + dAA + csAA

πBB = (1 + β) ((a - τ*θB)^2/(4 (b + c))) - Fb
dBB = d*(eB)^2 + d*(eB)^2
dBB = d*2 (θB*(a - τ*θB)/(4 (b + c)))^2
csBB = ((1 + β) (a (b + 2 c) + bτ*θB) (a - τ*θB))/(8 (b + c)^2)
wBB = πBB + dBB + csBB

πBC =
(((1 + β (1 - p)) (a - τ*θB)^2)/(4 (b + c)) +
(β p (a - τ*θC)^2)/(4 (b + c))) - β p*Fc - Fb
dBC = d*((1 + β (1 - p)) eB)^2 + d*(β p*eC)^2
dBC =
d*(θB*((1 + β (1 - p)) (a - τ*θB))/(4 (b + c)))^2 +
(θC (β p (a - τ*θC))/(4 (b + c)))^2
csBC =
((1 + β (1 - p)) (a (b + 2 c) + bτ*θB) (a - τ*θB))/(8 (b + c)^2) +
(β p (a (b + 2 c) + bτ*θC) (a - τ*θC))/(8 (b + c)^2)
wBC = πBC + dBC + csBC

Manipulate[
Plot[{wAA, wAC, wBB, wBC}, {τ, 0, (2 a)/(θB + θC)}],
{a, 2, 3},
{θA, 0, 1},
{θB, 0, 1},
{θC, 0.1, 1},
{c, 0.1, 1},
{b, 0.1, 1},
{p, 0, 1},
{β, 0, 1},
{d, 0, 1}]

• Your initial inequalities do nothing. If you intend for them to be global assumptions you need to add them to \$Assumptions. The control variable names inside the Manipulate are local and do not correspond to the names in the global context. You should define the functions {wAA, wAC, wBB, wBC} with explicit parameters and then when used inside the Manipulate the function arguments will pass the control variable values to the functions. Use Evaluate in the Plot, i.e., Plot[Evaluate@{wAA[...], wAC[...], wBB[...], wBC[...]}, ...] – Bob Hanlon Nov 16 '20 at 17:17

Your sins are many. Here are the ones I found. There may be others, but by correcting (in some cases rather arbitrarily) the ones I noticed, I was able to get a working Manipulate.

1. Writing bτ where you should write b*τ.
2. Writing duplicate definitions for dAC, dAA,dBB,dBC.
3. Not scoping your control variables correctly.
4. Not wrapping your Plot expression with Dynamic.
5. Not defining the variables Fb and Fc.

Here is a rewrite of your code that "fixes" the above mentioned problems, perhaps not your satisfaction. However, it does give a working Manipulate that you can use as a basis for moving forward with code.

With[{Fc = 1, Fb = 7, Fa = 10},
DynamicModule[
{πAC, dAC, csAC, wAC, πAA, dAA, csAA, wAA, πBB, dBB, csBB, wBB, πBC, dBC, csBC, wBC},
Manipulate[
πAC =
(((1 + β (1 - p)) (a - τ*θA)^2)/(4 (b +c)) + (β p (a - τ*θC)^2)/(4 (b + c))) - β* p*Fc;
dAC = d*(θA*((1 + β (1 - p)) (a - τ*θA))/(4 (b + c)))^2 + ((β*p (a - τ*θC))/(4 (b + c)))^2;
csAC =
((1 + β (1 - p)) (a (b + 2 c) + b*τ*θA) (a - τ*θA))/(8 (b + c)^2) + (β*p (a (b + 2 c) + b*τ*θC) (a - τ*θC))/(8(b + c)^2);
πAA = (1 + β) ((a - τ*θA)^2/(4(b + c))) - Fa;
dAA = d*2 (θA*(a - τ*θA)/(4(b + c)))^2;
csAA = ((1 + β) (a (b + 2 c) + b*τ*θA) (a - τ*θA))/(8 (b + c)^2);
πBB = (1 + β) ((a - τ*θB)^2/(4 (b + c))) - Fb/2;
dBB = d*2 (θB*(a - τ*θB)/(4 (b + c)))^2;
csBB = ((1 + β) (a (b + 2 c) + b*τ*θB) (a - τ*θB))/(8 (b + c)^2);
πBC =
(((1 + β (1 - p)) (a - τ*θB)^2)/(4(b + c)) + (β*p (a - τ*θC)^2)/(4(b + c))) - β* p*Fc - Fb;
dBC =
d*(θB*((1 + β (1 - p)) (a - τ*θB))/(4 (b + c)))^2 + (θC (β* p (a - τ*θC))/(4(b + c)))^2;
csBC =
((1 + β (1 - p)) (a (b + 2 c) + b*τ*θB) (a - τ*θB))/(8(b + c)^2) + (β p (a (b + 2 c) + b*τ*θC) (a - τ*θC))/(8(b + c)^2);
wAC = πAC + dAC + csAC;
wAA = πAA + dAA + csAA;
wBB = πBB + dBB + csBB;
wBC = πBC + dBC + csBC;
Dynamic @
Plot[{wAA, wAC, wBB, wBC}, {τ, 0, (2 a)/(θB + θC)},
PlotLegends -> {"wAA", "wAC", "wBB", "wBC"}],
{a, 2, 3},
{θA, 0, 1},
{θB, 0, 1},
{θC, 0.1, 1},
{c, 0.1, 1},
{b, 0.1, 1},
{p, 0, 1},
{β, 0, 1},
{d, 0, 1}]]]


Not certain this does what you need, but it may give you a way forward. Note, one can likely do this more economically, but I wanted to show all the pieces deliberately.

Manipulate[
Module[{wAC, wAA, wBB, wBC},
wAC[a_, b_, c_, β_, p_, θA_, τ_, Fc_, bτ_] :=
Module[{πAC, dAC, csAC},
πAC = (((1 + β (1 -
p)) (a - τ*θA)^2)/(4 (b +
c)) + (β p (a - τ*θC)^2)/(4 (b +
c))) - β p*Fc;
dAC =
d*((1 + β (1 - p)) θA)^2 +
d*(β p*θC)^2;
dAC = d*(θA*((1 + β (1 -
p)) (a - τ*θA))/(4 (b +
c)))^2 + ((β p (a - τ*θC))/(4 (b +
c)))^2;
csAC = ((1 + β (1 - p)) (a (b + 2 c) +
bτ*θA) (a - τ*θA))/(8 (b +
c)^2) + (β p (a (b + 2 c) +
bτ*θC) (a - τ*θC))/(8 (b + c)^2);
πAC + dAC + csAC];

wAA[a_, b_, c_, β_, p_, θA_, τ_, Fc_, bτ_] :=
Module[{πAA, dAA, csAA},
πAA = (1 + β) ((a - τ*θA)^2/(4 (b + c)));
dAA = d*(θA)^2 + d*(θA)^2;
dAA = d*2 (θA*(a - τ*θA)/(4 (b + c)))^2;
csAA = ((1 + β) (a (b + 2 c) +
bτ*θA) (a - τ*θA))/(8 (b + c)^2);
πAA + dAA + csAA];

wBB[a_, b_, c_, β_, p_, θA_, τ_, Fc_, bτ_] :=
Module[{πBB, dBB, csBB},
πBB = (1 + β) ((a - τ*θB)^2/(4 (b + c))) -
Fb;
dBB = d*(θB)^2 + d*(θB)^2;
dBB = d*2 (θB*(a - τ*θB)/(4 (b + c)))^2;
csBB = ((1 + β) (a (b + 2 c) +
bτ*θB) (a - τ*θB))/(8 (b + c)^2);
πBB + dBB + csBB];

wBC[a_, b_, c_, β_, p_, θA_, τ_, Fc_, bτ_] :=
Module[{πBC, dBC, csBC},
πBC = (((1 + β (1 -
p)) (a - τ*θB)^2)/(4 (b +
c)) + (β p (a - τ*θC)^2)/(4 (b +
c))) - β p*Fc - Fb;
dBC = d*((1 + β (1 - p)) θB)^2 +
d*(β p*θC)^2;
dBC = d*(θB*((1 + β (1 -
p)) (a - τ*θB))/(4 (b +
c)))^2 + (θC (β p (a - \
τ*θC))/(4 (b + c)))^2;
csBC = ((1 + β (1 - p)) (a (b + 2 c) +
bτ*θB) (a - τ*θB))/(8 (b +
c)^2) + (β p (a (b + 2 c) +
bτ*θC) (a - τ*θC))/(8 (b +
c)^2); πBC + dBC + csBC];

Plot[{
wAA[a, b, c, β, p, θA, τ, Fc, bτ],
wAC[a, b, c, β, p, θA, τ, Fc, bτ],
wBB[a, b, c, β, p, θA, τ, Fc, bτ],
wBC[a, b, c, β, p, θA, τ, Fc,
bτ]}, {τ, 0, (2 a)/(θB + θC)}]
],
{a, 2, 3},
{θA, 0, 1},
{θB, 0, 1},
{θC, 0.1, 1},
{c, 0.1, 1},
{b, 0.1, 1},
{p, 0, 1},
{β, 0, 1},
{d, 0, 1},
{Fc, 0, 1},
{Fb, 0, 1},
{bτ, 0, 1}
]


Also note that it does not appear that your original code set any values for Fc, Fb, or bτ. I simply added them to the Manipulate in this answer, but you may need/want to assign a different range of values.

• Thanks a lot for your tip it's true that the tau time b was not intentional and this mess up the graph. I still need to be able to change the value of both Fb and Fc and I've managed to get what I wanted taking back your answers! Thanks a lot again! – Xavier Koch Nov 17 '20 at 13:32
• You're welcome. Do take a look at the answer from @m_goldberg. It provides lots of insight. If either of the answers you've received help, vote them up. If one better answers your problem, check it as the answer. – Jagra Nov 17 '20 at 17:30