| Author |
Comment/Response |
Rhys Ulerich
|
11/24/07 1:04pm
For some perturbation problems, I'm having trouble extracting terms of a desired variable order from a larger expression. Given
eqn22 = {
\[Epsilon]*y''[x] + 2 y'[x] + y == 0,
y[0] == 0,
y[1] == 1
};
with a particular solution form like
youter =
y0[x] + \[Epsilon]*y1[x] + \[Epsilon]^2*y2[x];
I can substitute my outer expansion into eqn22
expanded = ExpandAll[eqn22 /. y -> youter]
which gives me a list containing three equations. Each equation includes terms of order \[Epsilon]^0, \[Epsilon]^1, \[Epsilon]^2.
I'd like to extact three lists, one for each order (with the ultimate goal of using DSolve in sequence to find y0[x], y1[x], y2[x]). From reading and playing around with Position, Extract, Cases, DeleteCases, etc I can't quite find the special sauce to extract what I'd like, i.e.
{
2y0'[x] + y0[x] == 0,
(* BC1 *), (* BC2 *)
}
{
\[Epsilon] (
y0''[x] + 2 y1'[x] + y1 == 0
)
(* BC1 *), (* BC2 *)
}
{
\[Epsilon]^2 (
y1''[x] + 2 y2'[x] + y2 == 0
)
(* BC1 *), (* BC2 *)
}
Any tricks/tips/suggestions?
Thank you,
Rhys
URL: , |
|