2

Suppose I have a given series $A(z)=\Sigma a_nz^n$

I want to solve a differential equation for $B(z)$ in terms of coefficients of $a_n$ as a series. Possibly with ansatz $B(z)=\Sigma b_nz^n$ or other form.

In other words, I want to get $b_n$ in terms of $a_n$.

My equation is this $\frac{dB}{dz}=-z(A+B)(B+1)$

How do I let Mathematica to do this for me?

So far I have tried defining the series using Sum and SolveAlways.

But it seems completely wrong. And I believe there must be a good way of doing this on Mathematica.

Additional question:

ord = 3;
mzi = M - Exp[-z]*(Sum[a[n] (1/z)^n, {n, 0, ord}] + O[z]^(ord + 1));
pzi = Exp[-z]*(Sum[p[n] (1/z)^n, {n, 0, ord}] + O[z]^(ord + 1));
With[{mzii = mzi, pzii = pzi}, 
SolveAlways[D[pzii, z] == -\[Epsilon]^2/z^2 (D[mzii, z]/(4 Pi*z^2) + pzii) 
(4*Pi*z^3*pzii + mzii), z]]

And I want to solve for p[n] in terms of a[n], but I get an error message saying: not a polynomial.

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
Duke Smith
  • 89
  • 5
  • You were right to start with Sum[] + SolveAlways[]: With[{af = Sum[a[n] z^n, {n, 0, 12}] + O[z]^13, bf = Sum[b[n] z^n, {n, 0, 12}] + O[z]^13}, SolveAlways[D[bf, z] == -z (af + bf) (bf + 1), z]] – J. M.'s missing motivation Aug 12 '17 at 03:12
  • @J.M. This code worked well on the first part. Then I tried to see the behavior when z goes to infinity. Here i my code ord = 3; mzi = M - Exp[-z](Sum[a[n] (1/z)^n, {n, 0, ord}] + O[z]^(ord + 1)); pzi = Exp[-z](Sum[p[n] (1/z)^n, {n, 0, ord}] + O[z]^(ord + 1)); With[{mzii = mzi, pzii = pzi}, SolveAlways[ D[pzii, z] == -[Epsilon]^2/ z^2 (D[mzii, z]/(4 Piz^2) + pzii) (4Piz^3pzii + mzii), z]] Then I want to solve p[n] in terms of a[n]. This gives me error... – Duke Smith Aug 13 '17 at 16:19
  • "Then I tried to see the behavior when z goes to infinity." - why didn't you put this in the question to begin with? – J. M.'s missing motivation Aug 13 '17 at 16:19
  • @J.M. I had to examine both cases... sorry – Duke Smith Aug 13 '17 at 16:21
  • Then, please edit your question. – J. M.'s missing motivation Aug 13 '17 at 16:21
  • Okay... first, you can specify the expansion point in O[]; since you're looking at asymptotic series, try O[z, ∞]^(ord + 1). Second, you might want to do a little simplification first and see if you can reformulate to avoid the exponential factor; that messes SolveAlways[] up. – J. M.'s missing motivation Aug 13 '17 at 16:31

1 Answers1

6

You could do:

With[{s = Series[B'[z] == -z (A[z] + B[z]) (B[z] + 1), {z, 0, 4}]},
    First @ Solve[s, Union @ Cases[s, Derivative[_][B][0], Infinity]]
] //TeXForm

$\left\{B'(0)\to 0,B''(0)\to -(B(0)+1) (A(0)+B(0)),B^{(3)}(0)\to -2 (B(0)+1) A'(0),B^{(4)}(0)\to 3 (B(0)+1) \left(-A''(0)+3 A(0) B(0)+A(0)^2+A(0)+2 B(0)^2+B(0)\right),B^{(5)}(0)\to 4 (B(0)+1) \left(-A^{(3)}(0)+7 B(0) A'(0)+5 A(0) A'(0)+2 A'(0)\right)\right\}$

I didn't solve for B[0] because the ODE doesn't specify a value for it.

Carl Woll
  • 130,679
  • 6
  • 243
  • 355
  • Thank you, but what should I do if I want to expand the series at other z (e.g., 1, 2, or infinity), rather than z=0? – Duke Smith Aug 13 '17 at 15:47