Hi,
I am trying to automate computing parameter sensitivities to my model. The question I have is, in the code below, How can I replace the term [p, kb] in the derivative term with a list, so that when I Table through the list, I am computing the sensitivity to the next parameter. For example, the first list should read {p, kb} and the second {ka, p}. I've used ReplacePart thus far and called it pset, which I beleive is correct because I get a list that read ( {p, ka}, {ka,p}) however if I replace the term [p, kb] with pset[[1]], the code fails to compute the derivative. (shown below the working code example). Can someone tell me what I have done incorrectly?
Thank You for your help!
sol = ParametricNDSolve[{
A'[t] == -ka*A[t],
B'[t] == ka*A[t] - kb*B[t],
c'[t] == kb*B[t],
A[0] == 10.0,
B[0] == 0.0,
c[0] == 0.0
},
{A, B, c},
{t, 0.0, 300.0},
{ka, kb}];
Species = {A, B, c};
Table[Species[[i]], {i, 1, 3}]
param = {ka, kb};
ka = 0.1;
kb = 0.2;
pset = Table[ReplacePart[param, i -> p], {i, 1, 2}]
Plot[Evaluate[(Species[[1]][0.1, 0.1][t] + {0, .25, -.25} D[Species[[1]][p, kb], p][t] /. p -> 1) /. sol], {t, 0, 30}, Filling -> {2 -> {3}}]
Plot[Evaluate[(Species[[1]][0.1, 0.1][t] + {0, .25, -.25} D[Species[[1]][pset[[1]]], p][t] /. p -> 1) /. sol], {t, 0, 30}, Filling -> {2 -> {3}}]
Patrick