Re: DSolve with recursively defined equations

*To*: mathgroup at smc.vnet.net*Subject*: [mg53772] Re: DSolve with recursively defined equations*From*: Roland Franzius <roland.franzius at uos.de>*Date*: Thu, 27 Jan 2005 05:41:07 -0500 (EST)*Organization*: Universitaet Hannover*References*: <ct7psr$ld$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

pdickof at sasktel.net wrote: > DSolve can handle this.... > eq[0] = n0'[d] == -r n0[d]; > eq[1] = n1'[d] == r(n0[d] - n1[d]); > eq[2] = n2'[d] == r(n1[d] - n2[d]); > in[0] = n0[0] == 1; > in[1] = n1[0] == 0; > in[2] = n2[0] == 0; > eqns = Flatten[Table[{eq[i], in[i]}, {i, 0, 2}]]; > funcs = {n0[d], n1[d], n2[d]}; > DSolve[eqns, funcs, d] > > ...but when I try to generalize to the following ... > Remove[nn, eq, in, eqns, funcs]; > iCount=2; > eq[0] = nn'[0, d] == -r nn[0, d]; > eq[i_] := nn'[i, d] == r(nn[i - 1, d] - nn[i, d]); > in[0] = nn[0, 0] == 1; > in[i_] := nn[i, 0] == 0; > eqns = Flatten[Table[{eq[i], in[i]}, {i, 0, iCount}]]; > funcs = Table[nn[i, d], {i, 0, iCount}]; > DSolve[eqns, funcs, d] > > ...I get the message > DSolve::bvnul: For some branches of the general solution, \ > the given boundary conditions lead to an empty solution. > > I don't understand the difference. Is it possible to generalize as > above? Is it possible to obtain a general solution for the ith > equation? What are the relevant sections in the documentation? nn'[1,d] is defined as the Derivative wrt. to the first argument and even this notation is misinterpreted by Mathematica if you swap 1,d. Working alternatives: Separate index and Variable Remove[nn, eq, in, eqns, funcs]; iCount = 2; eq[0] = nn[0]'[d] == -r nn[0][d]; eq[i_] := nn[i]'[d] == r(nn[i - 1][d] - nn[i][d]); in[0] = nn[0][0] == 1; in[i_] := nn[i][0] == 0; eqns = Flatten[Table[{eq[i], in[i]}, {i, 0, iCount}]]; funcs = Table[nn[i][d], {i, 0, iCount}]; DSolve[eqns, funcs, d] or write Derivative's arguments explicitely eq[0] = D[nn[d,0,d]] == -r nn[d,0]; eq[i_] := D[nn[i,d],d] == r(nn[i - 1,d] - nn[i,d]); etc. -- Roland Franzius