MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How build a function repeating the same pattern?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg58482] Re: How build a function repeating the same pattern?
  • From: "dkr" <dkrjeg at adelphia.net>
  • Date: Mon, 4 Jul 2005 02:24:03 -0400 (EDT)
  • References: <da5j11$20n$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

In[1]:=
sss[w:{_,_List,_}..]:={w}/.{m_/;(Head[m]=!=List),n_List,t_}:>{m,Transpose[n],
              t}/.{m_/;(Head[m]=!=List),n_List,t_}:>
          Plus@@((m/.t->n[[1]])*n[[2]]/n[[3]])/.{a__}:>Plus[a];

In[2]:=
 q1[t_] = a1*Exp[(-b1)*t]; q2[t_] = a2*Exp[(-b2)*t];
 q3[t_] = a3*Exp[(-b3)*t];

In[3]:=
sss[{q1[t],{{t11,m11,s11},{t12,m12,s12}},
    t},{q2[t],{{t21,m21,s21},{t22,m22,s22},{t23,m23,s23}},t}]

Out[3]=
(a1*m11)/(E^(b1*t11)*s11) + (a1*m12)/(E^(b1*t12)*s12) +
  (a2*m21)/(E^(b2*t21)*s21) + (a2*m22)/(E^(b2*t22)*s22) +
  (a2*m23)/(E^(b2*t23)*s23)

In[4]:=
sss[{q1[t],{{t11,m11,s11},{t12,m12,s12}},
    t},{q2[t],{{t21,m21,s21},{t22,m22,s22},{t23,m23,s23}},
    t},{q3[t],{{t31,m31,s31}},t}]
Out[4]=
(a1*m11)/(E^(b1*t11)*s11) + (a1*m12)/(E^(b1*t12)*s12) +
  (a2*m21)/(E^(b2*t21)*s21) + (a2*m22)/(E^(b2*t22)*s22) +
  (a2*m23)/(E^(b2*t23)*s23) + (a3*m31)/(E^(b3*t31)*s31)


  • Prev by Date: Re: Simple List manipulation question
  • Next by Date: Re: Simple List manipulation question
  • Previous by thread: Re: How build a function repeating the same pattern?
  • Next by thread: how to find n in expression x^n using a pattern?