[Date Index]
[Thread Index]
[Author Index]
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[1]:=
feq =
Table[(f[i])'[x] + p[i] f[i][x] + q[i],
{i,1,2}]
Out[1]=
{q[1] + p[1] f[1][x] + (f[1])'[x],
q[2] + p[2] f[2][x] + (f[2])'[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[2]:=
Table[DSolve[feq[[i]] == 0, f[i][x], x,
DSolveConstants -> cnst1], {i,1,2}]
Out[2]=
cnst1[1] q[1]
{{{f[1][x] -> -------- - ----}},
x p[1] p[1]
E
cnst1[1] q[2]
{{f[2][x] -> -------- - ----}}}
x p[2] p[2]
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[3]:=
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[3]=
......
What I'd really like is for something like the following to work. That
way, my various integration constants, for example cnst3[i][1], would have
the same indexing system as my equations. How can I do this?
In[4]:=
Table[DSolve[ feq[[i]] == 0, f[i][x], x,
DSolveConstants -> cnst3[i] ], {i,1,2}]
DSolve::csym:
Value of option DSolveConstants -> cnst3[1]
must be a symbol.......
Out[4]=
.............
--
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**
| |