Introduction

In this paper, we consider stochastic dynamic equations of motion for a freely draining polymer with one end fixed at the origin and the other end attached to a microsphere [1, 2]. Take \(N + 1\) particles with positions \(R_n\) immersed in a fluid and assume that nearest-neighbors are connected by harmonic springs. If the particles are furthermore subject to an external forcing F, the equations of motion (in the overdamped regime where the forces acting on the particle are more important than inertia, which can also formally be seen as the limit where the masses of the particles go to zero) would be given by

$$\begin{aligned} \frac{dR_0}{dt}= & {} k(R_1-R_0)+F(R_0),\nonumber \\ \frac{dR_n}{dt}= & {} k(R_{n+1}+R_{n-1}-2R_n)+F(R_n),\quad n=1,...,N-1,\\ \frac{dR_N}{dt}= & {} k(R_N-R_{N-1})+F(R_N).\nonumber \end{aligned}$$
(1)

This is a primitive model for a polymer chain consisting of \(N + 1\) monomers and without self-interaction. It does, however, not take into account the effect of the molecules of water that would randomly ‘kick’ the particles that make up our string. Assuming that these kicks occur randomly and independently at high rate, this effect can be modeled in first instance by independent white noises acting on all degrees of freedom of our model. Thus we obtain a system of coupled stochastic differential equations:

$$\begin{aligned} dR_0= & {} k(R_1-R_0)dt+F(R_0)dt+\sigma dB_0(t),\nonumber \\ dR_n= & {} k(R_{n+1}+R_{n-1}-2R_n)dt+F(R_n)dt+\sigma dB_n(t),\quad n=1,...,N-1,\\ dR_N= & {} k(R_N-R_{N-1})dt+F(R_N)dt+\sigma dB_N(t).\nonumber \end{aligned}$$
(2)

To obtain the equation of typical polymer strand from the finite bead strings, we conceptually take a continuum limit (with the scalings \(k \simeq vN^2\) and \(\sigma \simeq \sqrt{N}\)), replacing the system (2) with an equation on the interval \(0\le n\le N\), where now N is the length of the strand. In the limit it is obtained a stochastic partial differential equation (SPDE) in n for the position R(tn) of particles along the strand given by

$$\begin{aligned} dR(x, t)=\partial _x^2R(x, t) dt + F(R(x, t)) dt + dB(x, t) , \end{aligned}$$
(3)

endowed with the boundary conditions \(\partial _xR(0, t) = \partial _xR(1, t) = 0.\)

Most numerical work on SPDE’s has concentrated on the Euler finite-difference scheme. Gyongi and Nualart [3] have proved that these schemes converge, and Gyongi [4] has determined the order of convergence. Davie and Gaines [6], examining a much larger class of schemes, have found a universal lower bound for the rate of convergence. Gyongi [4, 5] also applied finite differences for an SPDE driven by spacetime white noise and then used several temporal implicit and explicit schemes, in particular, the linear-implicit Euler scheme. He showed that these schemes converge with order 1/2 in space and with order 1/4 in time (assuming a smooth initial value). This is the bound given by Gyongi, so the simple Euler scheme achieves the optimal rate of convergence. (If h is the space step and k is the time step, for the Euler scheme, k must be smaller than a constant times \(h^2\), so that one can say that the scheme is roughly of order one-fourth).

In recent years, the homotopy perturbation method (HPM) has been an active area of research since it was originally proposed by He [710]. Considerable research works have been conducted recently in applying this method to a class of linear and non-linear equations and have been developed for solving differential and integral equations [1020]. In [10] He modified the general Lagrange multiplier method and [11] constructed an iterative sequence of functions which converges to the exact solution. In most linear problems, on determining the exact Lagrange multiplier, the approximate solution turns into the exact solution and is available with just one iteration. In this method the solution is considered as the summation of an infinite series which usually converges rapidly to the exact solutions. In [12], local fractional variation iteration method used for solving fractional heat conduction problem and papers [13, 14] used this method for the mixed Volterra–Fredholm integral equations. We apply the method for solving stochastic mixed Volterra–Fredholm integral equations.

The sections of this paper are organized as follows: In the next section we review some general stochastic concepts of space–time white noise. “Mixed Stochastic Volterra–Fredholm Integral Equations” section expresses the model as a stochastic mixed Volterra–Fredholm integral equations. “Homotopy Perturbation Method for the Stochastic Mixed Volterra–Fredholm Integral Equations” section, presents the homotopy perturbation method and is applied the method to solve stochastic mixed Volterra–Fredholm integral equations. “Numerical Examples” section, the method has been supported by numerical examples and finally, “Conclusion” section provides a brief conclusion.

Stochastic Concepts of Space–Time White Noise

In many physical dynamical systems with randomness, the driving noise is given as a space–time white noise process, also referred to as a Brownian sheet. In this section we introduce this stochastic process. Let \((\Omega ,F, P, {F_t})\) be a filtered probability space and fix a bounded open subset \(O\in R\).

Definition 2.1

A Gaussian family of realvalued random variables \(\{B(x, t), (x, t)\in O \times R_+\}\) on the above filtered probability space is called a Brownian sheet if

(i) \(E(B(x,t))=0,\forall (x,t)\in O \times R_+\).

(ii)\(B(x, t) - B(x, s)\) is independent of \(\{F_s\}, \forall 0 \le s \le t \) and \(x \in O\).

(iii) \(Cov( B(x,t),B(y,s))=\lambda (A_{x,t},A_{y,s})\), where \(\lambda \) is the Lebesgue measure on \(O\times R_+\)and \(A_{x,t} .= \{(y,s) \in O\times R_+ |0 \le s \le t\) and \(y \le x\}\).

(ii) The map \((x,t) \rightarrow B(x,t)\) from \(O \times R_+\) to R is continuous a.s.

This process is a generalization of the one-parameter Brownian motion and we list its main properties below.

  1. (1)

    \(B(x,t) = 0\) for \(x = 0\) or \(t = 0 \) (B vanishes on the axes).

  2. (2)

    B has independent increments, i.e. that for every pair of disjoints rectangles \(R_1\) and \(R_2\) of \([0, T]^2,\) the increment of B on \(R_1\) is a real-valued random variable independent on the increment of B on \(R_2.\) The definition of an increment of B on a rectangle is defined as follows. Let R be a rectangle \(R := [x_1, x_2] \times [t_1, t_2]\) then the increment of B on R (denoted \(\bigtriangleup _RB\)) is defined as:

    $$\begin{aligned} \bigtriangleup _RB:= & {} B(x_2,t_2) -B(x_1,t_2) -B(x_2,t_1) +B(x_1,t_1) \nonumber \\= & {} (B(x_2,t_2) -B(x_1,t_2))-(B(x_2,t_1) -B(x_1,t_1)). \end{aligned}$$
  3. (3)

    B is a (centered) Gaussian process and in particular we have that

    $$\begin{aligned} E[B(x_1,t_1)B(x_2,t_2)] = min(x_1, x_2)min(t_1, t_2), \forall (x_1, t_1), (x_2, t_2) \in [0, T]^2. \end{aligned}$$

Let \(\wp := L^2([0, T]^2, dsdt)\) the space of deterministic functions \(f : [0, T]^2 \rightarrow R\) such that \(\int _{[0,T]^2} f(s, t)^2dsdt < \infty \) where dsdt denotes the Lebesgue measure on \([0, T]^2.\) Then

$$\begin{aligned} SI:=\int _{[0,T]^2} h(s, t)dB(s,t), h \in \wp , \end{aligned}$$

defines an isonormal Gaussian process on \(\wp \). Once again the Ito calculus gives that

  1. (1)

    SI is a linear map.

  2. (2)

    \(E (\int _{[0,T]^2} f(s, t)dB(s,t)) = 0, \forall f \in \wp .\)

  3. (3)

    SI is a (centered) Gaussian random variable with variance \(\int _{[0,T]^2} f(s, t)^2dsdt, \forall f \in \wp .\)

  4. (4)

    For all fg in \(\wp \) we have that

    $$\begin{aligned}&E \left( \int _{[0,T]^2} f(s, t)dB(s,t) \int _{[0,T]^2} g(s, t)dB(s,t) \right) =\int _{[0,T]^2} f(s, t)g(s, t)dsdt \\&\quad = <f, g> . \end{aligned}$$

For more detail see [21, 22].

Mixed Stochastic Volterra–Fredholm Integral Equations

we consider the stochastic partial differential equation

$$\begin{aligned} \frac{\partial }{\partial t}u(x,t)=\frac{\partial ^2}{\partial x^2} u(x,t) +F(x,t,u(x,t))+\sigma (x,t,u(x,t))\frac{\partial ^2}{\partial t \partial x} B(x,t), \end{aligned}$$
(4)

with following boundary condition

$$\begin{aligned} u(x,0)= & {} f(x), \quad x\in [0,1],\nonumber \\ \partial _xu(0,t)= & {} \partial _xu(1,t)=0, \quad t\ge 0, \end{aligned}$$
(5)

where, \(F,\sigma \) are locally Lipschitz continuous and locally bounded Borel functions mapping \(R_+ \times [0, 1] \times R\) into R. The existence of a unique solution of this problem has proved by space-discretization in [23], when F and \(\sigma \) are Lipschitz functions. and f(x) be a continuous function on [0, 1].

The solutions of (45) are continuous but non-differentiable functions. Since the derivatives do not exist, (45) should just be regarded as shorthand for an integral equation [2426]. We say informally

$$\begin{aligned} u(x,t)= & {} \int _0^1 G(x,\xi ,t)(\xi )d\xi +\int _0^t\int _0^1 G(x,\xi ,t-\tau )F(x,\xi ,t,\tau ,u(\xi ,\tau )d\xi d\tau \nonumber \\&+\int _0^t\int _0^1 G(x,\xi ,t-\tau )\sigma (x,\xi ,t,\tau ,u(\xi ,\tau ))dB(\xi ,\tau ), \end{aligned}$$
(6)

is the solution of (45). where \(G(x,\xi ,\tau )\) is the Green’s function or fundamental solution for the homogeneous equation \(\frac{\partial u}{\partial t}=\frac{\partial ^2 u}{\partial x^2}\) with boundary conditions \(\partial _xu(t, 0) = \partial _xu(t, 1) = 0\) for all \(t > 0\).

We note that the first term in (6) is what we obtain from the heat equation. The second term in (6) is the stochastic term.

Homotopy Perturbation Method for the Stochastic Mixed Volterra–Fredholm Integral Equations

Basic Ideas of Homotopy Perturbation Method

The goal of this section is to recall notations and basic concept of homotopy perturbation method that are used in the next sections. Consider the following general nonlinear differential equation:

$$\begin{aligned} A(u)-f(r)=0, \quad r\in \Omega , \end{aligned}$$
(7)

with the following boundary conditions:

$$\begin{aligned} B\left( u,\frac{\partial u}{\partial n}\right) = 0, \quad r\in \Gamma , \end{aligned}$$
(8)

where, A is a general differential operator, B is a boundary operator, f(r) is a known analytic function, \(\Gamma \) is the boundary of the domain \(\Omega \).

Generally speaking, the operator A can be divided into two parts L and N, where L is linear, and N is nonlinear, therefore Eq. (7) can be written as

$$\begin{aligned} L(u)+N(u)-f(r)=0. \end{aligned}$$
(9)

By using homotopy technique, one can construct a homotopy \(v(r,p):\Omega \times [0,1]\rightarrow R\) which satisfies

$$\begin{aligned} H(v,p)= (1-p)(L(v)-L(u_0))+p(A(v)-f(r))=0, \quad p \in [0, 1], \end{aligned}$$
(10)

or

$$\begin{aligned} H(v,p)= (L(v)-L(u_0))+pL(u_0)+p(N(v)-f(r))=0, \quad p \in [0, 1], \end{aligned}$$
(11)

where \(p \in [0,1]\) is an embedding parameter, and \(u_0\) is the initial approximation of Eq. (7) which satisfies the boundary conditions.

$$\begin{aligned} H(v,0)= L(v)-L(u_0)=0, \quad H(v,1)=A(v)-f(r)=0, \end{aligned}$$
(12)

the changing process of p from zero to unity is just that of v(rp) changing from \(u_0(r)\) to u(r). This is called deformation, and also, \(L(v)- L(u_0)\) and \(A(v) - f(r)\) are called homotopic in topology. If, the embedding parameter \(p; p\in [0,1]\) is considered as a “small parameter”, applying the classical perturbation technique. The solutions to problem (12) can be written as a power series in p,  i.e.,

$$\begin{aligned} v = v_0+ pv_1+ p^2v_2+ . . ., \end{aligned}$$
(13)

when \(p\rightarrow 1\), the approximate or the exact solution for Eq. (7), will be obtained

$$\begin{aligned} u = lim_{p\rightarrow 1} v=v_0+v_1+v_2+\cdots . \end{aligned}$$
(14)

The convergence of series (14) has been proved in [7], and the stability of this method is addressed in [20]. The major advantage of He’s homotopy perturbation method is that the perturbation equation can be freely constructed in many ways (therefore is problem dependent) by homotopy in topology and the initial approximation can also be freely selected. Moreover, the constructions of the homotopy for the perturb problem plays very important role for obtaining desired accuracy. So, homotopy perturbation method will receive considerable attention in dealing with nonlinear problems in engineering and science.

The Homotopy Perturbation Method Applied to Stochastic Mixed Volterra–Fredholm Integral Equations

The stochastic mixed Volterra–Fredholm integral equation is given as

$$\begin{aligned} u(x,t)= & {} f(x,t)+\int _0^t\int _0^1F (x,t,\xi ,\tau ,u(\xi ,\tau ))d\xi d\tau \nonumber \\&+ \int _0^t\int _0^1\sigma (x,t,\xi ,\tau ,u(\xi ,\tau ))dB(\xi ,\tau ), \quad (x,t)\in \Omega \times [0,T]. \end{aligned}$$
(15)

It is assumed that the function f can be divided into the sum of two parts, namely \(f_0\) and \(f_1,\) so

$$\begin{aligned} f=f_0+f_1. \end{aligned}$$
(16)

Then Eq. (15) can be write as

$$\begin{aligned} u(x,t)= & {} f_0(x,t)+f_1(x,t)+\int _0^t\int _0^1F(x,t,\xi ,\tau ,u(\xi ,\tau ))d\xi d\tau \nonumber \\&+\int _0^t\int _0^1\sigma (x,t,\xi ,\tau ,u(\xi ,\tau ))dB(\xi ,\tau ), \end{aligned}$$
(17)

select a homotopy such that

$$\begin{aligned}&u(x,t)-f_0(x,t)-p(f_1(x,t)+\int _0^t\int _0^1F(x,t,\xi ,\tau ,u(\xi ,\tau ))d\xi d\tau \nonumber \\&+ \int _0^t\int _0^1\sigma (x,t,\xi ,\tau ,u(\xi ,\tau ))dB(\xi ,\tau ))=0, \end{aligned}$$
(18)

substituting (13) into (18), and equating the terms with identical powers of p,

$$\begin{aligned} p^0 : u_0(x,t)= & {} f_0(x, t),\end{aligned}$$
(19)
$$\begin{aligned} p^1 : u_1(x,t)= & {} f_1(x,t)+\int _0^t\int _0^1F(x,t,\xi ,\tau ,u_0(\xi ,\tau ))d\xi d\tau \nonumber \\&+ \int _0^t\int _0^1\sigma (x,t,\xi ,\tau ,u_0(\xi ,\tau ))dB(\xi ,\tau ), \end{aligned}$$
(20)
$$\begin{aligned}&.\nonumber \\&.\nonumber \\&.\nonumber \\ p^k : u_k(x,t)= & {} \int _0^t\int _0^1F(x,t,\xi ,\tau ,u_{k-1}(\xi ,\tau ))d\xi d\tau \nonumber \\&+ \int _0^t\int _0^1\sigma (x,t,\xi ,\tau ,u_{k-1}(\xi ,\tau ))dB(\xi ,\tau ), \end{aligned}$$
(21)

(19)–(21) will allow us to determine the \(u_n (x,t),n\ge 0\) recurrently, and finally, solution u(xt) is readily obtained.

Numerical Examples

The method presented in this paper is used to find numerical solution of two examples, a simple example with exact solution and another example, a model for random string.

Example 1

Consider the following linear stochastic integral equation,

$$\begin{aligned} u(x,t)=\frac{1}{12}+\int _{0}^{t}\int _0^1u(y,s)dyds+\int _{0}^{t}\int _0^1u(y,s)dB(y,s), \quad \quad t,x\in [0,1), \end{aligned}$$
(22)

with the exact solution \(u(x,t)=\frac{1}{12}e^{\frac{1}{2}t+B(t,1)}\), for \(0 \le t,x < 1\).

According to previous relations

$$\begin{aligned} f_0(x,t)= & {} \frac{1}{12},\\ f_1(x,t)= & {} 0. \end{aligned}$$

As a result

$$\begin{aligned} p^0 : u_0(x,t)= & {} \frac{1}{12}.\nonumber \\ p^1 : u_1(x,t)= & {} \int _0^t\int _0^1u_0(\xi ,\tau )d\xi d\tau +\int _0^t\int _0^1 u_0(\xi ,\tau )dB(\xi ,\tau ) \nonumber \\= & {} \int _0^t\int _0^1\frac{1}{12}d\xi d\tau +\int _0^t\int _0^1 \frac{1}{12}dB(\xi ,\tau )\nonumber \\= & {} \frac{1}{12} (t+B(1,t)).\nonumber \\ p^2:u_2(x,t)= & {} \int _0^t\int _0^1 \frac{1}{12} (\tau +B(1,\tau ))d\xi d\tau +\int _0^t\int _0^1 \frac{1}{12} (\tau +B(1,\tau ))dB(\xi ,\tau )\nonumber \\= & {} \frac{1}{12}\frac{t^2}{2}+\int _0^t \frac{1}{12} B(1,\tau ) d\tau +\int _0^t \frac{1}{12} \tau dB(1 ,\tau )+\int _0^t \frac{1}{12} B(1,\tau ) dB(1 ,\tau )\nonumber \\ \end{aligned}$$
(23)

by using the integration by part for third term and

$$\begin{aligned} B^m(1,t)=m\int _0^tB^{m-1}(1,\tau )dB(1,\tau )+\frac{m(m-1)}{2}\int _0^tB^{m-2}(1,\tau )d\tau . \quad m\ge 2 \end{aligned}$$

for the forth part we have

$$\begin{aligned}= & {} \frac{1}{12}\left( \frac{t^2}{2}+\int _0^t B(1,\tau ) d\tau +t B(1,t)-\int _0^t B(1 ,\tau ) d\tau +\frac{B^2(1,\tau )}{2}-\frac{t}{2}\right) \\= & {} \frac{1}{12}\left( \frac{t^2}{2}-\frac{t}{2}+t B(1,t)+\frac{B^2(1,t)}{2}\right) \\ p^3:u_3(x,t)= & {} \int _0^t\int _0^1 \frac{1}{12} \left( \frac{\tau ^2}{2}-\frac{\tau }{2}+\tau B(1,\tau )+\frac{B^2(1,\tau )}{2}\right) d\xi d\tau \nonumber \\&+\int _0^t\int _0^1 \frac{1}{12} \left( \frac{\tau ^2}{2}-\frac{\tau }{2}+\tau B(1,\tau )+\frac{B^2(1,\tau )}{2}\right) dB(\xi ,\tau )\\= & {} \frac{1}{12}\left( \frac{t^3}{3!}-\frac{t^2}{4}+\int _0^t\tau B(1,\tau )d\tau +\int _0^t \frac{B^2(1,\tau )}{2}d\tau +\frac{t^2}{2}B(1,t)\right. \nonumber \\&\left. -\int _0^t\tau B(1,\tau )d\tau -\frac{t}{2}B(1,t)+\int _0^t\frac{B(1,\tau )}{2}d\tau \right. \\&\left. +\int _0^t\tau B(1,\tau )dB(1,\tau )+\frac{B^3(1,t)}{3!}-\int _0^t\frac{B(1,\tau )}{2} d\tau \right) \\= & {} \frac{1}{12}\left( \frac{t^3}{3!}-\frac{t^2}{4}+ \int _0^t \frac{B^2(1,\tau )}{2}d\tau +\frac{t^2}{2}B(1,t)-\frac{t}{2}B(1,t)\right. \nonumber \\&\left. +\int _0^t\tau B(1,\tau )dB(1,\tau )+\frac{B^3(1,t)}{3!}\right) \\= & {} \frac{1}{12}\left( \frac{t^3}{3!}-\frac{t^2}{4}+ \int _0^t \frac{B^2(1,\tau )}{2}d\tau +\frac{t^2}{2}B(1,t)-\frac{t}{2}B(1,t)\right. \nonumber \\&\left. +\,t\frac{B^2(1,t)}{2}-\frac{t^2}{2}-\int _0^t\frac{B^2(1,\tau )}{2}d\tau +\int _0^t\frac{\tau }{2} d\tau +\frac{B^3(1,t)}{3!}\right) \\= & {} \frac{1}{12}\left( \frac{t^3}{3!}-\frac{t^2}{2}+ \frac{t^2}{2}B(1,t)-\frac{t}{2}B(1,t)+t\frac{B^2(1,t)}{2} +\frac{B^3(1,t)}{3!}\right) \\ p^4:u_4(x,t)= & {} \!\!\int _0^t\!\int _0^1 \frac{1}{12}\! \left( \frac{\tau ^3}{3!}\!-\!\frac{\tau ^2}{2}\!+\! \frac{\tau ^2}{2}B(1,\tau )\!-\!\frac{\tau }{2}B(1,\tau )\!+\!\!\tau \frac{B^2(1,\tau )}{2} \!\!+\!\frac{B^3(1,\tau )}{3!}\right) d\xi d\tau \\&+\int _0^t\int _0^1 \frac{1}{12} \left( \frac{\tau ^3}{3!}-\frac{\tau ^2}{2}+ \frac{\tau ^2}{2}B(1,\tau )-\frac{\tau }{2}B(1,\tau )\right. \nonumber \\&\left. +\,\tau \frac{B^2(1,\tau )}{2} +\frac{B^3(1,\tau )}{3!}\right) dB(\xi ,\tau )\\= & {} \frac{1}{12}\left( \frac{t^4}{4!}-\frac{t^3}{3!}-\frac{t^3}{6} +\frac{t^2}{8}+\cdots \right) . \end{aligned}$$

And by repeating this approach we obtain

$$\begin{aligned} u(x,t)=\sum _{i=0}^\infty u_i(x,t)=\frac{1}{12} \left( 1+\frac{t}{2}+B(1,t)+\frac{\left( \frac{t}{2}+B(1,t)\right) ^2}{2!}+\cdots \right) =\frac{1}{12}e^{\frac{t}{2}+B(1,t)}. \end{aligned}$$

which are exact solutions of Example 1.

Example 2

At first we consider a model for random string

$$\begin{aligned} \frac{\partial }{\partial t}u(x,t)= & {} \frac{\partial ^2}{\partial x^2} u(x,t)+u(x,t)+ \frac{\partial ^2}{\partial t \partial x} B(x,t),\\ u_x(0, t)= & {} 0,\nonumber \\ u_x(1, t)= & {} 0 \quad t>0,\nonumber \\ u(x,0)= & {} f(x)=1 \quad 0\le x \le 1,\nonumber \end{aligned}$$
(24)

has the mixed Volterra–Fredholm form

$$\begin{aligned} u(x,t)= & {} \int _0^1G(x,\xi ,t)f(\xi )d\xi +\int _0^t\int _0^1u(\xi ,\tau )G(x,\xi ,t-\tau )d\xi d\tau \nonumber \\&+\int _0^t\int _0^1G(x,\xi ,t-\tau )dB(\xi ,\tau ), \end{aligned}$$
(25)

with representation of the Green’s function

$$\begin{aligned} G(x,\xi ,t)= 1+2\sum _{n=1}^\infty cos(n\pi x)cos(n\pi \xi )e^{(-n^2\pi ^2t)}, \end{aligned}$$
(26)

for \(f(x)=1,\)

$$\begin{aligned} \int _0^1G(x,\xi ,t)f(\xi )d\xi =1. \end{aligned}$$

Then

$$\begin{aligned} u(x,t)= 1+\int _0^t\int _0^1u(\xi ,\tau )G(x,\xi ,t-\tau )d\xi d\tau +\int _0^t\int _0^1G(x,\xi ,t-\tau )dB(\xi ,\tau ). \end{aligned}$$
(27)

At first, we consider homotopy perturbation method and for comparison with this method finite difference scheme are presented.

(a) Homotopy perturbation method We may choose a homotopy such that

$$\begin{aligned} u(x,t)\!-\! 1\!+\!p\left( \int _0^t\int _0^1u(\xi ,\tau )G(x,\xi ,t\!-\!\tau )d\!\xi \! d\tau \!+\!\int _0^t\int _0^1G(x,\xi ,t\!-\!\tau )dB(\xi ,\tau )\right) \!=\!0,\nonumber \\ \end{aligned}$$
(28)

According to last section we get

$$\begin{aligned} f_0(x,t)= & {} 1,\\ f_1(x,t)= & {} \int _0^t\int _0^1G(x,\xi ,t-\tau )dB(\xi ,\tau ). \end{aligned}$$

As a result

$$\begin{aligned} p^0 : u_0(x,t)= & {} 1.\end{aligned}$$
(29)
$$\begin{aligned} p^1 : u_1(x,t)= & {} \int _0^t\int _0^1u_0(\xi ,\tau )G(x,\xi ,t-\tau )d\xi d\tau +\int _0^t\int _0^1G(x,\xi ,t-\tau )dB(\xi ,\tau ) \nonumber \\= & {} \int _0^t\int _0^1G(x,\xi ,t-\tau )d\xi d\tau + \int _0^t\int _0^1G(x,\xi ,t-\tau )dB(\xi ,\tau ) \nonumber \\= & {} t+\int _0^t\int _0^1G(x,\xi ,t-\tau )dB(\xi ,\tau )\end{aligned}$$
(30)
$$\begin{aligned}= & {} t+B(1,t)+2\sum _{n=1}^\infty cos(n\pi x) e^{(-n^2\pi ^2t)} \int _0^t\int _0^1 cos(n\pi \xi )e^{(n^2\pi ^2\tau )} dB(\xi ,\tau )\nonumber \\= & {} t+B(1,t)+2\sum _{n=1}^\infty cos(n\pi x) e^{(-n^2\pi ^2t)}\alpha (n,t), \end{aligned}$$
(31)

where,

$$\begin{aligned} \alpha (n,\tau ):=\int _0^\tau \int _0^1 cos(n\pi \lambda )e^{(-n^2\pi ^2(-\varsigma ))} dB(\lambda ,\varsigma ), \end{aligned}$$

by using (28) and (21)

$$\begin{aligned} p^2 : u_2(x,t)= & {} \int _0^t\int _0^1\left( \int _0^\tau \int _0^1G(\xi ,\lambda ,\tau -\varsigma )dB(\lambda ,\varsigma )+\tau \right) G(x,\xi ,t-\tau )d\xi d\tau \nonumber \\= & {} \frac{t^2}{2}+\int _0^t\int _0^1\left( \int _0^\tau \int _0^1G(\xi ,\lambda ,\tau -\varsigma )dB(\lambda ,\varsigma )\right) G(x,\xi ,t-\tau )d\xi d\tau \nonumber \\ \end{aligned}$$
(32)

with replacing \(G(x,\xi ,t)\)

$$\begin{aligned}&= \frac{t^2}{2}+\int _0^t\int _0^1\left( \int _0^\tau \int _0^11+2\sum _{n=1}^\infty cos(n\pi \xi ) cos(n\pi \lambda )e^{(-n^2\pi ^2(\tau -\varsigma ))} dB(\lambda ,\varsigma )\right) \nonumber \\&\qquad \times \left( 1+2\sum _{m=1}^\infty cos(m\pi x)cos(m\pi \xi )e^{(-m^2\pi ^2(t-\tau ))}\right) d\xi d\tau \\&= \!\frac{t^2}{2}\!+\!\int _0^tB(1,\tau )d\tau \!+\!\int _0^t\int _0^1 \left( \int _0^\tau \int _0^12\sum _{n=1}^\infty cos(n\pi \xi )cos(n\pi \lambda )e^{(-n^2\pi ^2(\tau -\varsigma ))} dB(\lambda ,\varsigma )\!\right) \nonumber \\&\qquad \times \left( 1+2\sum _{m=1}^\infty cos(m\pi x)cos(m\pi \xi )e^{(-m^2\pi ^2(t-\tau ))}\right) d\xi d\tau \\&\quad =\frac{t^2}{2}+\int _0^tB(1,\tau )d\tau +\int _0^t\int _0^1 \left( 2\sum _{n=1}^\infty cos(n\pi \xi )e^{(-n^2\pi ^2\tau )}\right. \nonumber \\&\qquad \times \left. \int _0^\tau \int _0^1 cos(n\pi \lambda )e^{(-n^2\pi ^2(-\varsigma ))} dB(\lambda ,\varsigma )\right) \nonumber \\&\qquad \times \left( 1+2\sum _{m=1}^\infty cos(m\pi x)cos(m\pi \xi )e^{(-m^2\pi ^2(t-\tau ))}\right) d\xi d\tau \\&\quad =\frac{t^2}{2}+\int _0^tB(1,\tau )d\tau +\int _0^t\int _0^1 \left( 2\sum _{n=1}^\infty cos(n\pi \xi )e^{(-n^2\pi ^2\tau )}\right. \nonumber \\&\qquad \times \left. \int _0^\tau \int _0^1 cos(n\pi \lambda ) e^{(-n^2\pi ^2(-\varsigma ))} dB(\lambda ,\varsigma )\right) \nonumber \\&\qquad \times \left( 2\sum _{m=1}^\infty cos(m\pi x)cos(m\pi \xi )e^{(-m^2\pi ^2(t-\tau ))}\right) d\xi d\tau \\&\quad =\frac{t^2}{2}+\int _0^tB(1,\tau )d\tau +\int _0^t\int _0^1 \left( 2\sum _{n=1}^\infty cos(n\pi \xi )e^{(-n^2\pi ^2\tau )}\alpha (n,\tau )\right) \nonumber \\&\qquad \times \left( 2\sum _{m=1}^\infty cos(m\pi x)cos(m\pi \xi )e^{(-m^2\pi ^2(t-\tau ))}\right) d\xi d\tau \\&\quad =\frac{t^2}{2}+\int _0^tB(1,\tau )d\tau +\int _0^t \left( 2\sum _{n=1}^\infty \alpha (n,\tau )cos(n\pi x)e^{(-n^2\pi ^2(t))}\right) d\tau \\&\quad =\frac{t^2}{2}+\int _0^tB(1,\tau )d\tau + 2\sum _{n=1}^\infty cos(n\pi x)e^{(-n^2\pi ^2(t))}\int _0^t\alpha (n,\tau )d\tau , \end{aligned}$$

continuing this procedure

$$\begin{aligned} p^3 : u_3(x,t)= & {} \int _0^t\int _0^1 \left( \frac{\tau ^2}{2}+\int _0^\tau B(1,\varsigma )d\varsigma d\tau + 2\sum _{n=1}^\infty cos(n\pi \xi )e^{(-n^2\pi ^2(\tau ))}\right. \nonumber \\&\left. \times \int _0^\tau \alpha (n,\varsigma ) d\varsigma \right) G(x,\xi ,t-\tau )d\xi d\tau \nonumber \\= & {} \frac{t^3}{3!}+\int _0^t\int _0^\tau B(1,\varsigma )d\varsigma d\tau + \sum _{n=1}^\infty cos(n\pi x)e^{(-n^2\pi ^2(t))}\nonumber \\&\times \int _0^t\int _0^\tau \alpha (n,\varsigma ) d\varsigma d\tau ,\nonumber \\= & {} \frac{t^3}{3!}+\int _0^t (t-\varsigma ) B(1,\varsigma )d\varsigma + \sum _{n=1}^\infty cos(n\pi x)e^{(-n^2\pi ^2(t))}\nonumber \\&\times \int _0^t (t-\varsigma ) \alpha (n,\varsigma ) d\varsigma . \end{aligned}$$
(33)

Therefore, the approximate solution of Example 1. can be readily obtained by

$$\begin{aligned} u(x,t)= & {} u_0(x,t)+u_1(x,t)+\cdots \nonumber \\= & {} 1+t+\frac{t^2}{2}+\frac{t^3 }{3!}+\frac{t^4}{4!}+\cdots +B(1,t)+\int _0^tB(1,\varsigma )d\varsigma \nonumber \\&+\int _0^t(t-\varsigma ) B(1,\varsigma )d\varsigma +\cdots +\sum _{n=1}^\infty cos(n\pi x)e^{(-n^2\pi ^2t)}\alpha (n,t)\nonumber \\&+\, 2\sum _{n=1}^\infty cos(n\pi x)e^{(-n^2\pi ^2(t))}\int _0^t\alpha (n,\tau )d\tau +\cdots , \end{aligned}$$
(34)

in practice, all terms of series (34) cannot be determined and so we use an approximation of the solution by the following truncated series:

$$\begin{aligned} u_N(x,t)=\sum _{i=0}^{N-1}u_i(x,t), \end{aligned}$$

then absolute error which is defined by

$$\begin{aligned} e_N(x,t)=|u_N(x,t)-u(x,t)|. \end{aligned}$$

We approximate this equation and numerical results with \(N=5\) are shown in Fig. 1.

Fig. 1
figure 1

The approximate solution for \(N=5\), of Example 2 by homotopy method

Fig. 2
figure 2

The approximate solution of Example 2 by Crank–Nicolson schemes

(b) Finite difference method Partial differential equations are solved by numerous methods. A popular methods amongst them are finite difference methods.

Basically, these schemes discretize the continuous space and time into an evenly distributed grid system, and the values of the state variables are evaluated at each node of the grid.

Let \(h=\Delta x,k=\Delta t.\) we approximate derivative by

$$\begin{aligned} \frac{\partial u}{\partial t}u(x_i,t_j)= & {} \frac{u(x_i,t_j)-u(x_i,t_{j-1})}{ h}+O(h),\nonumber \\ \frac{\partial u}{\partial x}u(x_i,t_j)= & {} \frac{u(x_{i+1},t_j)-u(x_{i-1},t_{j})}{ 2k}+O(k^2),\nonumber \\ \frac{\partial ^2 u}{\partial x^2}u(x_i,t_j)= & {} \frac{u(x_{i+1},t_j)-2u(x_i,t_j)+u(x_{i-1},t_{j})}{ k^2}+O(k^2). \end{aligned}$$
(35)

First, continuous space–time white noise is calculated

$$\begin{aligned} B(i, j) := B(i, j-1)+B(i-1, j)-B(i-1, j-1)+dB(i, j). \end{aligned}$$

By substituting the discrete approximations to the continuous derivatives in equation (3) we obtain

$$\begin{aligned} \frac{u_{ij+1}-u_{ij}}{h}= & {} \theta \left( \frac{u_{i-1j}-2u_{ij}+u_{i+1,j}}{k^2}+F(u_{ij})\right) \nonumber \\&+\,(1-\theta )\left( \frac{u_{i-1j+1}-2u_{ij+1}+u_{i+1j+1}}{k^2}+F(u_{ij+1})\right) +dB(ih,jk), \end{aligned}$$

for \(i = 1, 2,..., N-1\) and \(j = 0, 1,..., l-1\), and \(\theta \in [0, 1]\). The classical fully implicit, fully explicit and Crank–Nicolson schemes are special cases of the \( \theta \)-method and can be obtained by letting \(\theta = 1\), \(\theta = -1\), and \(\theta = 1/2\) respectively.

The boundary condition at \(x=0\), and \(x=1\) in terms of central difference, gives at \(x=0\)

$$\begin{aligned} u_{0j+1}= & {} u_{0j}+\theta [2r(u_{1j}-u_{0j})+hF(u_{0j})]+(1-\theta )[2r(u_{1j+1}-u_{0j+1})\nonumber \\&+\,hF(u_{0j+1})]+hdB(0,jk). \end{aligned}$$

Also, for \(x=1\)

$$\begin{aligned} u_{Nj+1}= & {} u_{Nj}+\theta [2r(u_{N-1j}-u_{Nj})+hF(u_{Nj})]\nonumber \\&+\,(1-\theta )[2r(u_{N-1j+1}-u_{Nj+1})+hF(u_{Nj+1})]+hdB(lh,jk). \end{aligned}$$

where \(r=h/k^2\). The numerical results for Crank–Nicolson scheme are shown in Fig. 2.

Conclusion

In this paper, homotopy perturbation method was applied to solve a model for a stochastic polymer. The presented method was used to find numerical solutions of two examples, a simple example with exact solution and another example, a model for random string. The homotopy method needs much less computational work compared with traditional methods. It is shown that homotopy is a very fast convergent, precise and cost efficient tool for solving stochastic integral equations in the bounded domains.