Let's say I have several equations that have solutions given as a negative series
$$y(t,x)=\sum_{n=-1}^\infty a_n(t) x^{-n}=a_{-1}x+a_0+a_1x^{-1}+\mathcal{O}(x^{-2})$$
My equations look like
$$eqns=\mathcal{O}(x^{n})$$
where RHS is given for each equation. Now what that means is that after putting my ansatz of solution in the equation, all the powers smaller than ones given by RHS will cancel each other out, and I'll end up with equations for my coefficients $a_n$.
For instance
$$2\frac{\partial}{\partial t}y+3y=\mathcal{O}(1)$$ $$2(a_{-1}'x+a_0'+\mathcal{O}(x^{-1}))+3(a_{-1}x+a_0+\mathcal{O}(x^{-1})=\mathcal{O}(1)$$
which gives me
$$2a_{-1}'x+3a_{-1}x=0$$
which can now be solved and used elsewhere, for other coefficients etc.
This is simple example since I have only one solution, but in reality I'm dealing with a solution that is vector with 4 components that have similar expansion for each component, that's why I'd like to speed up the process by finding out what each component will look like.
Now I can get the equations in Mathematica, and I have even made a simple ansatz (different than this ofc)
y = Sum[a[#1][n] #2^-n, {n, -1, 4}] &;
And I can input that in to my equations, and with Collect I can gather all the 'stuff' with all the powers of x.
Now I'd like to see if there is any way that I can make Mathematica give me the coefficient equation, and all I need to do is specify which parts of the equation with series needs to be kept (in my examples all the $\mathcal{O}(1)$ parts cancel each other so I'm neglecting all the $x^0, x^{-1},...$ parts in my ansatz).
Because the way I'm doing it now is just inputing it all, collecting and seeing what is $\mathcal{O}(x^n)$ for each component and manually have to solve it.
SolveAlways, and specifically it's handling ofSeriesinput. – Daniel Lichtblau Nov 07 '13 at 16:04y[t, x] := Sum[a[#1][n] #2^-n, {n, -1, 4}]&;is what you want. You probably wanty = Sum[a[#1][n] #2^ -n, {n, -1, 4}]&;, or perhaps,y[t_, x_] := Sum[a[t][n] x^-n, {n, -1, 4}]. See this answer for details. – m_goldberg Nov 07 '13 at 16:12