       DSolveConstants question

• To: mathgroup at smc.vnet.net
• Subject: [mg3712] DSolveConstants question
• From: rich_klopp at qm.sri.com (Richard W. Klopp)
• Date: Wed, 10 Apr 1996 02:12:15 -0400
• Organization: SRI International
• Sender: owner-wri-mathgroup at wolfram.com

```In solving a system of differential equations, I run into the problem of
Mathematica using the same constant of integration for all the equations,
which is an unwanted behavior in my case, but I can't figure out an
elegant workaround. I'd like my integration constants to be indexed the
same as my equations. See the following example.

Define a system of 2 equations:
In:=
feq =
Table[(f[i])'[x] + p[i] f[i][x] + q[i],
{i,1,2}]
Out=
{q + p f[x] + (f)'[x],
q + p f[x] + (f)'[x]}
Solve the equations with the requirement that any constants of integration
be named cnst1[j] and note that, as (unhappily) expected, Mathematica
restarts the index j for cnst[j] with each invocation of DSolve.
In:=
Table[DSolve[feq[[i]] == 0, f[i][x], x,
DSolveConstants -> cnst1], {i,1,2}]
Out=
cnst1   q
{{{f[x] -> -------- - ----}},
x p    p
E

cnst1   q
{{f[x] -> -------- - ----}}}
x p    p
E
THE BOOK, p. 783, says that I can use the option
DSolveConstants -> (Module[{C}, C]&)
to have Mathematica not restart the index, but this does not seem to work.
Unfortunately, the book has no DSolveConstants examples to show how I've
screwed up the systax. Can someone set me straight? I also guess that even
if this did work, it would not be what I want because if there were more
than one constant per equation (higer order equations), then the ith
equation would have the nth and (n+1)th constants, with i != n.
In:=
Table[DSolve[feq[[i]] == 0, f[i][x], x,
DSolveConstants ->
(Module[{cnst2}, cnst2]&)], {i,1,2}]
DSolve::csym:
Value of option DSolveConstants ->
Module[{cnst2}, cnst2] &  must be a symbol.......
Out=
......
What I'd really like is for something like the following to work. That
way, my various integration constants, for example cnst3[i], would have
the same indexing system as my equations. How can I do this?
In:=
Table[DSolve[  feq[[i]] == 0, f[i][x], x,
DSolveConstants -> cnst3[i]   ], {i,1,2}]
DSolve::csym:
Value of option DSolveConstants -> cnst3
must be a symbol.......
Out=
.............

--
Rich Klopp
rich_klopp at qm.sri.com

==== [MESSAGE SEPARATOR] ====

```

• Prev by Date: Re: Trig Simplifications
• Next by Date: complex roots
• Previous by thread: Re: {mg3701] Re: Problem with Diff. Equation
• Next by thread: Re: DSolveConstants question