<!DOCTYPE html>
<html lang="en">
<head>
<script>
  MathJax = { 
    tex: {
		    inlineMath: [['\\(','\\)']]
	} }
</script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js">
</script>
<meta name="generator" content="plasTeX" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>On the Convergence of the Variational Iteration Method: On the Convergence of the Variational Iteration Method</title>
<link rel="stylesheet" href="/var/www/clients/client1/web1/web/files/jnaat-files/journals/1/articles/styles/theme-white.css" />
<link rel="stylesheet" href="styles/pygments.css" />
</head>

<body>

<div class="wrapper">

<div class="content">
<div class="content-wrapper">


<div class="main-text">


<div class="titlepage">
<h1>On the Convergence of the Variational Iteration Method</h1>
<p class="authors">
<span class="author">Ernest Scheiber\(^\ast \)</span>
</p>
<p class="date">October 5, 2015.</p>
</div>
<p>\(^\ast \)e-mail: <span class="tt">scheiber@unitbv.ro</span>. </p>

<div class="abstract"><p> Convergence results are stated for the variational iteration method applied to solve an initial value problem for a system of ordinary differential equations. </p>
<p><b class="bf">MSC.</b> 65L20, 65L05, 97N80 </p>
<p><b class="bf">Keywords.</b> variational iteration method, ordinary differential equations, initial value problem </p>
</div>
<h1 id="a0000000002">1 Introduction</h1>
<p> The Ji-Huan He’s Variational Iteration Method (VIM) was applied to a large range of problems for both ordinary and partial differential equations. The main ingredient of the VIM is the Lagrange multiplier used to improve an approximation of the solution of the differential problem <span class="cite">
	[
	<a href="#1" >2</a>
	]
</span>. </p>
<p>The purpose of this paper is to prove a convergence theorem for VIM applied to solve an initial value problem for a system of ordinary differential equations. </p>
<p>The convergence of the VIM for the initial value problem of an ordinary differential equation may be found in D.K. Salkuyeh, A. Tavakoli <span class="cite">
	[
	<a href="#5" >6</a>
	]
</span>. For a system of linear differential equations a convergence result is given by D.K. Salkuyeh <span class="cite">
	[
	<a href="#3" >5</a>
	]
</span>. </p>
<p>A particularity of the VIM is that it may be implemented both in symbolic (Computer Algebra System) and numerical programming environments. In the last section there are presented some results of our computational experiences. To make the results reproducible we provide some code. In <span class="cite">
	[
	<a href="#12" >1</a>
	]
</span> there is a pertinent presentation of the issues concerning the publishing of scientific computations. </p>
<h1 id="a0000000003">2 The convergence of VIM for a system of ordinary differential equations</h1>
<p>Consider the following system of ordinary differential equations </p>
<div class="equation" id="vim20">
<p>
  <div class="equation_content">
    \begin{equation} \label{vim20} \left\{ \begin{array}{lcl} x_1’(t)=f_1(t,x_1(t),\ldots ,x_m(t)) &  \quad &  x_1(t_0)=x_1^0\\ \vdots \\ x_m’(t)=f_m(t,x_1(t),\ldots ,x_m(t)) &  \quad &  x_m(t_0)=x_m^0 \end{array}\right. \end{equation}
  </div>
  <span class="equation_label">1</span>
</p>
</div>
<p> where \(t\in [t_0,t_f]\) with \(t_0{\lt}t_f{\lt}\infty .\) </p>
<p>We shall use the notations </p>
<div class="displaymath" id="a0000000004">
  \begin{eqnarray*}  \mathbf{x}=(x_1,\ldots ,x_m), \quad \| \mathbf{x}\| _1=\sum _{j=1}^m|x_j| \\ \mathbf{x}=\mathbf{x}(t), \quad \| \mathbf{x}\| _{\infty }=\max _t\| \mathbf{x}(t)\| _1. \end{eqnarray*}
</div>
<p>Thus, any equation of (<a href="#vim20">1</a>) may be rewritten as </p>
<div class="displaymath" id="a0000000005">
  \[  x_i'(t)=f_i(t,\mathbf{x}(t)),\quad i\in \{ 1,\ldots ,m\} .  \]
</div>
<p>The following hypothesis are introduced: </p>
<ul class="itemize">
  <li><p>The functions \(f_1,\ldots ,f_m\) are continuous and have first and second order partial derivatives in \(x_1,\ldots ,x_m.\) </p>
</li>
  <li><p>There exists \(L{\gt}0\) such that for any \(i\in \{ 1,\ldots ,m\} \) </p>
<div class="displaymath" id="a0000000006">
  \[  |f_i(t,\mathbf{x})-f_i(t,\mathbf{y})|\le L\sum _{j=1}^m|x_j-y_j|=L\| \mathbf{x}-\mathbf{y}\| _1, \quad \forall \  \mathbf{x},\mathbf{y}\in \mathbb {R}^m.  \]
</div>
<p> As a consequence </p>
<div class="displaymath" id="a0000000007">
  \[  \Big\vert \frac{\partial f_i(t,\mathbf{x})}{\partial x_j}\Big\vert =|f_{i_{x_j}}(t,\mathbf{x})|\le L, \quad \forall (t,\mathbf{x})\in [t_0,t_f]\times \mathbb {R}^m,\  \forall i,j\in \{ 1,\ldots ,m\} .  \]
</div>
</li>
</ul>
<p>According to the VIM the sequences of approximations are </p>
<div class="equation" id="vim21">
<p>
  <div class="equation_content">
    \begin{equation} \label{vim21} u_{n+1,i}(t)=u_{n,i}(t)+\int _{t_0}^t\lambda _i(s)(u'_{n,i}(s)-f_i(s,\mathbf{u}_n(s)))\mathrm{d}s, \quad n\in \mathbb {N}, \end{equation}
  </div>
  <span class="equation_label">2</span>
</p>
</div>
<p> \(i\in \{ 1,\ldots ,m\} \) and where \(\mathbf{u}_n=(u_{n,1},\ldots ,u_{n,m}).\) </p>
<p>It is supposed that \(u_{n,i}(t_0)=x^0_i\) and that \(u_{n,i}\) is a continuous differentiable function for any \(i\in \{ 1,\ldots ,m\} .\) </p>
<p>In this case the VIM is a little trickier: the Lagrange multiplier attached to the \(i\)-th equation will act only on \(x_i\) <span class="cite">
	[
	<a href="#3" >5</a>
	]
</span>. </p>
<p>Denoting \(\mathbf{x}(t)=(x_1(t),\ldots ,x_m(t))\) the solution of the initial value problem (<a href="#vim20">1</a>), if \(u_{n,i}(t)=x_i(t)+\delta u_{n,i}(t)\) and \(u_{n+1,i}(t)=x_i(t)+\delta u_{n+1,i}(t)\) but \(u_{n,j}(t)=x_j(t),\) for \(j\not=i,\) then (<a href="#vim21">2</a>) implies </p>
<div class="displaymath" id="a0000000008">
  \begin{align*} & \delta u_{n+1,i}(t)=\\ & =\delta u_{n,i}(t)+\int _{t_0}^t\lambda _i(s)\left(x_i’(s)+\delta u_{n,i}’(s)-\right.\\ & \quad \left.-f_i(s,x_1(s),\ldots ,x_{i-1}(s),x_i(s)+\delta u_{n,i}(s),x_{i+1}(s),\ldots ,x_m(s))\right)\mathrm{d}s=\\ & =\delta u_{n,i}(t)+\int _{t_0}^t\lambda _i(s)\left(x_i’(s)+\delta u_{n,i}’(s)-f_i(s,\mathbf{x}(s))-f_{i_{x_i}}(s,\mathbf{x}(s))\delta u_{n,i}(s)\right)\mathrm{d}s+\\ & \quad +{\mathcal O}((\delta u_{n,i})^2)=\\ & =\delta u_{n,i}(t)+\int _{t_0}^t\lambda _i(s)\left(\delta u_{n,i}’(s)-f_{i_{x_i}}(s,\mathbf{x}(s))\delta u_{n,i}(s)\right)\mathrm{d}s+{\mathcal O}((\delta u_{n,i})^2). \end{align*}
</div>
<p> After the integration by parts the above equality becomes </p>
<div class="displaymath" id="a0000000009">
  \begin{align*} & \delta u_{n+1,i}(t)= \\ & (1+\lambda _i(t))\delta u_{n,i}(t) -\int _{t_0}^t\left(\lambda ’_i(s)+f_{i_{x_i}}(s,\mathbf{x}(s))\lambda _i(s)\right)\delta u_{n,i}(s)\mathrm{d}s+{\mathcal O}((\delta u_n)^2). \end{align*}
</div>
<p> In order that \(u_{n+1,i}\) be a better approximation than \(u_{n,i},\) it is required that \(\lambda _i\) is the solution of the following initial value problem </p>
<div class="displaymath" id="vim4">
  \begin{eqnarray}  \lambda ’(s)& =& -f_{i_{x_i}}(s,\mathbf{x}(s))\lambda (s),\quad s\in [t_0,t], \label{vim4}\\ \lambda (t)& =& -1.\label{vim5} \end{eqnarray}
</div>
<p> Because \(\mathbf{x}(s)\) is an unknown function, the following problem is considered instead of (<a href="#vim4">3</a>)–(<a href="#vim5">4</a>) </p>
<div class="displaymath" id="vim6">
  \begin{eqnarray}  \lambda ’(s)& =& -f_x(s,\mathbf{u}_n(s))\lambda (s),\quad s\in [t_0,t], \label{vim6}\\ \lambda (t)& =& -1\label{vim7} \end{eqnarray}
</div>
<p> with the solution denoted \(\lambda _{n,i}(s,t).\) The solution is </p>
<div class="displaymath" id="a0000000010">
  \[  \lambda _{n,i}(s,t)=-e^{\int _s^tf_{i_{x_i}}(\tau ,\mathbf{u}_n(\tau ))\mathrm{d}\tau }  \]
</div>
<p> and </p>
<div class="displaymath" id="a0000000011">
  \[  |\lambda _{n,i}(s,t)|\le e^{L(t-s)}\le e^{LT},\qquad \forall \  t_0\le s\le t\le t_f\  \mbox{and}\  T=t_f-t_0.  \]
</div>
<p>The recurrence formula (<a href="#vim21">2</a>) becomes </p>
<div class="equation" id="vim22">
<p>
  <div class="equation_content">
    \begin{equation} \label{vim22} u_{n+1,i}(t)=u_{n,i}(t)+\int _{t_0}^t\lambda _{n,i}(s,t)(u'_{n,i}(s)-f_i(s,\mathbf{u}_n(s)))\mathrm{d}s, \quad n\in \mathbb {N}, \end{equation}
  </div>
  <span class="equation_label">7</span>
</p>
</div>
<p> for any \(i\in \{ 1,\ldots ,m\} .\) </p>
<p>The convergence result is: <div class="theorem_thmwrapper " id="a0000000012">
  <div class="theorem_thmheading">
    <span class="theorem_thmcaption">
    Theorem
    </span>
    <span class="theorem_thmlabel">1</span>
  </div>
  <div class="theorem_thmcontent">
  <p>If the hypotheses stated above are valid, then the sequence \((\mathbf{u}_n)_{n\in \mathbb {N}}\) defined by <span class="rm">(<a href="#vim22">7</a>)</span> converges uniformly to \(\mathbf{x}(t),\) the solution of the initial value problem <span class="rm">(<a href="#vim20">1</a>)</span>. </p>

  </div>
</div> </p>
<p><div class="proof_wrapper" id="a0000000013">
  <div class="proof_heading">
    <span class="proof_caption">
    Proof
    </span>
    <span class="expand-proof">â–¼</span>
  </div>
  <div class="proof_content">
  
  </div>
</div>Subtracting the equality </p>
<div class="displaymath" id="a0000000014">
  \[  x_i(t)=x_i(t)+\int _0^t\lambda _{n,i}(s,t)\left(x_i'(s)-f_i(s,\mathbf{x}(s))\right)\mathrm{d}s  \]
</div>
<p> from (<a href="#vim22">7</a>) leads to </p>
<div class="displaymath" id="a0000000015">
  \[  e_{n+1,i}(t)=e_{n,i}(t)+\int _{t_0}^t\lambda _{n,i}(s,t)\left(e'_{n,i}(s)-(f_i(s,\mathbf{u}_n(s))-f_i(s,\mathbf{x}(s)))\right)\mathrm{d}s,  \]
</div>
<p> where \(e_{n,i}(t)=u_{n,i}(t)-x_i(t),\  i\in \{ 1,\ldots ,m\} \) and \(\mathbf{e}_n(t)= (e_{n,1}(t),\ldots ,e_{n,m}(t))=\mathbf{u}_n(t)-\mathbf{x}(t),\   n\in \mathbb {N}.\) </p>
<p>Again, an integration by parts gives </p>
<div class="displaymath" id="a0000000016">
  \[  e_{n+1,i}(t)=\int _{t_0}^t\lambda _{n,i}(s,t)\left(f_{i_{x_i}}(s,\mathbf{u}_n(s))e_{n,i}(s)-(f_i(s,\mathbf{u}_n(s))-f_i(s,\mathbf{x}(s)))\right)\mathrm{d}s.  \]
</div>
<p> The hypothesis on \(f_i\) implies the inequality </p>
<div class="displaymath" id="a0000000017">
  \[  \Big|f_{i_{x_i}}(s,\mathbf{u}_n(s))e_{n,i}(s)-(f_i(s,\mathbf{u}_n(s))-f_i(s,\mathbf{x}(s))\Big|\le L|e_{n,i}(s)|+L\| \mathbf{e}_n(s)\| _1  \]
</div>
<p> and consequently </p>
<div class="displaymath" id="a0000000018">
  \[  |e_{n+1,i}(t)|\le Le^{LT}\int _{t_0}^t(|e_{n,i}(s)|+\| \mathbf{e}_n(s)\| _1)\mathrm{d}s.  \]
</div>
<p> Summing these inequalities, for \(i=1:m,\) we find </p>
<div class="equation" id="vim24">
<p>
  <div class="equation_content">
    \begin{equation} \label{vim24} \| \mathbf{e}_{n+1}(t)\| _1\le (m+1)Le^{LT}\int _{t_0}^t\| \mathbf{e}_n(s)\| _1\mathrm{d}s. \end{equation}
  </div>
  <span class="equation_label">8</span>
</p>
</div>
<p>Let \(M=(m+1)Le^{LT}.\) From (<a href="#vim24">8</a>) we obtain successively: </p>
<p>For \(n=0\) </p>
<div class="displaymath" id="a0000000019">
  \[  \| \mathbf{e}_1(t)\| _1\le M \int _{t_0}^t\| \mathbf{e}_0(s)\| _1\mathrm{d}s\le M(t-t_0)\| \mathbf{e}_0\| _{\infty } \  \Rightarrow \  \| \mathbf{e}_1\| _{\infty }\le MT\| \mathbf{e}_0\| _{\infty }.  \]
</div>
<p>For \(n=1\) </p>
<div class="displaymath" id="a0000000020">
  \[  \| \mathbf{e}_2(t)\| _1\le M \int _{t_0}^t\| \mathbf{e}_1(s)\| _1\mathrm{d}s\le \tfrac {M^2 (t-t_0)^2}{2}\| \mathbf{e}_0\| _{\infty }\  \Rightarrow \  \| \mathbf{e}_2\| _{\infty }\le \tfrac {M^2T^2}{2} \| \mathbf{e}_0\| _{\infty }.  \]
</div>
<p>Inductively, it results that </p>
<div class="displaymath" id="a0000000021">
  \[  \| \mathbf{e}_n(t)\| _1\le M\int _{t_0}^t\| \mathbf{e}_{n-1}(s)\| _1\mathrm{d}s\le \tfrac {M^n (t-t_0)^n}{n!}\| \mathbf{e}_0\| _{\infty }\  \Rightarrow \  \| \mathbf{e}_n\| _{\infty }\le \tfrac {M^nT^n}{n!} \| \mathbf{e}_0\| _{\infty }.  \]
</div>
<p> and hence \(\lim _{n\rightarrow \infty }\| \mathbf{e}_n\| _{\infty }=0.\) </p>
<p>A numerical implementation requires the usage of a quadrature method to compute the integral in (<a href="#vim22">7</a>) and the Lagrange multipliers. </p>
<h1 id="a0000000022">3 Computational results</h1>
<p>The target of the given examples is twofold: to exemplify the convergence of the VIM and to obtain some clues about the usage of numerical vs. symbolical computations of VIM. </p>
<p><div class="example_thmwrapper " id="vim31">
  <div class="example_thmheading">
    <span class="example_thmcaption">
    Example
    </span>
    <span class="example_thmlabel">1</span>
  </div>
  <div class="example_thmcontent">
  
<div class="displaymath" id="a0000000023">
  \[  \begin{array}{l} x’(t)=2x(t)+t\\ x(0)=0 \end{array}  \]
</div>
<p> The solution \(x(t)=\frac{1}{4}(e^{2t}-2t-1)\) is obtained in an iteration with the <i class="itshape">Mathematica</i> code provided in Appendix <a href="#appendixA">A</a>.<span class="qed">â–¡</span></p>

  </div>
</div> </p>
<p><div class="example_thmwrapper " id="a0000000024">
  <div class="example_thmheading">
    <span class="example_thmcaption">
    Example
    </span>
    <span class="example_thmlabel">2</span>
  </div>
  <div class="example_thmcontent">
  <div class="displaymath" id="a0000000025">
  \[  \begin{array}{l} x’(t)=1-x^2(t)\\ x(0)=0 \end{array}  \]
</div>
<p>The initial value problem has the solution \(x(t)=\frac{e^{2t}-1}{e^{2t}+1}.\) The code used previously does not give an acceptable result in a reasonable time. </p>
<p>Moving on numerical computation we obtain practical results. The relation (<a href="#vim22">7</a>) is transformed into </p>
<div class="displaymath" id="vim25">
  \begin{align} \label{vim25} u_{n+1,i}(t)=& \int _{t_0}^t\left(f_i(s,\mathbf{u}_n(s))-f_{i_{x_i}}(s,\mathbf{u}_n(s))u_{n,i}(s)\right) e^{\int _s^tf_{i_{x_i}}(\tau ,\mathbf{u}_n(\tau ))\mathrm{d}\tau }\mathrm{d}s+\\ & \quad +e^{\int _{t_0}^tf_{i_{x_i}}(\tau ,\mathbf{u}_n(\tau ))\mathrm{d}\tau }x^0.\nonumber \end{align}
</div>
<p> Let \((t_i)_{0\le i\le I}\) be an equidistant grid on \([t_0,t_f]\) and denote by \(\mathbf{u}_i\) an approximation of \(\mathbf{x}(t_i).\) Furthermore, the recurrence relation (<a href="#vim25">9</a>) is used only to compute \(\mathbf{u}_{i+1}\) from \(\mathbf{u}_i,\) i.e. on a \([t_i,t_{i+1}]\) interval. The integrals in (<a href="#vim25">9</a>) will be computed with the trapezoidal rule using a local equidistant grid. </p>
<p>The iterations are done until the distance between two consecutive approximation of \(\mathbf{u}_{i+1}\) is less then a given tolerance. </p>
<p>The final approximate solution is a first order spline function defined by the points \((t_i,\mathbf{u}_i)_{0\le i\le I}.\) </p>
<p>This procedure requires a single passage from \(t_0\) to \(t_f.\) </p>
<p>All our numerical results were computed using the <i class="itshape">Scilab</i> code presented in Appendix <a href="#appendixB">B</a> <span class="cite">
	[
	<a href="#10" >11</a>
	]
</span>. </p>
<p>For \(t_f=1,\  I=100\) we obtained \(\max _{0\le i\le I}|u_i-x(t_i)|\approx 0.4 \times 10^{-6}.\) <span class="qed">â–¡</span></p>

  </div>
</div> </p>
<p><div class="example_thmwrapper " id="vim32">
  <div class="example_thmheading">
    <span class="example_thmcaption">
    Example
    </span>
    <span class="example_thmlabel">3</span>
  </div>
  <div class="example_thmcontent">
  <p> <span class="cite">
	[
	<a href="#3" >5</a>
	]
</span> </p>
<div class="displaymath" id="a0000000026">
  \[  \begin{array}{lcl} \dot{x}_1=4x_1+6x_2+6x_3 &  \quad &  x_1(0)=7\\ \dot{x}_2=x_1+3x_2+2x_3 &  \quad &  x_2(0)=2\\ \dot{x}_3=-x_1-5x_2-2x_3 &  \quad &  x_3(0)=-\frac{9}{2} \end{array}  \]
</div>
<p>The solution is \(x_1(t)=4e^t+3(1+t)e^{2t},\  x_2(t)=e^t+(1+t)e^{2t},\  x_3(t)=-3e^t-(\frac{3}{2}+2t)e^{2t}.\) </p>
<p>For \(t_f=1,\  I=100\) we found \(\max _{0\le i\le I}\| \mathbf{u}_i-\mathbf{x}(t_i)\|  \approx 0.8363 \times 10^{-3}.\) <span class="qed">â–¡</span></p>

  </div>
</div> </p>
<p><div class="example_thmwrapper " id="vim33">
  <div class="example_thmheading">
    <span class="example_thmcaption">
    Example
    </span>
    <span class="example_thmlabel">4</span>
  </div>
  <div class="example_thmcontent">
  
<div class="displaymath" id="a0000000027">
  \[  \begin{array}{ll} x’_1(t)=x_2(t), &  x_1(0)=\frac{1}{2} \\ x’_2(t)=\frac{x_1(t) x_2^2(t)}{x_1^2(t)-1},&  x_2(0)=\frac{\sqrt{3}}{2} \end{array} \quad \Leftrightarrow \quad \begin{array}{ll} (x^2(t)-1)x”(t)=x(t)x’^2(t) \\ x(0)=\frac{1}{2}\\ x’(0)=\frac{\sqrt{3}}{2} \end{array}  \]
</div>
<p>The solution is \(x_1(t)=\sin {(t+\frac{\pi }{6})},\  x_2(t)=\cos {(t+\frac{\pi }{6})}.\) </p>
<p>For \(t_f=\frac{\pi }{3},\  I=100\) the result is \(\max _{0\le i\le I}\| \mathbf{u}_i-\mathbf{x}(t_i)\|  \approx 0.62 \times 10^{-5}.\) <span class="qed">â–¡</span></p>

  </div>
</div> </p>
<p><div class="example_thmwrapper " id="vim34">
  <div class="example_thmheading">
    <span class="example_thmcaption">
    Example
    </span>
    <span class="example_thmlabel">5</span>
  </div>
  <div class="example_thmcontent">
  <p> Van der Pol equation </p>
<div class="displaymath" id="a0000000028">
  \[  \begin{array}{ll} x’_1(t)=x_2(t), &  x_1(0)=0.5\\ x’_2(t)=(1-x_1^2(t))x_2(t)-x_1(t),&  x_2(0)=0 \end{array} \quad \Leftrightarrow  \]
</div>
<div class="displaymath" id="a0000000029">
  \[  \Leftrightarrow \quad \begin{array}{ll} x”(t)-(1-x^2(t))x’(t)+x(t)=0 \\ x(0)=0.5\\ x’(0)=0 \end{array}  \]
</div>
<p>In this case we do not have a closed form of the solution. We compare the VIM approximation with the solution \(\mathbf{v}\) obtained with <span class="ttfamily">ode</span>, a <i class="itshape">Scilab</i> numerical integration function. </p>
<p>The obtained results are given in Table <a href="#tab.1">1</a>. <span class="qed">â–¡</span></p>

  </div>
</div> </p>
<div class="table"  id="tab.1">
   <table class="tabular">
  <tr>
    <td  style="text-align:right; border-right:1px solid black" 
        rowspan=""
        colspan="">
      <p> \(t_f\) </p>

    </td>
    <td  style="text-align:right; border-right:1px solid black" 
        rowspan=""
        colspan="">
      <p> \(I\) </p>

    </td>
    <td  style="text-align:center" 
        rowspan=""
        colspan="">
      <p> \(\max _{0\le i\le I}\| \mathbf{u}_i-\mathbf{v}_i\| \)</p>

    </td>
  </tr>
  <tr>
    <td  style="border-top-style:solid; border-top-color:black; border-top-width:1px; text-align:right; border-right:1px solid black" 
        rowspan=""
        colspan="">
      <p>10 </p>

    </td>
    <td  style="border-top-style:solid; border-top-color:black; border-top-width:1px; text-align:right; border-right:1px solid black" 
        rowspan=""
        colspan="">
      <p> 100 </p>

    </td>
    <td  style="border-top-style:solid; border-top-color:black; border-top-width:1px; text-align:center" 
        rowspan=""
        colspan="">
      <p> 0.0001988 </p>

    </td>
  </tr>
  <tr>
    <td  style="text-align:right; border-right:1px solid black" 
        rowspan=""
        colspan="">
      <p>20 </p>

    </td>
    <td  style="text-align:right; border-right:1px solid black" 
        rowspan=""
        colspan="">
      <p> 100 </p>

    </td>
    <td  style="text-align:center" 
        rowspan=""
        colspan="">
      <p> 0.0033857 </p>

    </td>
  </tr>
  <tr>
    <td  style="text-align:right; border-right:1px solid black" 
        rowspan=""
        colspan="">
      <p>30 </p>

    </td>
    <td  style="text-align:right; border-right:1px solid black" 
        rowspan=""
        colspan="">
      <p> 100 </p>

    </td>
    <td  style="text-align:center" 
        rowspan=""
        colspan="">
      <p> 0.0142215 </p>

    </td>
  </tr>
  <tr>
    <td  style="text-align:right; border-right:1px solid black" 
        rowspan=""
        colspan="">
      <p>40 </p>

    </td>
    <td  style="text-align:right; border-right:1px solid black" 
        rowspan=""
        colspan="">
      <p> 100 </p>

    </td>
    <td  style="text-align:center" 
        rowspan=""
        colspan="">
      <p> 0.0384137 </p>

    </td>
  </tr>
  <tr>
    <td  style="text-align:right; border-right:1px solid black" 
        rowspan=""
        colspan="">
      <p>50 </p>

    </td>
    <td  style="text-align:right; border-right:1px solid black" 
        rowspan=""
        colspan="">
      <p> 100 </p>

    </td>
    <td  style="text-align:center" 
        rowspan=""
        colspan="">
      <p> 0.0777549 </p>

    </td>
  </tr>
  <tr>
    <td  style="text-align:right; border-right:1px solid black" 
        rowspan=""
        colspan="">
      <p>100 </p>

    </td>
    <td  style="text-align:right; border-right:1px solid black" 
        rowspan=""
        colspan="">
      <p> 100 </p>

    </td>
    <td  style="text-align:center" 
        rowspan=""
        colspan="">
      <p> 0.6410885 </p>

    </td>
  </tr>
  <tr>
    <td  style="text-align:right; border-right:1px solid black; border-bottom-style:solid; border-bottom-color:black; border-bottom-width:1px" 
        rowspan=""
        colspan="">
      <p>100 </p>

    </td>
    <td  style="text-align:right; border-right:1px solid black; border-bottom-style:solid; border-bottom-color:black; border-bottom-width:1px" 
        rowspan=""
        colspan="">
      <p> 1000 </p>

    </td>
    <td  style="text-align:center; border-bottom-style:solid; border-bottom-color:black; border-bottom-width:1px" 
        rowspan=""
        colspan="">
      <p> 0.0069729 </p>

    </td>
  </tr>
</table> <figcaption>
  <span class="caption_title">Table</span> 
  <span class="caption_ref">1</span> 
  <span class="caption_text">Numerical results for the Van der Pol equation.</span> 
</figcaption>  
</div>
<h1 id="a0000000030">4 Conclusions</h1>
<p>Despite the convergence properties of the method the amount of the computation is greater than of the usual methods (<i class="it">e.g.</i> Runge-Kutta, Adams type methods). Even so the numerical solution can be taken into consideration. The numerical implementation can be improved by an adaptive approach and using some parallel techniques (<i class="it">e.g.</i> OpenCL / CUDA) in an appropriate environment. </p>
<p>Although the VIM may be implemented for symbolic computation our experiments show disappointing results. </p>
<p>The VIM offers a way to obtain a symbolic approximation of the solution of the initial value problem. But such an approximation may also be obtained from a numerical solution with the <i class="itshape">Eureqa</i> software <span class="cite">
	[
	<a href="#11" >10</a>
	]
</span>, <span class="cite">
	[
	<a href="#8" >7</a>
	]
</span>. A better symbolic implementation would be useful. </p>
<p><div class="acknowledgement_thmwrapper " id="a0000000031">
  <div class="acknowledgement_thmheading">
    <span class="acknowledgement_thmcaption">
    Acknowledgements
    </span>
  </div>
  <div class="acknowledgement_thmcontent">
  <p>The author want to thank the referee for his helpful suggestions for the improvement of this paper. </p>

  </div>
</div> </p>
<p><small class="footnotesize">  </small></p>
<div class="bibliography">
<h1>Bibliography</h1>
<dl class="bibliography">
  <dt><a name="12">1</a></dt>
  <dd><p><a href ="http://dx.doi.org/10.1090/noti797"> <span class="scshape">T. Daly</span>, <i class="itshape">Publishing Computational Mathematics</i>, Notices of the AMS, <b class="bfseries">59</b> (2012) no. 2, pp.&#160;320–321. <img src="img-0001.png" alt="\includegraphics[scale=0.1]{ext-link.png}" style="width:12.0px; height:10.700000000000001px" />
</a> </p>
</dd>
  <dt><a name="1">2</a></dt>
  <dd><p><a href ="http://dx.doi.org/10.1016/B978-0-08-024728-1.50027-6"> <span class="scshape">M. Inokuti, H. Sekine, T. Mura</span>, <i class="itshape">General use of the Lagrange multiplier in Nonlinear Mathematical Physics</i>, In Variational Methods in Mechanics and Solids, ed. <span class="scshape">Nemat-Nasser S.</span>, Pergamon Press, pp.&#160;156–162, 1980. <img src="img-0001.png" alt="\includegraphics[scale=0.1]{ext-link.png}" style="width:12.0px; height:10.700000000000001px" />
</a> </p>
</dd>
  <dt><a name="2">3</a></dt>
  <dd><p><a href ="http://dx.doi.org/10.1016/j.cam.2006.07.009"> <span class="scshape">J.H. He</span>, <i class="itshape">Variational iteration method - Some recent results and new interpretations</i>, J. Comput. Appl. Math., <b class="bfseries">207</b> (2007), pp.&#160;3–17. <img src="img-0001.png" alt="\includegraphics[scale=0.1]{ext-link.png}" style="width:12.0px; height:10.700000000000001px" />
</a> </p>
</dd>
  <dt><a name="6">4</a></dt>
  <dd><p><a href ="http://dx.doi.org/10.1016/j.mcm.2009.12.034"> <span class="scshape">Z.M. Odibat</span>, <i class="itshape">A study on the convergence of variational iteration method</i>, Math. Computer Modelling, <b class="bfseries">51</b> (2010), pp.&#160;1181–1192. <img src="img-0001.png" alt="\includegraphics[scale=0.1]{ext-link.png}" style="width:12.0px; height:10.700000000000001px" />
</a> </p>
</dd>
  <dt><a name="3">5</a></dt>
  <dd><p><a href ="http://dx.doi.org/10.1016/j.camwa.2008.03.030"> <span class="scshape">D. K. Salkuyeh</span>, <i class="itshape">Convergence of the variational iteration method for solving linear systems of ODE with constant coefficients</i>, Comp. Math. Appl., <b class="bfseries">56</b> (2008), pp.&#160;2027–2033. <img src="img-0001.png" alt="\includegraphics[scale=0.1]{ext-link.png}" style="width:12.0px; height:10.700000000000001px" />
</a> </p>
</dd>
  <dt><a name="5">6</a></dt>
  <dd><p><a href ="http://dx.doi.org/10.1016/j.apm.2015.10.037"> <span class="scshape">D. K. Salkuyeh, A. Tavakoli</span>, <i class="itshape">Interpolated variational iteration method for initial value problems</i>, arXiv:1507.01306v1, 2015. <img src="img-0001.png" alt="\includegraphics[scale=0.1]{ext-link.png}" style="width:12.0px; height:10.700000000000001px" />
</a> </p>
</dd>
  <dt><a name="8">7</a></dt>
  <dd><p><span class="scshape">E. Scheiber</span>, <i class="itshape">From the numerical solution to the symbolic form,</i> Bull. Transilvania University of Braşov, Series III, Mathematics, Informatics, Physics, <b class="bfseries">8</b>(<b class="bfseries">57</b>) (2015) no. 1, pp. 129–137. </p>
</dd>
  <dt><a name="7">8</a></dt>
  <dd><p><a href ="http://dx.doi.org/10.1016/j.cam.2006.07.017"> <span class="scshape">M. Tatari, M. Dehghan</span>, <i class="itshape">On the convergence of He’s variational iteration method.</i> J. Comput. Appl. Math., <b class="bfseries">207</b> (2007), pp.&#160;121–128. <img src="img-0001.png" alt="\includegraphics[scale=0.1]{ext-link.png}" style="width:12.0px; height:10.700000000000001px" />
</a> </p>
</dd>
  <dt><a name="4">9</a></dt>
  <dd><p><span class="scshape">M. Torvattanabun, S. Koonprasert</span>, <i class="itshape">Convergence of the variational iteration method for solving a first-order linear system of PDEs with constant coefficients</i>, Thai J. of Mathematics, Special Issue, pp.&#160;1–13, 2009. </p>
</dd>
  <dt><a name="11">10</a></dt>
  <dd><p>* * *, <a href="www.nutonian.com">www.nutonian.com</a> </p>
</dd>
  <dt><a name="10">11</a></dt>
  <dd><p>* * *, <a href="www.scilab.org">www.scilab.org</a> </p>
</dd>
</dl>



</div><h1 id="appendixA">A <i class="itshape">Mathematica</i> code</h1>

<p>The <i class="itshape">Mathematica</i> procedure used to solve an initial value problem. </p>
<p><small class="scriptsize"> <div class="highlight"><pre><span></span><span class="n">In</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">:=</span>
<span class="w"> </span><span class="n">VIM</span><span class="p">[</span><span class="nv">f_</span><span class="p">,</span><span class="w"> </span><span class="nv">U0_</span><span class="p">,</span><span class="w"> </span><span class="nv">m_</span><span class="p">]</span><span class="w"> </span><span class="o">:=</span><span class="w"> </span><span class="n">Module</span><span class="p">[{</span><span class="n">V</span><span class="p">,</span><span class="w"> </span><span class="n">U</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">U0</span><span class="p">,</span><span class="w"> </span><span class="n">df</span><span class="p">,</span><span class="w"> </span><span class="n">Lambda</span><span class="p">},</span>
<span class="w">  </span><span class="n">df</span><span class="p">[</span><span class="nv">t_</span><span class="p">,</span><span class="w"> </span><span class="nv">x_</span><span class="p">]</span><span class="w"> </span><span class="o">:=</span><span class="w"> </span><span class="n">D</span><span class="p">[</span><span class="n">f</span><span class="p">[</span><span class="n">t</span><span class="p">,</span><span class="w"> </span><span class="n">x</span><span class="p">],</span><span class="w"> </span><span class="n">x</span><span class="p">];</span>
<span class="w">  </span><span class="n">Lambda</span><span class="p">[</span><span class="nv">U_</span><span class="p">]</span><span class="w"> </span><span class="o">:=</span><span class="w"> </span><span class="o">-</span><span class="n">Exp</span><span class="p">[</span>
<span class="w">     </span><span class="n">Integrate</span><span class="p">[</span><span class="n">df</span><span class="p">[</span><span class="n">w</span><span class="p">,</span><span class="w"> </span><span class="n">x</span><span class="p">]</span><span class="w"> </span><span class="o">/.</span><span class="w"> </span><span class="p">{</span><span class="n">x</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">U</span><span class="p">,</span><span class="w"> </span><span class="n">t</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">w</span><span class="p">},</span><span class="w"> </span><span class="p">{</span><span class="n">w</span><span class="p">,</span><span class="w"> </span><span class="n">s</span><span class="p">,</span><span class="w"> </span><span class="n">t</span><span class="p">}]];</span>
<span class="w">  </span><span class="n">For</span><span class="p">[</span><span class="n">i</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o">&lt;</span><span class="w"> </span><span class="n">m</span><span class="p">,</span><span class="w"> </span><span class="n">i</span><span class="o">++</span><span class="p">,</span>
<span class="w">   </span><span class="n">V</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">U</span><span class="w"> </span><span class="o">+</span>
<span class="w">     </span><span class="n">Integrate</span><span class="p">[</span><span class="n">Lambda</span><span class="p">[</span><span class="n">U</span><span class="p">]</span><span class="w"> </span><span class="p">((</span><span class="n">D</span><span class="p">[</span><span class="n">U</span><span class="p">,</span><span class="w"> </span><span class="n">t</span><span class="p">]</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="n">f</span><span class="p">[</span><span class="n">t</span><span class="p">,</span><span class="w"> </span><span class="n">U</span><span class="p">])</span><span class="w"> </span><span class="o">/.</span><span class="w"> </span><span class="n">t</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">s</span><span class="p">),</span><span class="w"> </span><span class="p">{</span><span class="n">s</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">t</span><span class="p">}];</span>
<span class="w">   </span><span class="n">U</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">V</span><span class="p">;</span><span class="w"> </span><span class="n">Clear</span><span class="p">[</span><span class="n">V</span><span class="p">]];</span><span class="w"> </span><span class="n">U</span><span class="p">]</span>
</pre></div>
 <span class="normalsize"><p>For Example <a href="#vim31">1</a> the calling sequence is <small class="scriptsize"> <div class="highlight"><pre><span></span><span class="n">In</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">:=</span><span class="w"> </span><span class="n">f</span><span class="p">[</span><span class="nv">t_</span><span class="p">,</span><span class="w"> </span><span class="nv">x_</span><span class="p">]</span><span class="w"> </span><span class="o">:=</span><span class="w"> </span><span class="p">{</span><span class="mi">2</span><span class="w"> </span><span class="n">x</span><span class="p">[[</span><span class="mi">1</span><span class="p">]]</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">t</span><span class="p">}</span>
<span class="n">In</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span><span class="o">:=</span><span class="w"> </span><span class="n">U0</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="mi">0</span><span class="p">}</span>
<span class="n">In</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span><span class="o">:=</span><span class="w"> </span><span class="n">VIM</span><span class="p">[</span><span class="n">f</span><span class="p">,</span><span class="n">U0</span><span class="p">,</span><span class="mi">1</span><span class="p">]</span>
<span class="n">Out</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span><span class="o">=</span><span class="p">{(</span><span class="mi">1</span><span class="o">/</span><span class="mi">4</span><span class="p">)</span><span class="o">*</span><span class="p">(</span><span class="mi">-1</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">E</span><span class="o">^</span><span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="n">t</span><span class="p">)</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="mi">2</span><span class="o">*</span><span class="n">t</span><span class="p">)}</span>
</pre></div>
 <span class="normalsize"><p><br /></p>
</span></small></p>
</span></small></p>
<h1 id="appendixB">B <i class="itshape">Scilab</i> code</h1>

<p>The code used to obtain numerical results <small class="scriptsize"> <div class="highlight"><pre><span></span><span class="k">function</span><span class="w"> </span>[t,u,info]<span class="p">=</span><span class="nf">vim</span><span class="p">(</span>f,df,x0,t0,tf,n,nmi,tol<span class="p">)</span>
<span class="o">//</span><span class="w"> </span><span class="n">Computes</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="n">solution</span><span class="w"> </span><span class="n">of</span><span class="w"> </span><span class="n">an</span><span class="w"> </span><span class="n">initial</span><span class="w"> </span><span class="n">value</span><span class="w"> </span><span class="n">problem</span>
<span class="o">//</span><span class="w"> </span><span class="n">of</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="nb">system</span><span class="w"> </span><span class="n">of</span><span class="w"> </span><span class="n">ordinary</span><span class="w"> </span><span class="n">differential</span><span class="w"> </span><span class="n">equations</span>
<span class="o">//</span><span class="w"> </span><span class="n">using</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="n">Variational</span><span class="w"> </span><span class="n">Iteration</span><span class="w"> </span><span class="n">Method</span><span class="w"> </span><span class="o">-</span>
<span class="o">//</span><span class="w"> </span><span class="n">Dispatcher</span><span class="w"> </span><span class="k">function</span><span class="p">.</span>
<span class="o">//</span>
<span class="o">//</span><span class="w"> </span><span class="n">Calling</span><span class="w"> </span><span class="n">Sequence</span>
<span class="o">//</span><span class="w">    </span><span class="p">[</span><span class="n">t</span><span class="p">,</span><span class="n">u</span><span class="p">,</span><span class="n">info</span><span class="p">]=</span><span class="n">vim</span><span class="p">(</span><span class="n">f</span><span class="p">,</span><span class="n">df</span><span class="p">,</span><span class="n">x0</span><span class="p">,</span><span class="n">t0</span><span class="p">,</span><span class="n">tf</span><span class="p">,</span><span class="n">n</span><span class="p">,</span><span class="n">nmi</span><span class="p">,</span><span class="n">tol</span><span class="p">)</span>
<span class="o">//</span>
<span class="o">//</span><span class="w"> </span><span class="n">Output</span><span class="w"> </span><span class="nb">arguments</span>
<span class="o">//</span><span class="w">    </span><span class="n">t</span><span class="w">   </span><span class="p">:</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="nb">real</span><span class="w"> </span><span class="n">vector</span><span class="p">,</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="n">times</span><span class="w"> </span><span class="n">at</span><span class="w"> </span><span class="nb">which</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="n">solution</span><span class="w"> </span><span class="n">is</span><span class="w"> </span><span class="n">computed</span><span class="p">.</span>
<span class="o">//</span><span class="w">    </span><span class="n">u</span><span class="w">   </span><span class="p">:</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="nb">real</span><span class="w"> </span><span class="n">vector</span><span class="w"> </span><span class="n">or</span><span class="w"> </span><span class="n">matrix</span><span class="p">,</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="n">numerical</span><span class="w"> </span><span class="n">solution</span><span class="p">.</span>
<span class="o">//</span><span class="w">    </span><span class="n">info</span><span class="p">:</span><span class="w"> </span><span class="n">an</span><span class="w"> </span><span class="n">integer</span><span class="p">,</span><span class="w"> </span><span class="nb">error</span><span class="w"> </span><span class="n">code</span><span class="w"> </span><span class="p">(</span><span class="mi">0</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="n">OK</span><span class="p">).</span>
<span class="o">//</span><span class="w"> </span><span class="n">Input</span><span class="w"> </span><span class="nb">arguments</span>
<span class="o">//</span><span class="w">    </span><span class="n">f</span><span class="w">   </span><span class="p">:</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="n">Scilab</span><span class="w"> </span><span class="k">function</span><span class="p">,</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="n">right</span><span class="w"> </span><span class="n">hand</span><span class="w"> </span><span class="nb">size</span><span class="w"> </span><span class="n">of</span><span class="w"> </span><span class="n">the</span>
<span class="o">//</span><span class="w">          </span><span class="n">differential</span><span class="w"> </span><span class="nb">system</span><span class="p">.</span>
<span class="o">//</span><span class="w">    </span><span class="n">df</span><span class="w">  </span><span class="p">:</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="n">Scilab</span><span class="w"> </span><span class="k">function</span><span class="p">,</span><span class="w"> </span><span class="n">df</span><span class="p">=(</span><span class="n">df_1</span><span class="o">/</span><span class="n">dx_1</span><span class="p">,</span><span class="n">df_2</span><span class="o">/</span><span class="n">dx_2</span><span class="p">,</span><span class="k">...</span><span class="c">).</span>
<span class="o">//</span><span class="w">    </span><span class="n">x0</span><span class="w">  </span><span class="p">:</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="nb">real</span><span class="w"> </span><span class="n">vector</span><span class="p">,</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="n">initial</span><span class="w"> </span><span class="n">conditions</span><span class="p">.</span>
<span class="o">//</span><span class="w">    </span><span class="n">t0</span><span class="w">  </span><span class="p">:</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="nb">real</span><span class="w"> </span><span class="n">scalar</span><span class="p">,</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="n">initial</span><span class="w"> </span><span class="nb">time</span><span class="p">.</span>
<span class="o">//</span><span class="w">    </span><span class="n">tf</span><span class="w">  </span><span class="p">:</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="nb">real</span><span class="w"> </span><span class="n">scalar</span><span class="p">,</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="n">final</span><span class="w"> </span><span class="nb">time</span><span class="p">.</span>
<span class="o">//</span><span class="w">    </span><span class="n">n</span><span class="w">   </span><span class="p">:</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="n">positive</span><span class="w"> </span><span class="n">integer</span><span class="p">,</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="k">global</span><span class="w"> </span><span class="n">discretization</span><span class="w"> </span><span class="n">parameter</span><span class="p">.</span>
<span class="o">//</span><span class="w">    </span><span class="n">nmi</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="n">maximum</span><span class="w"> </span><span class="n">allowed</span><span class="w"> </span><span class="n">number</span><span class="w"> </span><span class="n">of</span><span class="w"> </span><span class="n">local</span><span class="w"> </span><span class="n">iterations</span><span class="w"> </span><span class="n">iteration</span><span class="p">.</span>
<span class="o">//</span><span class="w">    </span><span class="n">tol</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="n">positive</span><span class="w"> </span><span class="nb">real</span><span class="w"> </span><span class="n">number</span><span class="p">,</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="n">tolerance</span><span class="p">.</span>
<span class="o">//</span>
<span class="w">    </span><span class="n">t</span><span class="p">=</span><span class="nb">linspace</span><span class="p">(</span><span class="n">t0</span><span class="p">,</span><span class="n">tf</span><span class="p">,</span><span class="n">n</span><span class="p">)</span>
<span class="w">    </span><span class="n">d</span><span class="p">=</span><span class="nb">length</span><span class="p">(</span><span class="n">x0</span><span class="p">)</span>
<span class="w">    </span><span class="n">u</span><span class="p">=</span><span class="nb">zeros</span><span class="p">(</span><span class="n">d</span><span class="p">,</span><span class="n">n</span><span class="p">)</span>
<span class="w">    </span><span class="n">u</span><span class="p">(:,</span><span class="mi">1</span><span class="p">)=</span><span class="n">x0</span><span class="o">&#39;</span>
<span class="w">    </span><span class="n">m</span><span class="p">=</span><span class="mi">10</span><span class="w">   </span><span class="o">//</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="n">discretization</span><span class="w"> </span><span class="n">parameter</span><span class="w"> </span><span class="n">on</span><span class="w"> </span><span class="p">[</span><span class="n">t_i</span><span class="p">,</span><span class="n">t_</span><span class="p">{</span><span class="nb">i</span><span class="o">+</span><span class="mi">1</span><span class="p">}]</span>
<span class="w">    </span><span class="n">u0</span><span class="p">=</span><span class="n">x0</span>
<span class="w">    </span><span class="n">errorMarker</span><span class="p">=</span><span class="c">%t</span>
<span class="w">    </span><span class="k">for</span><span class="w"> </span><span class="nb">i</span><span class="p">=</span><span class="mi">1</span><span class="p">:</span><span class="n">n</span><span class="o">-</span><span class="mi">1</span><span class="w"> </span><span class="n">do</span><span class="w">  </span><span class="o">//</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="n">passage</span><span class="w"> </span><span class="n">from</span><span class="w"> </span><span class="n">t_0</span><span class="w"> </span><span class="n">to</span><span class="w"> </span><span class="n">t_f</span>
<span class="w">        </span><span class="o">//</span><span class="w"> </span><span class="n">Computes</span><span class="w"> </span><span class="n">u0</span><span class="p">:=</span><span class="n">u_</span><span class="p">{</span><span class="nb">i</span><span class="o">+</span><span class="mi">1</span><span class="p">}</span><span class="w"> </span><span class="n">from</span><span class="w"> </span><span class="n">u_i</span>
<span class="w">        </span><span class="p">[</span><span class="n">u0</span><span class="p">,</span><span class="n">eM</span><span class="p">,</span><span class="n">iter</span><span class="p">]=</span><span class="n">vimstep</span><span class="p">(</span><span class="n">f</span><span class="p">,</span><span class="n">df</span><span class="p">,</span><span class="n">u0</span><span class="p">,</span><span class="n">t</span><span class="p">(</span><span class="nb">i</span><span class="p">),</span><span class="n">t</span><span class="p">(</span><span class="nb">i</span><span class="o">+</span><span class="mi">1</span><span class="p">),</span><span class="n">m</span><span class="p">,</span><span class="n">nmi</span><span class="p">,</span><span class="n">tol</span><span class="p">)</span>
<span class="w">        </span><span class="n">u</span><span class="p">(:,</span><span class="nb">i</span><span class="o">+</span><span class="mi">1</span><span class="p">)=</span><span class="n">u0</span><span class="o">&#39;</span>
<span class="w">        </span><span class="n">errorMarker</span><span class="p">=</span><span class="n">errorMarker</span><span class="w"> </span><span class="o">&amp;</span><span class="w"> </span><span class="n">eM</span>
<span class="w">    </span><span class="k">end</span>
<span class="w">    </span><span class="k">if</span><span class="w"> </span><span class="n">errorMarker</span><span class="w"> </span><span class="n">then</span>
<span class="w">        </span><span class="n">info</span><span class="p">=</span><span class="mi">0</span>
<span class="w">    </span><span class="k">else</span>
<span class="w">        </span><span class="n">info</span><span class="p">=</span><span class="mi">1</span>
<span class="w">    </span><span class="k">end</span>
<span class="n">endfunction</span>
</pre></div>
 <span class="normalsize"><p><br /></p>
<p>with <small class="scriptsize"> <div class="highlight"><pre><span></span><span class="k">function</span><span class="w"> </span>[u,eM,iter]<span class="p">=</span><span class="nf">vimstep</span><span class="p">(</span>f,df,x0,t0,tf,n,nmi,tol<span class="p">)</span>
<span class="o">//</span><span class="w"> </span><span class="n">Variational</span><span class="w"> </span><span class="n">Iteration</span><span class="w"> </span><span class="n">Method</span><span class="p">.</span>
<span class="o">//</span>
<span class="o">//</span><span class="w"> </span><span class="n">Output</span><span class="w"> </span><span class="nb">arguments</span>
<span class="o">//</span><span class="w">    </span><span class="n">u</span><span class="w">    </span><span class="p">:</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="nb">real</span><span class="w"> </span><span class="n">vector</span><span class="w"> </span><span class="n">or</span><span class="w"> </span><span class="n">matrix</span><span class="p">,</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="n">numerical</span><span class="w"> </span><span class="n">solution</span><span class="p">.</span>
<span class="o">//</span><span class="w">    </span><span class="n">eM</span><span class="w">   </span><span class="p">:</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="n">boolean</span><span class="w"> </span><span class="n">value</span><span class="p">,</span><span class="w"> </span><span class="nb">error</span><span class="w"> </span><span class="n">marker</span><span class="p">,</span><span class="w"> </span><span class="p">(</span><span class="c">%t - OK).</span>
<span class="o">//</span><span class="w">    </span><span class="n">iter</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="n">an</span><span class="w"> </span><span class="n">integer</span><span class="p">,</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="n">number</span><span class="w"> </span><span class="n">of</span><span class="w"> </span><span class="n">local</span><span class="w"> </span><span class="n">performed</span><span class="w"> </span><span class="n">iterations</span><span class="p">.</span>
<span class="o">//</span><span class="w"> </span><span class="n">Input</span><span class="w"> </span><span class="nb">arguments</span>
<span class="o">//</span><span class="w">    </span><span class="n">f</span><span class="w">   </span><span class="p">:</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="n">Scilab</span><span class="w"> </span><span class="k">function</span><span class="p">,</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="n">right</span><span class="w"> </span><span class="n">hand</span><span class="w"> </span><span class="nb">size</span><span class="w"> </span><span class="n">of</span><span class="w"> </span><span class="n">the</span>
<span class="w">            </span><span class="n">differential</span><span class="w"> </span><span class="nb">system</span><span class="p">.</span>
<span class="o">//</span><span class="w">    </span><span class="n">df</span><span class="w">  </span><span class="p">:</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="n">Scilab</span><span class="w"> </span><span class="k">function</span><span class="p">,</span><span class="w"> </span><span class="n">df</span><span class="p">=(</span><span class="n">df_1</span><span class="o">/</span><span class="n">dx_1</span><span class="p">,</span><span class="n">df_2</span><span class="o">/</span><span class="n">dx_2</span><span class="p">,</span><span class="k">...</span><span class="c">).</span>
<span class="o">//</span><span class="w">    </span><span class="n">x0</span><span class="w">  </span><span class="p">:</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="nb">real</span><span class="w"> </span><span class="n">vector</span><span class="p">,</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="n">initial</span><span class="w"> </span><span class="n">conditions</span><span class="p">.</span>
<span class="o">//</span><span class="w">    </span><span class="n">t0</span><span class="w">  </span><span class="p">:</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="nb">real</span><span class="w"> </span><span class="n">scalar</span><span class="p">,</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="n">initial</span><span class="w"> </span><span class="nb">time</span><span class="p">.</span>
<span class="o">//</span><span class="w">    </span><span class="n">tf</span><span class="w">  </span><span class="p">:</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="nb">real</span><span class="w"> </span><span class="n">scalar</span><span class="p">,</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="n">final</span><span class="w"> </span><span class="nb">time</span><span class="p">.</span>
<span class="o">//</span><span class="w">    </span><span class="n">n</span><span class="w">   </span><span class="p">:</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="n">positive</span><span class="w"> </span><span class="n">integer</span><span class="p">,</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="n">local</span><span class="w"> </span><span class="n">discretization</span><span class="w"> </span><span class="n">parameter</span><span class="p">.</span>
<span class="o">//</span><span class="w">    </span><span class="n">nmi</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="n">maximum</span><span class="w"> </span><span class="n">allowed</span><span class="w"> </span><span class="n">number</span><span class="w"> </span><span class="n">of</span><span class="w"> </span><span class="n">local</span><span class="w"> </span><span class="n">iterations</span><span class="w"> </span><span class="n">iteration</span><span class="p">.</span>
<span class="o">//</span><span class="w">    </span><span class="n">tol</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="n">positive</span><span class="w"> </span><span class="nb">real</span><span class="w"> </span><span class="n">number</span><span class="p">,</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="n">tolerance</span><span class="p">.</span>
<span class="o">//</span>
<span class="w">    </span><span class="n">t</span><span class="p">=</span><span class="nb">linspace</span><span class="p">(</span><span class="n">t0</span><span class="p">,</span><span class="n">tf</span><span class="p">,</span><span class="n">n</span><span class="p">)</span>
<span class="w">    </span><span class="n">h</span><span class="p">=(</span><span class="n">tf</span><span class="o">-</span><span class="n">t0</span><span class="p">)</span><span class="o">/</span><span class="p">(</span><span class="n">n</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span>
<span class="w">    </span><span class="n">d</span><span class="p">=</span><span class="nb">length</span><span class="p">(</span><span class="n">x0</span><span class="p">)</span>
<span class="w">    </span><span class="n">u_old</span><span class="p">=</span><span class="nb">zeros</span><span class="p">(</span><span class="n">d</span><span class="p">,</span><span class="n">n</span><span class="p">)</span>
<span class="w">    </span><span class="n">u_old</span><span class="p">(:,</span><span class="mi">1</span><span class="p">)=</span><span class="n">x0</span><span class="o">&#39;</span>
<span class="w">    </span><span class="n">sw</span><span class="p">=</span><span class="c">%t</span>
<span class="w">    </span><span class="n">iter</span><span class="p">=</span><span class="mi">0</span>
<span class="w">    </span><span class="k">while</span><span class="w"> </span><span class="n">sw</span><span class="w"> </span><span class="n">do</span>
<span class="w">        </span><span class="n">iter</span><span class="p">=</span><span class="n">iter</span><span class="o">+</span><span class="mi">1</span>
<span class="w">        </span><span class="n">u_new</span><span class="p">=</span><span class="nb">zeros</span><span class="p">(</span><span class="n">d</span><span class="p">,</span><span class="n">n</span><span class="p">)</span>
<span class="w">        </span><span class="n">u_new</span><span class="p">(:,</span><span class="mi">1</span><span class="p">)=</span><span class="n">x0</span><span class="o">&#39;</span>
<span class="w">        </span><span class="n">f0</span><span class="p">=</span><span class="nb">zeros</span><span class="p">(</span><span class="n">d</span><span class="p">,</span><span class="n">n</span><span class="p">)</span>
<span class="w">        </span><span class="n">df0</span><span class="p">=</span><span class="nb">zeros</span><span class="p">(</span><span class="n">d</span><span class="p">,</span><span class="n">n</span><span class="p">)</span>
<span class="w">        </span><span class="k">for</span><span class="w"> </span><span class="nb">j</span><span class="p">=</span><span class="mi">1</span><span class="p">:</span><span class="n">n</span><span class="w"> </span><span class="n">do</span>
<span class="w">            </span><span class="n">p</span><span class="p">=</span><span class="n">u_old</span><span class="p">(:,</span><span class="nb">j</span><span class="p">)</span>
<span class="w">            </span><span class="n">q</span><span class="p">=</span><span class="n">f</span><span class="p">(</span><span class="n">t</span><span class="p">(</span><span class="nb">j</span><span class="p">),</span><span class="n">p</span><span class="p">)</span>
<span class="w">            </span><span class="n">dq</span><span class="p">=</span><span class="n">df</span><span class="p">(</span><span class="n">t</span><span class="p">(</span><span class="nb">j</span><span class="p">),</span><span class="n">p</span><span class="p">)</span>
<span class="w">            </span><span class="n">f0</span><span class="p">(:,</span><span class="nb">j</span><span class="p">)=</span><span class="n">q</span>
<span class="w">            </span><span class="n">df0</span><span class="p">(:,</span><span class="nb">j</span><span class="p">)=</span><span class="n">dq</span>
<span class="w">        </span><span class="k">end</span>
<span class="w">        </span><span class="k">for</span><span class="w"> </span><span class="nb">i</span><span class="p">=</span><span class="mi">2</span><span class="p">:</span><span class="n">n</span><span class="w"> </span><span class="n">do</span>
<span class="w">            </span><span class="n">z</span><span class="p">=</span><span class="nb">zeros</span><span class="p">(</span><span class="n">d</span><span class="p">,</span><span class="n">n</span><span class="p">)</span>
<span class="w">            </span><span class="k">for</span><span class="w"> </span><span class="nb">j</span><span class="p">=</span><span class="nb">i</span><span class="o">-</span><span class="mi">1</span><span class="p">:</span><span class="o">-</span><span class="mi">1</span><span class="p">:</span><span class="mi">1</span><span class="w"> </span><span class="n">do</span>
<span class="w">                </span><span class="n">z</span><span class="p">(:,</span><span class="nb">j</span><span class="p">)=</span><span class="mf">0.5</span><span class="o">*</span><span class="n">h</span><span class="o">*</span><span class="p">(</span><span class="n">df0</span><span class="p">(:,</span><span class="nb">j</span><span class="p">)</span><span class="o">+</span><span class="n">df0</span><span class="p">(:,</span><span class="nb">j</span><span class="o">+</span><span class="mi">1</span><span class="p">))</span><span class="o">+</span><span class="n">z</span><span class="p">(:,</span><span class="nb">j</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span>
<span class="w">            </span><span class="k">end</span>
<span class="w">            </span><span class="n">w</span><span class="p">=(</span><span class="n">f0</span><span class="o">-</span><span class="n">df0</span><span class="o">.*</span><span class="n">u_old</span><span class="p">)</span><span class="o">.*</span><span class="nb">exp</span><span class="p">(</span><span class="n">z</span><span class="p">)</span>
<span class="w">            </span><span class="n">s</span><span class="p">=</span><span class="nb">zeros</span><span class="p">(</span><span class="n">d</span><span class="p">,</span><span class="mi">1</span><span class="p">)</span>
<span class="w">            </span><span class="n">s</span><span class="p">=</span><span class="n">w</span><span class="p">(:,</span><span class="mi">1</span><span class="p">)</span><span class="o">+</span><span class="n">w</span><span class="p">(:,</span><span class="nb">i</span><span class="p">)</span>
<span class="w">            </span><span class="k">if</span><span class="w"> </span><span class="nb">i</span><span class="o">&gt;</span><span class="mi">2</span><span class="w"> </span><span class="n">then</span>
<span class="w">                </span><span class="k">for</span><span class="w"> </span><span class="nb">j</span><span class="p">=</span><span class="mi">2</span><span class="p">:</span><span class="nb">i</span><span class="o">-</span><span class="mi">1</span><span class="w"> </span><span class="n">do</span>
<span class="w">                    </span><span class="n">s</span><span class="p">=</span><span class="n">s</span><span class="o">+</span><span class="mi">2</span><span class="o">*</span><span class="n">w</span><span class="p">(:,</span><span class="nb">j</span><span class="p">)</span>
<span class="w">                </span><span class="k">end</span>
<span class="w">            </span><span class="k">end</span>
<span class="w">            </span><span class="n">u_new</span><span class="p">(:,</span><span class="nb">i</span><span class="p">)=</span><span class="mf">0.5</span><span class="o">*</span><span class="n">h</span><span class="o">*</span><span class="n">s</span><span class="o">+</span><span class="nb">exp</span><span class="p">(</span><span class="n">z</span><span class="p">(:,</span><span class="mi">1</span><span class="p">))</span><span class="o">.*</span><span class="n">x0</span><span class="o">&#39;</span>
<span class="w">        </span><span class="k">end</span>
<span class="w">        </span><span class="n">nrm</span><span class="p">=</span><span class="nb">max</span><span class="p">(</span><span class="nb">abs</span><span class="p">(</span><span class="n">u_new</span><span class="o">-</span><span class="n">u_old</span><span class="p">))</span>
<span class="w">        </span><span class="n">u_old</span><span class="p">=</span><span class="n">u_new</span>
<span class="w">        </span><span class="k">if</span><span class="w"> </span><span class="n">nrm</span><span class="o">&lt;</span><span class="n">tol</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">iter</span><span class="o">&gt;=</span><span class="n">nmi</span><span class="w"> </span><span class="n">then</span>
<span class="w">            </span><span class="n">sw</span><span class="p">=</span><span class="c">%f</span>
<span class="w">        </span><span class="k">end</span>
<span class="w">    </span><span class="k">end</span>
<span class="w">    </span><span class="n">u</span><span class="p">=</span><span class="n">u_old</span><span class="p">(:,</span><span class="n">n</span><span class="p">)</span><span class="o">&#39;</span>
<span class="w">    </span><span class="k">if</span><span class="w"> </span><span class="n">nrm</span><span class="o">&lt;</span><span class="n">tol</span><span class="w"> </span><span class="n">then</span>
<span class="w">        </span><span class="n">eM</span><span class="p">=</span><span class="c">%t</span>
<span class="w">    </span><span class="k">else</span>
<span class="w">        </span><span class="n">eM</span><span class="p">=</span><span class="c">%f</span>
<span class="w">    </span><span class="k">end</span>
<span class="n">endfunction</span>
</pre></div>
 <span class="normalsize"><p>The calling sequence for Example <a href="#vim33">4</a> is <small class="scriptsize"> <div class="highlight"><pre><span></span><span class="n">deff</span><span class="p">(</span><span class="s">&#39;q=f(t,p)&#39;</span><span class="p">,</span>
<span class="w">    </span><span class="p">[</span><span class="s">&#39;x1=p(1)&#39;</span><span class="p">,</span><span class="s">&#39;x2=p(2)&#39;</span><span class="p">,</span><span class="s">&#39;q(1)=x2&#39;</span><span class="p">,</span><span class="s">&#39;q(2)=x1.*x2.^2.0./(x1.^2-1)&#39;</span><span class="p">])</span>
<span class="n">deff</span><span class="p">(</span><span class="s">&#39;q=df(t,p)&#39;</span><span class="p">,</span>
<span class="w">    </span><span class="p">[</span><span class="s">&#39;x1=p(1)&#39;</span><span class="p">,</span><span class="s">&#39;x2=p(2)&#39;</span><span class="p">,</span><span class="s">&#39;q(1)=0&#39;</span><span class="p">,</span><span class="s">&#39;q(2)=2*x1.*x2./(x1.^2-1)&#39;</span><span class="p">])</span>
<span class="n">x0</span><span class="p">=[</span><span class="mf">0.5</span><span class="p">,</span><span class="mf">0.5</span><span class="o">*</span><span class="nb">sqrt</span><span class="p">(</span><span class="mi">3</span><span class="p">)]</span>
<span class="n">t0</span><span class="p">=</span><span class="mi">0</span>
<span class="n">tf</span><span class="p">=</span><span class="c">%pi/3</span>
<span class="n">n</span><span class="p">=</span><span class="mi">100</span>
<span class="n">nmi</span><span class="p">=</span><span class="mi">50</span>
<span class="n">tol</span><span class="p">=</span><span class="mf">1e-5</span>
<span class="p">[</span><span class="n">t</span><span class="p">,</span><span class="n">u</span><span class="p">,</span><span class="n">info</span><span class="p">]=</span><span class="n">vim</span><span class="p">(</span><span class="n">f</span><span class="p">,</span><span class="n">df</span><span class="p">,</span><span class="n">x0</span><span class="p">,</span><span class="n">t0</span><span class="p">,</span><span class="n">tf</span><span class="p">,</span><span class="n">n</span><span class="p">,</span><span class="n">nmi</span><span class="p">,</span><span class="n">tol</span><span class="p">)</span>
</pre></div>
 <span class="normalsize"></span></small></p>
</span></small></p>
</span></small></p>

</div> <!--main-text -->
</div> <!-- content-wrapper -->
</div> <!-- content -->
</div> <!-- wrapper -->

<nav class="prev_up_next">
</nav>

<script type="text/javascript" src="/var/www/clients/client1/web1/web/files/jnaat-files/journals/1/articles/js/jquery.min.js"></script>
<script type="text/javascript" src="/var/www/clients/client1/web1/web/files/jnaat-files/journals/1/articles/js/plastex.js"></script>
<script type="text/javascript" src="/var/www/clients/client1/web1/web/files/jnaat-files/journals/1/articles/js/svgxuse.js"></script>
</body>
</html>