# Manipulate Solve for initial condition

I have a series of $n$ coefficients with parameters $r$ and $b$ that sum up to one. But there i also the initial condition value $c1$ that i required to obtain this normalization. I want to find this $c1$ for each $r$ and $b$ value plug it back in to my table and plot those values. I used manipulate as follows:

     ClearAll["Global"];
clc;
a = 1/(1 - b*r);
c = (1 - r - b*r (1 - r*b))/((1 - b*r) (b - 1)*r);

Manipulate[
solveC1 =
Solve[Total[Table[N[1/(c1*n!)*((-1)^n*FactorialPower[a, n]) +
1/n!*Sum[(k - n)*Binomial[n, k]*(-1)^(n - k)*FactorialPower[a, n - k], {k,                            1, n}]], {n, 0, 20}]] == 1, c1];
Print[c1 /. solveC1], {r, 0.001, 1}, {b, 0.001, 1}]


Please bear with me and let me know of any suggestion you have as I'm a beginner in Mathematica.

Thanks.

• Your brackets and parenthesis don't balance Oct 24, 2014 at 16:54
• sorry I had simplified the equation and in that process missed a parenthesis. Oct 24, 2014 at 17:02
• I do not understand your code at all. You have 2 control variables r and b, yet they do not appear anywhere in the Manipulate expression. Before jumping to using Manipulate, you should first test your code as standalone, on a cell by its own, to make sure it even works. You can enter some values for the parameters. Then when it is working, you can use Manipulate to automate things. Oct 24, 2014 at 17:06
• @Nasser $FactorialPower[a, n]$ the $a=\frac{1}{1-br}$ and that's how this depends on b and r. Oct 24, 2014 at 17:15
• But this code is not in the Manipulate expression. You should put all control variables dependent code inside Manipulate. Oct 24, 2014 at 17:17

Manipulate[
solveC1 = Quiet@Solve[(Total[t[b, r]]) == 1, c1];
ListLinePlot[t[b, r] /. solveC1, PlotRange -> All],
{r, 0.001, 1},
{b, 0.001, 1},
Initialization :> {a[b_, r_] := 1/(1 - b*r),
t[b_, r_] := Table[N@1/(c1*n!)*((-1)^n*FactorialPower[a[b, r], n]) +
1/n!*Sum[(k - n)*Binomial[n, k]*(-1)^(n - k)*
FactorialPower[a[b, r], n - k], {k, 1, n}], {n, 0, 20}]}]
` • This is working thanks. My question is that how would you plug this back into the equation to plot different entries in the Table? Using Manipulate and DiscretePlot? Oct 24, 2014 at 17:29