1

Can anyone explain to me how does this code function?

AdomianPolynomials[u_, F_, o_] := CoefficientList[
   ExpandAll[
    Series[
     F[
      Sum[λ^k u[k], {k, o}]
      ],
     {λ, 0, o}
     ]
    ], λ]

The original code was get from noteboook of this website http://mathworld.wolfram.com/AdomianPolynomial.html

Michael E2
  • 235,386
  • 17
  • 334
  • 747
user49178
  • 13
  • 4
  • 1
    Hi and Welcome! Make the most of Mma.SE by taking the [tour] now. It will help us to help you if you write an excellent question. Edit if improvable, show due diligence, give brief context, include minimal working example of code and data in formatted form. As you receive give back**, vote and answer questions, keep the site useful, be kind, correct mistakes and share what you have learned. Why not choosing a meaningful name? – rhermans May 30 '17 at 10:54
  • There are things to do after your question is answered. It's a good idea to stay vigilant for some time, better approaches may come later improving over previous replies. Experienced users may point alternatives, caveats or limitations. New users should test answers before voting and wait 24 hours before accepting the best one. Participation is essential for the site, please come back to do your part tomorrow – rhermans May 30 '17 at 14:10

1 Answers1

5

Sum, evaluates the sum $\sum_{k=0}^{o}{\lambda^k\,u(k)}$

With[{o = 3},
 Sum[λ^k u[k], {k, o}]
 ]
λ u[1] + λ^2 u[2] + λ^3 u[3] 

Series, generates a power series expansion for $F(\sum_{k=0}^{o}{\lambda^k\,u(k)})$ about the point $0$ to order $(\lambda-0)^o$.

With[{o = 3},
 Series[F[Sum[λ^k u[k], {k, o}]], {λ, 0, o}]
 ]

Mathematica graphics

CoefficientList, gives a list of coefficients of powers of $\lambda$ in the previos expression, starting with power 0.

ExpandAll, expands out all products and integer powers in any part of the expression in the argument.

With[{o = 3},
 CoefficientList[
  ExpandAll[
   Series[F[Sum[λ^k u[k], {k, o}]], {λ, 0, 
     o}]], λ]
 ]

Mathematica graphics

Follow the links for the documentation.

rhermans
  • 36,518
  • 4
  • 57
  • 149
  • First of all, thank you for the explanation and reply. Sorry for the late reply. Let's say if i has a function of F(u)=u^3, and given that u= Summation of Subscript[u, n] from n=0 to 5, my code will be – user49178 May 31 '17 at 12:26
  • In theory, i know that it will become --- (subscript[u,0])^3+3 [Subscript[u, 0]]^2 Subscript[u, 1]+ 3 [Subscript[u, 0]]^2 Subscript[u, 2]+3 Subscript[u, 0] {Subscript[u, 1]}^2 – user49178 May 31 '17 at 13:04
  • First, you should avoid using Subscript while defining symbols/variables (Read here). Second, I don't understand what you are saying/asking. If my answer resolves your original question, read this if you have other different questions, you should ask a new question and not move the goalpost. In any case, have you tried yourself? you should show due diligence! – rhermans May 31 '17 at 13:06
  • sorry for that, i had pressed wrongly and it submitted the incomplete sentences. I will try to retype it in a complete form. and with the coding. – user49178 May 31 '17 at 13:07