Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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


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


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.

share|improve this question
I can't say I really follow all this, but you might want to look into SolveAlways, and specifically it's handling of Series input. –  Daniel Lichtblau Nov 7 '13 at 16:04
I don't think y[t, x] := Sum[a[#1][n] #2^-n, {n, -1, 4}]&; is what you want. You probably want y = 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 7 '13 at 16:12
It won't do exactly what you are asking but perhaps my Summa package (or some of the code you will find in the package - it really is small) could help you streamline your tasks. Have a look here mathematica.stackexchange.com/questions/31426/… for a version amended by a MMA SE poster to work with the latest versions of Mathematica. –  Peltio Nov 7 '13 at 21:31
@m_goldberg: y=Sum... is what I meant, I have that in my notebook, dunno why I wrote that. I'll look at this package. Thanks :) –  dingo_d Nov 8 '13 at 8:57
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.