what is the general theory of extracting solutions from DSolve (and similar) functions
- To: mathgroup at smc.vnet.net
- Subject: [mg45553] what is the general theory of extracting solutions from DSolve (and similar) functions
- From: nma124 at hotmail.com (steve_H)
- Date: Tue, 13 Jan 2004 04:04:06 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
hello,
I am learning Mathematica (Mathematica 5.0) and I am having hard time finding
a general method that works everytime to extract solutions
from output of DSolve and other Mathematica functions that generates
solutions in the same format.
I have seen examples that work when the solution contains
only one result.
I have read that the output of DSolve is in triple nested
format.
I have seen examples that Flattens the output of DSolve before doing
anything on it to remove the extra nesting.
Now, Assuming I want to do this in a script (i.e. without looking
at the output of DSolve), so I need to assume there is more
than one solution.
I tried to write
[r,c]=Dimensions[sol]
to see how many solutions there are, but this failed when there is only one
solution. (sol above is the result of calling DSolve).
I've seen things written like this:
sol = DSolve[{y'[x] == a y[x], y[0] == 1}, y[x], x]
y = First[y[x] /. sol]
but this assume there is one solution. right?
I am interested in plotting all the solutions, so I guess I need to
have a loop that extracts each solution in turn from the output
of DSolve and plots each in turn.
is there a good way to do this? A general generic approach which
works everytime regardless of the number of solutions?
thanks,
Steve