multiple subscripted variables in NDSolve; dsfun
- To: mathgroup at smc.vnet.net
- Subject: [mg21979] multiple subscripted variables in NDSolve; dsfun
- From: "stephen e. schwartz" <ses at bnl.gov>
- Date: Mon, 7 Feb 2000 13:02:31 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Hello All, this is my first question to this newsgroup (at least in its
present incarnation), so please forgive me if I violate any conventions or
am asking a faq, but I have made what I think is a reasonably diligent
search.
I am attempting to use NDSolve (Mathematica 4.0.1.0, mac) to solve a set of coupled
ODEs in the time variable t. Initially I had a set of variables a[i][t],
which solve just fine. The index [i] ranges {1, nc}
Then I wanted to add another set of variables mn[i][t]. Attempts to solve
the set (it is still a set of ODEs) brings the response:
NDSolve::dsfun: "{a[1][t], mn[1][t]} cannot be used as a function"
I had defined the argument of NDSolve as a table,
NDSolve[{eq, ic}, Table[{a[i][t], mn[i][t]}, {i, nc}] where eq, ic are
tables of equations and initial conditions, resp.
If I "fool" Mathematica by renaming the variable mn[i] as a[i + nc] and suitably
modify my equations and initial conditions, and the range if the index, the
set solves just fine, although I am very unhappy about the notation in that
a and mn represent very different variables.
So, am I correct in inferring that the compact notation for a set of
coupled indexed equations (Mathematica book, 4th ed, sec 3.9.7, page 926) works
only for a single variable name?
Is there a more elegant fix?
By the way, I am kind of surprised that a search for dsfun on
http://smc.vnet.net/mathgroupsearch.html
didnt yield any hits. Was I looking in the wrong place?
My esteem to you all, and thanks in advance; a copy of any response to me,
ses at bnl.gov, would be greatly appreciated.
-steve
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PLEASE NOTE NEW AREA CODE: 516 --> 631
Stephen E. Schwartz, Senior Scientist mailto:ses at bnl.gov
Environmental Chemistry Division Phone: (631) 344-3100
Brookhaven National Laboratory Fax: (631) 344-2887
Bldg. 815E (75 Rutherford Dr.) PO Box 5000 Sec'y: (631) 344-3275
Upton NY 11973-5000 ftp://ftp.ecd.bnl.gov//pub/steve
Home Page: http://www.ecd.bnl.gov/steve/schwartz.html
Secretary: Maggie Marsch (mailto:mmarsch at bnl.gov)
Tropospheric Aerosol Program (TAP) Home Page: http://www.tap.bnl.gov
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Follow-Ups:
- Re: multiple subscripted variables in NDSolve; dsfun
- From: "stephen e. schwartz" <ses@bnl.gov>
- Re: multiple subscripted variables in NDSolve; dsfun
- From: Hartmut Wolf <hwolf@debis.com>
- Re: multiple subscripted variables in NDSolve; dsfun