I have a file of models that I have saved that I want to be able to call in another program to be solved with NDSolve. Can I use Cases to select each model based upon the m# tag given in the model list? I've tried to avail the following.
test = {
{
m1->
{
{ul'[t]==k1p*s*(1-ul[t])/(km1+(1-ul[t]))-k2p*ul[t]/(km2+ul[t])-
k5p*ul[t]*um[t]/(km5+ul[t])},
{um'[t]==k3p*uc[t]*(1-um[t])/(km3+(1-um[t]))-k4p*um[t]/(km4+um[t])},
{uc'[t]==k6p*ul[t]*(1-uc[t])/(km6+(1-uc[t]))-k7p*uc[t]/(km7+uc[t])}
},
{ul[0]==0.,um[0]==0.,uc[0]==0.0},
{s, k1p, km1, k2p, km2, k5p, km5, k3p, km3, k4p, km4, k6p, km6, k7p, km7}
},
{
m2->
{
{ul'[t]==k1p*s*(1-ul[t])/(km1+(1-ul[t]))-k2p*ul[t]/(km2+ul[t])-
k5p*um[t]*ul[t]/(km5+ul[t])},
{um'[t]==k3p*ul[t]*(1-um[t])/(km3+(1-um[t]))-k4p*um[t]/(km4+um[t])}
},
{ul[0]==0.,um[0]==0.},
{s, k1p, km1, k2p, km2, k5p, km5, k3p, km3, k4p, km4}
}
}
openModel[modelName_] := Cases[test, modelName]
openModel[m1]
I adjusted my answer accordingly.
– Jinxed Jan 26 '15 at 17:45models. – m_goldberg Jan 26 '15 at 22:58