# Passing an expression to the Plot Function does not Work

Solving a differential equation I found that its solution was analytic, and I stored it as an expression from the default rule output of the DSolve[] function:

soleq2 = y[x] /. soleq2[[1, 1]]

Which has output:

Sqrt[x] BesselJ[Sqrt[13]/2, x] C[1] + Sqrt[x] BesselY[Sqrt[13]/2, x] C[2]

I then plotted this:

Manipulate[Plot[soleq2, {x, 0, 10}], {C[1], 0, 10}, {C[2], 0, 10}]

but the plot does not show anything, only the sliders for the modulation of C[1] and C[2]. I tried substituting these constants with other letters thinking their format might interfere with the kernel, but to no avail.

• See the "Possible Issues" section of the documentation for Manipulate where it explains that, and gives an example for, Manipulate only "notices" explicit visible parameters. Jan 13, 2021 at 17:09

It is because your control variables are not local to Manipulate. One way around it is

soleq2 = Sqrt[x] BesselJ[Sqrt[13]/2, x] C[1] +
Sqrt[x] BesselY[Sqrt[13]/2, x] C[2];
Manipulate[
Plot[soleq2 /. {C[1] -> c[1], C[2] -> c[2]}, {x, 0, 10}],
{c[1], 0, 10},
{c[2], 0, 10},
TrackedSymbols :> {c[1], c[2]}
]


Or you could move the expression inside Manipulate, so it "sees" C[1] and C[2]

Manipulate[
soleq2=Sqrt[x] BesselJ[Sqrt[13]/2,x] C[1]+Sqrt[x] BesselY[Sqrt[13]/2,x] C[2];
Plot[soleq2,{x,0,10}],
{C[1],0,10},
{C[2],0,10},
TrackedSymbols:>{C[1],C[2]}
]