I have some equation:
$$ veq=-2-lr-l^2r+2(r+ir^3\omega) v' + (-2+r)r^2v'^2 + (-2+r) r^2 v''==0 $$
or in Mathematica form:
-2 - l r - l^2 r +
2 (r + I r^3 \[Omega]) Derivative[1][v][r] + (-2 + r) r^2 Derivative[
1][v][r]^2 + (-2 + r) r^2 (v^\[Prime]\[Prime])[r]
then generate veqexp with the code
veqexp[n_] :=
Normal[Series[
veq /. {v[r_] :> Sum[c[i]/r^i, {i, 1, n}],
v'[r_] :> Sum[-i c[i]/r^(i + 1), {i, 1, n}],
v''[r_] :>
Sum[i (i + 1) c[i]/r^(i + 2), {i, 1, n}]}, {r, \[Infinity],
n - 2}]];
I sub into this an ansatz for solution $v=\sum^n c_i r^i$. Calling this new equation in terms of the $c_i$ 'veqexp' (i.e. veq expanded). The following chunk of code can solve this for my coefficients: (note I want to solve around infinity)
vcoeffs[nn_] :=
Block[{}, Clear[c];
Do[c[i] = c[i] /. Solve[
Limit[veqexp[nn] r^(i - 2),
r -> \[Infinity]] == 0, c[i]][[1]];, {i, 1, nn}]] ;
and out correctly pop the $c_i$ coefficients in terms of $(\omega,\ell)$ parameters of my 'veq', so far so good. The problem is that these functions of $(\omega,\ell)$rapidly grow in size until by about the 30th Mathematica's memory gives out and dies. However if I try to calculate for a given $(\omega,\ell)=(0.1,1)$ so that each c[i] is just a number, I also hit problems to do with recursion that I have no idea about. For example
vcoeffs[nn_] :=
Block[{}, Clear[c];
Do[c[i] =
c[i] /. Solve[
Limit[(veqexp[nn] /. {\[Omega] -> 0.1, l -> 1}) r^(i - 2),
r -> \[Infinity]] == 0, c[i]][[1]];, {i, 1, nn}]] ;
generates errors that read
$RecursionLimit::reclim: Recursion depth of 256 exceeded. >>
when I would have expected just a series of $nn$ complex coefficients which would take no memory for Mathematica to store.
Can anyone suggest a way around this? thanks
irin yourveqequation a single variable, ori*rand, in the latter case, isithen Mathematica'sI? I'd prefer a non-ambiguous and above all copyable Mathematica definition instead of a pretty printing LaTeX one in this case. – Sjoerd C. de Vries Sep 27 '12 at 17:52veqexpis an equation as you say, what does it do in ` Limit[veqexp[nn] r^(i - 2), r -> [Infinity]]`? How do you take the limit of an equation? – Sjoerd C. de Vries Sep 27 '12 at 18:30