Introduction

The variational iteration method (VIM) is one of the powerful mathematical tools to solve various kinds of linear and nonlinear problems which was proposed by He [1,2,3]. Besides these, variational iteration method and its modifications are also used in many areas of mathematics and science as seen [4,5,6,7] and many others. In recent times, Fatoorehchi et al. [8] have performed the differential transform method (DTM) to obtain Laplace transform of functions. Also, the applications of homotopy perturbation (HPM) and adomian decomposition (ADM) methods for calculating Laplace transform are seen in the literature [9, 10], respectively.

In that respect, we aim to give a new calculation of Laplace and Sumudu transforms using the VIM which will be the first time in the literature. Therefore, we take into account the two elementary first-order linear ODEs as follow

$$\begin{aligned} \theta (t)^{\prime }=\,& {} p\theta (t)+Q(t) \nonumber \\ \theta (0)=\,& {} 0 \end{aligned}$$
(1)

and

$$\begin{aligned} f(t)^{\prime }=\,& {} \frac{1}{r}f(t)+\frac{1}{r}Q(t) \nonumber \\ f(0)= & {} 0 \end{aligned}$$
(2)

where p and r are positive constants. We can easily obtain the analytical solutions of (1) and (2) as below

$$\begin{aligned} \theta (t){\mathrm{e}}^{-pt}=\int \left( Q(t){\mathrm{e}}^{-pt} \right) {\hbox {d}}t \end{aligned}$$
(3)

and

$$\begin{aligned} f(t){\mathrm{e}}^{-\frac{t}{r}}=\frac{1}{r}\int \left( Q(t){\mathrm{e}}^{-\frac{t}{r}} \right) {\hbox {d}}t \end{aligned}$$
(4)

It is pointed out that if the right-hand side of Eqs. (3) and (4) is considered as definite integration from zero to infinity, then we obtain the Laplace and Sumudu transforms of the functions Q(t) from right-hand side of the equations as

$$\begin{aligned} G(p)=\,& {} L[Q(t)]=\int _{0}^{\infty } \left( Q(t){\mathrm{e}}^{-pt} \right) {\hbox {d}}t=\left[ \theta (t){\mathrm{e}}^{-pt} \right] _{t=0}^{t=\infty } \end{aligned}$$
(5)
$$\begin{aligned} H(r)=\,& {} S[Q(t)]=\int _{0}^{\infty } \left( Q(rt){\mathrm{e}}^{-t} \right) {\hbox {d}}t \nonumber \\= & {} \frac{1}{r}\int _{0}^{\infty } \left( Q(t){\mathrm{e}}^{-\frac{t}{r}} \right) {\hbox {d}}t=\left[ f(t){\mathrm{e}}^{-\frac{t}{r}} \right] _{t=0}^{t=\infty } \end{aligned}$$
(6)

where G(p) and H(r) are the Laplace and Sumudu transform of Q(t) functions, respectively. Also, L and S denote the Laplace and Sumudu operator.

Implementation of VIM to solve (1) and (2)

In order to make a basic definition of the VIM, we consider the following general nonlinear problem

$$\begin{aligned} V[u(t)]+N[u(t)]=g(t) \end{aligned}$$
(7)

where V is a linear operator, N is a nonlinear operator and g is a given continuous function. According to the original VIM, we construct the correction functional as [1,2,3]

$$\begin{aligned} u_{m+1}(t)=u_{m}(t)+\int _{0}^{t} \lambda (\tau )\left[ V(u_{m}(\tau ))+N(\tilde{u}_{m}(\tau ))-g(\tau )\right] {\hbox {d}}\tau , \quad m\ge 0 \end{aligned}$$
(8)

Here \(\lambda\) is a Lagrange multiplier obtained by the variational theory [1,2,3], \(\tilde{u}_{m}\) is considered as a restricted variation [1,2,3], i.e. \(\delta \tilde{u}_{m}=0\). Firstly, we determine the Lagrange multiplier which can be identified optimally via the variational theory [1,2,3]. Then, successive iterations \(u_{m}(t), m\ge 0\) are obtained by using Lagrange multiplier and initial approximate function \(u_{0}\) that satisfies, at least, the initial and boundary conditions with possible unknowns. Consequently, the exact solution of (7) can be obtained by the following formula

$$\begin{aligned} u(t)=\lim _{m\rightarrow \infty } u_{m}(t) \end{aligned}$$
(9)

Now, we perform the VIM to solve (1) and (2). By considering the initial conditions, we can write \(\theta _{0}(t)=0\) and \(f_{0}(t)=0\). If we apply the VIM procedure (7), (8) to (1) and (2), then Lagrange multipliers \(\lambda _{\theta }(\tau )\) and \(\lambda _{f}(\tau )\) are obtained as below

$$\begin{aligned} \lambda _{\theta }(\tau )=-{\mathrm{e}}^{p(t-\tau )}, \quad \lambda _{f}(\tau )=-{\mathrm{e}}^{\frac{1}{r}(t-\tau )} \end{aligned}$$
(10)

Therefore, considering (8), (9) and (10), we obtain the iteration formula for the VIM solutions of (1) and (2) as follow, respectively,

$$\begin{aligned}&\theta _{m+1}(t)=\theta _{m}(t)-\int _{0}^{t} \left( {\mathrm{e}}^{p(t-\tau )} \left[ \theta _{m}^{\prime }(\tau )-p\theta _{m}(\tau )-Q(\tau )\right] \right) {\hbox {d}}\tau \end{aligned}$$
(11)
$$\begin{aligned}&f_{m+1}(t)=f_{m}(t)-\int _{0}^{t} \left( {\mathrm{e}}^{\frac{1}{r}(t-\tau )} \left[ f_{m}^{\prime }(\tau )-\frac{1}{r}f_{m}(\tau )-\frac{1}{r}Q(\tau )\right] \right) {\hbox {d}}\tau \end{aligned}$$
(12)

Here \(m\ge 0\). By substituting the first iteration of (11) and (12) to right-hand side of (5) and (6), we obtain the Laplace and Sumudu transform of Q(t) functions by means of the VIM. Namely,

$$\begin{aligned}&L[Q(t)]=G(p)=\left[ {\mathrm{e}}^{-pt}\theta _{1}(t) \right] _{t=0}^{t=\infty } \end{aligned}$$
(13)
$$\begin{aligned}&S[Q(t)]=H(r)=\left[ {\mathrm{e}}^{-\frac{t}{r}}f_{1}(t) \right] _{t=0}^{t=\infty } \end{aligned}$$
(14)

Computing the Laplace and Sumudu transforms via VIM

In this section, Laplace and Sumudu transforms of some of the frequently used functions, especially used in the applied sciences, are obtained to show the efficiency and accuracy of the proposed computational method.

For Laplace transform

Case 1 Let \(Q(t)=t^{n}, n\ge 0\). By considering (1), (5) and (13), it can be written as

$$\begin{aligned} L[t^{n}]=\left[ {\mathrm{e}}^{-pt}\theta _{1}(t) \right] _{t=0}^{t=\infty } \end{aligned}$$
(15)

where \(\theta _{1}(t)\) is obtained from (11) as

$$\begin{aligned} \theta _{1}(t)=\frac{{\mathrm{e}}^{pt}}{p^{n+1}}\left[ \varGamma (n+1)-\varGamma \left( n+1,pt\right) \right] \end{aligned}$$
(16)

where \(\varGamma (n)\), \(\varGamma (n,t)\) are the well-known gamma and incomplete gamma functions, respectively. Thus, we have the Laplace transform of \(Q(t)=t^{n}\) as

$$\begin{aligned} L[t^{n}]= & {} \left[ {\mathrm{e}}^{-pt}\left( \frac{{\mathrm{e}}^{pt}}{p^{n+1}}\left[ \varGamma (n+1)-\varGamma (n+1,pt)\right] \right) \right] _{t=0}^{t=\infty } \nonumber \\= & {} \frac{1}{p^{n+1}}[(n!-0)-(n!-n!)]=\frac{n!}{p^{n+1}} \end{aligned}$$
(17)

Case 2 Let \(Q(t)=\cosh (at), p>a\). From (11), we obtain \(\theta _{1}(t)\) as following

$$\begin{aligned} \theta _{1}(t)=\frac{p{\mathrm{e}}^{pt}}{p^{2}-a^{2}}-\frac{p({\mathrm{e}}^{at}+{\mathrm{e}}^{-at})}{2(p^{2}-a^{2})}-\frac{a({\mathrm{e}}^{at}-{\mathrm{e}}^{-at})}{2(p^{2}-a^{2})} \end{aligned}$$
(18)

Using the (1), (5), (13) and (18), we get the Laplace transform of \(Q(t)=\cosh (at)\)

$$\begin{aligned} L[\cosh (at)]= & {} \left\{ \frac{p}{p^{2}-a^{2}}-\frac{p({\mathrm{e}}^{(a-p)t}+{\mathrm{e}}^{-(a+p)t})}{2(p^{2}-a^{2})} \right. \nonumber \\&- \left. \frac{a({\mathrm{e}}^{(a-p)t}-{\mathrm{e}}^{-(a+p)t})}{2(p^{2}-a^{2})} \right\} _{t=0}^{t=\infty } \nonumber \\= & {} \frac{p}{p^{2}-a^{2}}-0-\frac{p}{p^{2}-a^{2}}+\frac{p}{p^{2}-a^{2}} \nonumber \\= & {} \frac{p}{p^{2}-a^{2}} \end{aligned}$$
(19)

Case 3 Let \(Q(t)={\mathrm{e}}^{at}, p>a\). We have the \(\theta _{1}(t)\) as

$$\begin{aligned} \theta _{1}(t)=\frac{{\mathrm{e}}^{pt}-{\mathrm{e}}^{at}}{p-a} \end{aligned}$$
(20)

By substituting (20) into the right-hand side of (13), the Laplace transform of \(Q(t)={\mathrm{e}}^{at}\) is obtained as

$$\begin{aligned} L[{\mathrm{e}}^{at}]= & {} \left\{ \frac{1-{\mathrm{e}}^{(a-p)t}}{p-a} \right\} _{t=0}^{t=\infty } \nonumber \\= & {} \frac{1-0}{p-a}-\frac{1-1}{p-a}=\frac{1}{p-a} \end{aligned}$$
(21)

Case 4 Let \(Q(t)=t\cos (at)\). From (11), we have the \(\theta _{1}(t)\) as

$$\begin{aligned} \theta _{1}(t)= & {} \frac{(p^{2}-a^{2}){\mathrm{e}}^{pt}}{(p^{2}+a^{2})^{2}} \nonumber \\&-\frac{[tp^{3}+tpa^{2}+p^{2}-a^{2}]\cos (at)}{(p^{2}+a^{2})^{2}} \nonumber \\&+\frac{[tap^{2}+ta^{3}+2ap]\sin (at)}{(p^{2}+a^{2})^{2}} \end{aligned}$$
(22)

and put (22) into right-hand side of (13), then we obtain the Laplace transform of \(Q(t)=t\cos (at)\) as following

$$\begin{aligned} L[t\cos (at)]=&\left\{ \frac{p^{2}-a^{2}}{(p^{2}+a^{2})^{2}}-\frac{[tp^{3}+tpa^{2}+p^{2}-a^{2}]\cos (at)}{{\mathrm{e}}^{pt}(p^{2}+a^{2})^{2}} \right. \nonumber \\&+ \left. \frac{[tap^{2}+ta^{3}+2ap]\sin (at)}{{\mathrm{e}}^{pt}(p^{2}+a^{2})^{2}} \right\} _{t=0}^{t=\infty } \nonumber \\ =&\frac{p^{2}-a^{2}}{(p^{2}+a^{2})^{2}}-0+0-0-\left( \frac{p^{2}-a^{2}}{(p^{2}+a^{2})^{2}}-\frac{p^{2}-a^{2}}{(p^{2}+a^{2})^{2}} \right) \nonumber \\ =&\frac{p^{2}-a^{2}}{(p^{2}+a^{2})^{2}} \end{aligned}$$
(23)

Case 5 Let \(Q(t)=erf(t)\). By considering (1), (5), (11) and (13), we can easily obtain

$$\begin{aligned} \theta _{1}(t)=-\frac{{\mathrm{e}}^{pt+\frac{p^{2}}{4}}erf(\frac{p}{2})+erf(t)}{p}+\frac{{\mathrm{e}}^{pt+\frac{p^{2}}{4}}erf(t+\frac{p}{2})}{p} \end{aligned}$$
(24)

and

$$\begin{aligned} L[erf(t)]= & {} \left\{ -\frac{{\mathrm{e}}^{\frac{p^{2}}{4}}erf(\frac{p}{2})+{\mathrm{e}}^{-pt}erf(t)}{p}+\frac{{\mathrm{e}}^{\frac{p^{2}}{4}}erf(t+\frac{p}{2})}{p} \right\} _{t=0}^{t=\infty } \nonumber \\= & {} \frac{-{\mathrm{e}}^{\frac{p^{2}}{4}}erf(\frac{p}{2})-0+{\mathrm{e}}^{\frac{p^{2}}{4}}}{p}+\frac{{\mathrm{e}}^{\frac{p^{2}}{4}}erf(\frac{p}{2})+0-{\mathrm{e}}^{\frac{p^{2}}{4}}erf(\frac{p}{2})}{p} \nonumber \\= & {} \frac{{\mathrm{e}}^{\frac{p^{2}}{4}}\left( 1-erf(\frac{p}{2}) \right) }{p}=\frac{{\mathrm{e}}^{\frac{p^{2}}{4}}erfc(\frac{p}{2})}{p} \end{aligned}$$
(25)

Here erf(t) and erfc(t) are well-known error and complementary error functions, respectively.

Case 6 Let \(Q(t)=\ln (t)\). Once again using the (11), we obtain \(\theta _{1}(t)\) as

$$\begin{aligned} \theta _{1}(t)=-\frac{\ln (t)+{\mathrm{e}}^{pt}E_{1}(pt)}{p}-\frac{{\mathrm{e}}^{pt}\gamma +{\mathrm{e}}^{pt}\ln (p)}{p} \end{aligned}$$
(26)

where \(\gamma =0.5772156649\ldots\) is the Eulers constant and \(E_{1}(t)\) is a well-known exponential integral defined as

$$\begin{aligned} E_{1}(t)=\int _{t}^{\infty }\frac{{\mathrm{e}}^{-v}}{v}{\hbox {d}}v \end{aligned}$$
(27)

If the same process is applied as in before, we get

$$\begin{aligned} L[\ln (t)]= & {} \left\{ \frac{-{\mathrm{e}}^{-pt}\ln (t)-E_{1}(pt)}{p}-\frac{\gamma +\ln (p)}{p} \right\} _{t=0}^{t=\infty } \nonumber \\= & {} \frac{-0-0-\gamma -\ln (p)}{p}+\frac{\ln (t)-\gamma -\ln (pt)+\gamma +\ln (p)}{p} \nonumber \\= & {} \frac{-\gamma -\ln (p)}{p} \end{aligned}$$
(28)

For Sumudu transform

Case 1 Let \(Q(t)=t^{n}, n\ge 0\). By using (2), (6) and (14), it can be written as

$$\begin{aligned} S[t^{n}]=\left[ {\mathrm{e}}^{-\frac{t}{r}}f_{1}(t) \right] _{t=0}^{t=\infty } \end{aligned}$$
(29)

where \(f_{1}(t)\) is obtained from (12) as

$$\begin{aligned} f_{1}(t)=t^{n}{\mathrm{e}}^{\frac{t}{r}}\left( \frac{t}{r}\right) ^{-n}\left[ \varGamma (n+1)-\varGamma \left(n+1,\frac{t}{r}\right)\right] \end{aligned}$$
(30)

where \(\varGamma (n)\), \(\varGamma (n,t)\) are the well-known gamma and incomplete gamma functions, respectively. Thus, we have the Sumudu transform of \(Q(t)=t^{n}\) as

$$\begin{aligned} S[t^{n}]=\,& {} \left( r^{n} \left[ \varGamma \left(n+1)-\varGamma (n+1,\frac{t}{r}\right)\right] \right) _{t=0}^{t=\infty } \nonumber \\= \,& {} r^{n}[(n!-0)-(n!-n!)]=r^{n}n! \end{aligned}$$
(31)

Case 2 Let \(Q(t)=\frac{\sinh (at)}{a}, 1>\vert ar \vert\). From (12), we obtain \(f_{1}(t)\) as following

$$\begin{aligned} f_{1}(t)=-\frac{{\mathrm{e}}^{at}\left( 2ar{\mathrm{e}}^{(a+\frac{1}{r})t}-ar+1-ar{\mathrm{e}}^{2at}-{\mathrm{e}}^{2at} \right) }{2a(a^{2}r^{2}-1)} \end{aligned}$$
(32)

Considering the (2), (6), (14) and (32), we get the Sumudu transform of \(Q(t)=\frac{\sinh (at)}{a}\)

$$\begin{aligned} S\left[ \frac{\sinh (at)}{a}\right]= & {} \left\{ -\frac{r}{a^{2}r^{2}-1}+\frac{r{\mathrm{e}}^{-(a+\frac{1}{r})t}}{2(a^{2}r^{2}-1)}-\frac{{\mathrm{e}}^{-(a+\frac{1}{r})t}}{2a(a^{2}r^{2}-1)} \right. \nonumber \\&\left. +\frac{r{\mathrm{e}}^{(a-\frac{1}{r})t}}{2(a^{2}r^{2}-1)}+\frac{{\mathrm{e}}^{(a-\frac{1}{r})t}}{2a(a^{2}r^{2}-1)} \right\} _{t=0}^{t=\infty } \nonumber \\=\,& {} \frac{r}{1-r^{2}a^{2}}-\left\{ \frac{r}{1-r^{2}a^{2}}-\frac{r}{2(1-r^{2}a^{2})}+\frac{1}{2a(1-r^{2}a^{2})} \right. \nonumber \\&\left. -\frac{r}{2(1-r^{2}a^{2})}-\frac{1}{2a(1-r^{2}a^{2})} \right\} =\frac{r}{1-r^{2}a^{2}} \end{aligned}$$
(33)

Case 3 Let \(Q(t)={\mathrm{e}}^{at}, \frac{1}{r}>a\). We have the \(f_{1}(t)\) as

$$\begin{aligned} f_{1}(t)=\frac{{\mathrm{e}}^{\frac{t}{r}}-{\mathrm{e}}^{at}}{1-ar} \end{aligned}$$
(34)

By substituting (34) into the right-hand side of (14), the Sumudu transform of \(Q(t)={\mathrm{e}}^{at}\) is obtained as

$$\begin{aligned} S[{\mathrm{e}}^{at}]= & {} \left\{ \frac{1-{\mathrm{e}}^{(a-\frac{1}{r})t}}{1-ar} \right\} _{t=0}^{t=\infty } \nonumber \\= & {} \frac{1-0}{1-ar}-\frac{1-1}{1-ar}=\frac{1}{1-ar} \end{aligned}$$
(35)

Case 4 Let \(Q(t)=t\cos (at)\). From (12), we have the \(f_{1}(t)\) as

$$\begin{aligned} f_{1}(t)=&\frac{(r-a^{2}r^{3}){\mathrm{e}}^{\frac{t}{r}}}{(r^{2}a^{2}+1)^{2}} -\frac{[t+a^{2}r^{2}t-r^{3}a^{2}+r]\cos (at)}{(r^{2}a^{2}+1)^{2}} -\frac{[art+ta^{3}r^{3}+2ar^{2}]\sin (at)}{(r^{2}a^{2}+1)^{2}} \end{aligned}$$
(36)

and put (36) into right-hand side of (14), then we obtain the Sumudu transform of \(Q(t)=t\cos (at)\) as following

$$\begin{aligned} S[t\cos (at)]= & {} \left\{ \frac{r-a^{2}r^{3}}{(r^{2}a^{2}+1)^{2}}-\frac{[t+a^{2}r^{2}t-a^{2}r^{3}+r]\cos (at)}{{\mathrm{e}}^{\frac{t}{r}}(r^{2}a^{2}+1)^{2}} \right. \nonumber \\&\left. -\frac{[2ar^{2}+a^{3}r^{3}t+art]\sin (at)}{{\mathrm{e}}^{\frac{t}{r}}(r^{2}a^{2}+1)^{2}} \right\} _{t=0}^{t=\infty } \nonumber \\= & {} \frac{r-a^{2}r^{3}}{(r^{2}a^{2}+1)^{2}}-0-0-\left( \frac{r-a^{2}r^{3}}{(r^{2}a^{2}+1)^{2}}-\frac{r-a^{2}r^{3}}{(r^{2}a^{2}+1)^{2}} \right) -0 \nonumber \\= & {} \frac{r-a^{2}r^{3}}{(r^{2}a^{2}+1)^{2}} \end{aligned}$$
(37)

Case 5 Let \(Q(t)=erf(t)\). By applying (2), (6), (12) and (14), we can easily write

$$\begin{aligned} f_{1}(t)={\mathrm{e}}^{\frac{t}{r}+\frac{1}{4r^{2}}} \left[ erf\left( t+\frac{1}{2r}\right) -erf \left( \frac{1}{2r}\right) \right] -erf(t) \end{aligned}$$
(38)

Here erf(t) is a well-known error function. Thus, we obtain the Sumudu transform of erf(t) as

$$\begin{aligned} S[erf(t)]=\,& {} \left\{ {\mathrm{e}}^{\frac{1}{4r^{2}}} \left[ erf\left( t+\frac{1}{2r}\right) -erf\left( \frac{1}{2r}\right) \right] -\frac{erf(t)}{{\mathrm{e}}^{\frac{t}{r}}} \right\} _{t=0}^{t=\infty } \nonumber \\=\,& {} {\mathrm{e}}^{\frac{1}{4r^{2}}} \left[ 1-erf\left( \frac{1}{2r}\right) \right] -0-\left[ {\mathrm{e}}^{\frac{1}{4r^{2}}}\left( erf\left( \frac{1}{2r}\right) -erf\left( \frac{1}{2r}\right) \right) \right] \nonumber \\=\, & {} {\mathrm{e}}^{\frac{1}{4r^{2}}} \left[ 1-erf\left( \frac{1}{2r}\right) \right] ={\mathrm{e}}^{\frac{1}{4r^{2}}}erfc\left( \frac{1}{2r}\right) \end{aligned}$$
(39)

where erfc(t) is complementary error function.

Case 6 Let \(Q(t)=\ln (t)\). Once again using the (12), we obtain \(f_{1}(t)\) as

$$\begin{aligned} f_{1}(t)=-\ln (t) -{\mathrm{e}}^{\frac{t}{r}}E_{1} \left( \frac{t}{r}\right) -{\mathrm{e}}^{\frac{t}{r}}\gamma -{\mathrm{e}}^{\frac{t}{r}} \ln \left( \frac{1}{r}\right) \end{aligned}$$
(40)

where \(\gamma =0.5772156649...\) is the Eulers constant and \(E_{1}(t)\) is a well-known exponential integral defined as in (27). If the same process is applied as in before, we obtain

$$\begin{aligned} S[\ln (t)]= & {} \left\{ -{\mathrm{e}}^{-\frac{t}{r}}\ln (t)-E_{1}\left( \frac{t}{r}\right) -\gamma - \ln \left( \frac{1}{r}\right) \right\} _{t=0}^{t=\infty } \nonumber \\= & {} -0-0-\gamma -\ln \left( \frac{1}{r}\right) +\ln (t)-\gamma -\ln \left( \frac{t}{r}\right) +\gamma +\ln \left( \frac{1}{r}\right) \nonumber \\= & {} -\gamma +\ln (r) \end{aligned}$$
(41)

which is the Sumudu transform of \(\ln (t)\).

Conclusion

We applied the variational iteration method for computing of the Laplace and Sumudu transforms of functions by using a different way. Results clearly show that unlike the literature and also classical computation, our presented method provides a powerful and easy calculation and also does not require too long operations. It is obviously indicated that the Laplace and Sumudu transforms of many functions, which are not mentioned here, can be computed by the VIM easily.