Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

How build a function repeating the same pattern?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg58436] How build a function repeating the same pattern?
  • From: guillerm at aida.usal.es
  • Date: Sat, 2 Jul 2005 04:06:52 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

(*I have built this function*)

ss[ model1_, list1_, model2_, list2_, t_] := Module[{t1, y1, s1, t2,
y2, s2,a, b},{t1, y1, s1} = Transpose[list1];
{t2, y2, s2} = Transpose[list2];
a = model1 /. t -> t1; b = model2 /. t -> t2;
Plus @@ (a y1/s1) + Plus @@ (b y2/s2)];

(*It works as I wish. Example*)

q1[t_] = a1 Exp[-b1 t]; q2[t_] = a2 Exp[-b2 t];
ss[ q1[t], {{t11, m11, s11}, {t12, m12, s12} }, q2[t], {{t21, m21,
      s21}, {t22, m22, s22}, {t23, m23, s23}}, t]

Now  I want to extend this function such as the pattern  "model, list"
can be repeated any number of times.Example


q3[t_] = a3 Exp[-b3 t];

ss[ q1[t], {{t11, m11, s11}, {t12, m12, s12} },
q2[t], {{t21, m21, s21}, {t22,m22, s22}, {t23, m23, s23}}, q3[t],
{{t31, m31, s31}}, t]

Any help?

Guillermo


  • Prev by Date: Re: Integrate and Boole problems
  • Next by Date: Re: Explicit solution to Root[]
  • Previous by thread: Re: Re: How to suppress plot output ?
  • Next by thread: Re: How build a function repeating the same pattern?