1 Introduction

Universe inflation may be justified by the modification of general relativity (F(R)-gravity) [1,2,3], insertion of the cosmological constant \(\Lambda \) in Einstein–Hilbert action, or the introduction of a scalar field (quintessence) [4]. Another way to explain universe acceleration is to use the source of Einstein’s gravity in the form of nonlinear electrodynamics (NED). NED was proposed by Born and Infeld [5] to smooth a singularity of point-like charges and to obtain finite self-energy. It is worth noting that at strong electromagnetic fields, classical Maxwell electrodynamics become NED due to quantum corrections [6,7,8]. Thus, we imply that in the early universe, electromagnetic fields were very strong, and linear Maxwell electrodynamics should be replaced by NED. Inflation can be described by Einstein’s gravity coupled to some NED [9,10,11,12,13,14,15,16,17,18,19,20]. Here we explore NED with two parameters [21], which include rational NED [16, 18] for some parameter, and for weak fields it becomes Maxwell’s electrodynamics. We show that in the framework of our model, inflation of the universe takes place for the stochastic magnetic background field.

It was shown that the stochastic fluctuations of the electromagnetic field are present in a relativistic electron-positron plasma, and therefore, plasma fluctuations can generate a stochastic magnetic field [22, 23]. Thermal fluctuations in the pre-recombination plasma could be the source of a primordial magnetic field, and magnetic fluctuations may have been sustained by plasma before the epoch of Big Bang nucleosynthesis. There likely were strong low-frequency random magnetic fields in the early stage of the radiation-dominated era. In our galaxy and other spiral galaxies, magnetic fields of the order of \(B = 10^{-6}\) G are present on scales of several kiloparsecs [24]. The fields \(B = 10^{-6}\) G may have a primordial origin and are explained with the help of galactic dynamo theory. This theory explains a mechanism transferring angular momentum energy into magnetic energy and requires the existence of weak seed fields of the order of \(B= 10^{-19}\) G at the epoch of galaxy formation. The source of seed magnetic fields could be thermal fluctuations in the primordial plasma. Magnetic energy over larger scales can be attributed to long-wavelength fluctuations which reconnect and redistribute magnetic fields [25]. As the electric field is screened by the charged primordial plasma, we consider the background magnetic field [23]. We assume that directional effects are not present (\(\langle {\textbf {B}}\rangle = 0\)), according to the standard cosmological model.

In section 2, we consider Einstein’s gravity coupled to NED with dimensional parameter \(\beta \) and dimensionless parameter \(\gamma \). The source of gravity is a stochastic magnetic field. We obtain the range of magnetic fields when an acceleration of the universe occurs. We show that singularities of the energy density and pressure are absent at \(\gamma \ge 1\). We demonstrate that when the scale factor approaches infinity, one obtains the equation of state (EoS) for the ultra-relativistic case. Singularities of curvature invariants are absent for \(\gamma \ge 1\). The evolution of the universe is investigated in section 3. We find the dependence of the scale factor on time and show that when time goes to infinity, the radiation era occurs. In subsection 3.1, the deceleration parameter as a function of the scale factor is computed, showing the evolution of the universe. We analyse the amount of the inflation by calculating e-folds N. For some parameters, a reasonable e-fold \(N\approx 70\) is realised. We find the duration of the universe inflation depending on the parameters beta and gamma. In subsection 3.2, the causality and unitarity principles are studied by computing the speed of sound. In section 4, the cosmological parameters, spectral index \(n_s\), tensor-to-scalar ratio r, and running of the spectral index \(\alpha _s\) are evaluated. We show that they are in approximate agreement with the Planck and Wilkinson Microwave Anisotropy Probe (WMAP) data. Section 5 provides a summary.

Units with \(c=\hbar =1\) are used, and the metric signature is \(\eta =\text{ diag }(-,+,+,+)\).

2 Cosmology with a stochastic magnetic field background

The Einstein–Hilbert action coupled to the matter source is given by

$$\begin{aligned} S=\int d^4x\sqrt{-g}\left[ \frac{1}{2\kappa ^2}R+ {{\mathcal {L}}}\right] , \end{aligned}$$
(1)

where R is the Ricci scalar, \(\kappa ^2=8\pi G\), and G is Newton’s constant with the dimension \([L^2]\). We consider the source of the gravitational field in the form of NED with the Lagrangian [21]

$$\begin{aligned} {{\mathcal {L}}}=-\frac{{{\mathcal {F}}}}{1+\epsilon (2\epsilon \beta {{\mathcal {F}}})^\gamma }. \end{aligned}$$
(2)

Here, \({{\mathcal {F}}}=F^{\mu \nu }F_{\mu \nu }/4=(B^2-E^2)/2\) is the field invariant, and E and B are the electric and magnetic fields, respectively. We introduce the parameter \(\epsilon =\pm 1\), dimensional parameter \(\beta >0\) with dimension \([L^4]\), and dimensionless parameter \(\gamma >0\). If \(B>E\), one uses \(\epsilon =1\), and for \(B<E\) we should set \(\epsilon =-1\) to obtain the real Lagrangian. It is worth noting that as \(\beta {{\mathcal {F}}}\rightarrow 0\), Lagrangian (2) approaches Maxwell’s Lagrangian. It was shown in Ref. [26] that there are no singularities in the electric field of point-like charges and electric self-energy in the model with the Lagrangian (2) for \(\epsilon =-1\). Here, we consider the inflation of the universe filled with stochastic magnetic fields (\(\epsilon = 1\)). After varying action (1), one obtains the Einstein and electromagnetic field equations

$$\begin{aligned} R_{\mu \nu }-\frac{1}{2}g_{\mu \nu }R=\kappa ^2T_{\mu \nu }, \end{aligned}$$
(3)
$$\begin{aligned} \nabla _\mu ({{\mathcal {L}}}_{{\mathcal {F}}}F^{\mu \nu })=0, \end{aligned}$$
(4)

where

$$\begin{aligned} {{\mathcal {L}}}_{{\mathcal {F}}}=\frac{\partial {{\mathcal {L}}}}{\partial \mathcal{F}}=-\frac{1-\epsilon (\gamma -1)(2\epsilon \beta \mathcal{F})^\gamma }{(1+\epsilon (2\epsilon \beta {{\mathcal {F}}})^\gamma )^2}, \end{aligned}$$
(5)

and the stress–energy tensor is given by

$$\begin{aligned} T_{\mu \nu }=-F_{\mu \rho }F_{\nu }^{~\rho }\mathcal {L}_{\mathcal {F}}-g_{\mu \nu }\mathcal {L}\left( \mathcal {F}\right) . \end{aligned}$$
(6)

We use the line element of homogeneous and isotropic cosmological spacetime as follows:

$$\begin{aligned} ds^2=-dt^2+a(t)^2\left( dx^2+dy^2+dz^2\right) , \end{aligned}$$
(7)

with a scale factor a(t). Let us consider the cosmic background in the form of stochastic magnetic fields. As the electric field is zero, we use \(\epsilon =1\). We obtain the isotropy of the Friedman–Robertson–Walker spacetime after averaging the magnetic fields [27]. It is implied that the wavelength of electromagnetic waves is smaller than the curvature. Therefore, one should impose equations as follows:

$$\begin{aligned} \langle {\textbf {B}}\rangle =0,~~~~\langle B_iB_j\rangle =\frac{1}{3}B^2g_{ij}, \end{aligned}$$
(8)

with the brackets denoting an average over a volume. For simplicity we will omit the brackets in the following. Note that the NED stress–energy tensor can be represented in the form of a perfect fluid [13]. The Friedmann equation for a three-dimensional flat universe is

$$\begin{aligned} 3\frac{\ddot{a}}{a}=-\frac{\kappa ^2}{2}\left( \rho +3p\right) , \end{aligned}$$
(9)

where \(\ddot{a}=\partial ^2a/dt^2\). When \(\rho + 3p < 0\), acceleration of the universe takes place. Using Eq. (6) we obtain

$$\begin{aligned} \rho= & {} -{{\mathcal {L}}}=\frac{B^2}{2[1+(\beta B^2)^\gamma ]}, \nonumber \\ p= & {} {{\mathcal {L}}}-\frac{2B^2}{3}{{\mathcal {L}}}_{{\mathcal {F}}}=\frac{B^2[1+(1-4\gamma )(\beta B^2)^\gamma ]}{6[1+(\beta B^2)^\gamma ]^2}. \end{aligned}$$
(10)

By virtue of Eq. (10), one finds

$$\begin{aligned} \rho +3p=\frac{B^2[1+(1-2\gamma )(\beta B^2)^\gamma ]}{[1+(\beta B^2)^\gamma ]^2}. \end{aligned}$$
(11)

From Eq. (11) and the condition \(\rho + 3p < 0\) for the acceleration of the universe, we obtain

$$\begin{aligned} \sqrt{\beta }B>\frac{1}{(2\gamma -1)^{1/(2\gamma )}}, \end{aligned}$$
(12)

with \(\gamma >1/2\). The plot of the function \(\sqrt{\beta }B\) versus \(\gamma \) is given in Fig. 1.

Fig. 1
figure 1

The function \(\sqrt{\beta }B\) vs. \(\gamma \). The minimum of the function \(\sqrt{\beta }B\) occurs at \(\approx 2.296\). At \(\gamma \rightarrow 1/2\), \(\sqrt{\beta }B\rightarrow \infty \), and as \(\gamma \rightarrow \infty \), we have \(\sqrt{\beta }B\rightarrow 1\)

The minimum value of \(\sqrt{\beta }B\) takes place at \(\gamma =0.5 \exp \left( W(1/e)+1\right) \approx 2.296\), where W(z) is the Lambert function. Thus, the strong magnetic fields drives the universe inflation. The stress–energy tensor conservation, \(\nabla ^\mu T_{\mu \nu }=0\), leads to the equation

$$\begin{aligned} {\dot{\rho }}+3\frac{\dot{a}}{a}\left( \rho +p\right) =0. \end{aligned}$$
(13)

Using Eq. (10), one finds

$$\begin{aligned} \rho +p=\frac{2B^2[1-(\gamma -1)(\beta B^2)^\gamma ]}{3\left[ 1+(\beta B^2)^\gamma \right] ^2}. \end{aligned}$$
(14)

After integrating Eq. (13), with the help of Eq. (14), we obtain

$$\begin{aligned} B(t)=\frac{B_0}{a(t)^2}, \end{aligned}$$
(15)

were \(B_0\) is the magnetic field corresponding to the value \(a(t)=1\). It is worth mentioning that Eq. (15) holds for any Lagrangian [13]. Because the scale factor increases during the inflation, the magnetic field decreases. By virtue of Eqs. (10) and (15), one finds

$$\begin{aligned} \lim _{a(t)\rightarrow \infty }\rho (t)=\lim _{a(t)\rightarrow \infty }p(t)=0, \nonumber \\ \lim _{a(t)\rightarrow 0}\rho (t)=\lim _{a(t)\rightarrow 0}p(t)=\infty ~~~~~~~\gamma <1, \nonumber \\ \lim _{a(t)\rightarrow 0}\rho (t)=\lim _{a(t)\rightarrow 0}p(t)=0~~~~~~~\gamma >1, \nonumber \\ \lim _{a(t)\rightarrow 0}\rho (t)= - \lim _{a(t)\rightarrow 0}p(t)=\frac{1}{2\beta }~~~~~~\gamma =1. \end{aligned}$$
(16)

As a result, singularities of the energy density and pressure as \(a(t)\rightarrow 0\) are absent at \(\gamma \ge 1\). Equation (16) shows that at the beginning of universe evolution (\(a \approx 0\)), the model gives \(\rho =-p\) at \(\gamma =1\) for the rational NED, corresponding to de Sitter spacetime, i.e., we have the same property as in the \(\Lambda CDM\) model. Using Eq. (10), we obtain EoS

$$\begin{aligned} w=p(t)/\rho (t)=\frac{1+(1-4\gamma )(\beta B^2)^\gamma }{3[1+(\beta B^2)^\gamma ]}. \end{aligned}$$
(17)

The function w versus \((\beta B^2)^\gamma \) is depicted in Fig. 2 for \(\gamma =0.75,~ 1,~ 1.5\).

Fig. 2
figure 2

The function w vs. \((\beta B^2)^{\gamma }\) for \(\gamma =0.75, 1, 1.5\)

Using Eq. (17), one finds

$$\begin{aligned} \lim _{B\rightarrow 0} w=\frac{1}{3}. \end{aligned}$$
(18)

As \(a(t)\rightarrow \infty \) (\(B\rightarrow 0\)), one has the EoS for the ultra-relativistic case [28]. For \(\gamma >1\) and \((\beta B^2)^\gamma =1/(\gamma -1)\), one has de Sitter spacetime, \(w=-1\). Thus, for an example, at \(\gamma =1.5\) and \((\beta B^2)^{1.5}=2\), one has \(w=-1\) (see Fig. 2). From Eqs. (3) and (6), we obtain the Ricci scalar

$$\begin{aligned} R=\kappa ^2T_\mu ^{~\mu }=\frac{2\kappa ^2\gamma B^2(\beta B^2)^\gamma }{[1+(\beta B^2)^\gamma ]^2}=\kappa ^2\left[ \rho (t)-3p(t)\right] . \end{aligned}$$
(19)

The function \(\beta R/\kappa ^2\) versus \((\beta B^2)^{\gamma }\) is depicted in Fig. 3.

Fig. 3
figure 3

The function \(\beta R/\kappa ^2\) vs. \(\beta B^2\) for \(\gamma =0.75,~ 1,~ 1.5\). For \(\gamma \ge 1\), the singularity of the Ricci scalar is absent

Using Eq. (19), we find

$$\begin{aligned} \lim _{B\rightarrow 0}R(t)=0, \nonumber \\ \lim _{B\rightarrow \infty }R(t)=0~~~\text{ at }~~\gamma >1, \nonumber \\ \lim _{B\rightarrow \infty }R(t)=\frac{2\kappa ^2}{\beta }~~~\text{ at }~~\gamma =1. \end{aligned}$$
(20)

Note that when the scale factor \(a(t)\rightarrow 0\), one has \(B\rightarrow \infty \), and the singularity of the Ricci scalar is absent for \(\gamma \ge 1\). The Ricci tensor-squared \(R_{\mu \nu }R^{\mu \nu }\) and the Kretschmann scalar \(R_{\mu \nu \alpha \beta }R^{\mu \nu \alpha \beta }\) may be expressed as linear combinations of \(\kappa ^4\rho ^2\), \(\kappa ^4\rho p\), and \(\kappa ^4p^2\) [16], and according to Eq. (16), they are finite, as \(a(t)\rightarrow 0\) and \(a(t)\rightarrow \infty \) for \(\gamma \ge 1\). As \(t\rightarrow \infty \), the scale factor increases and spacetime approaches the Minkowski spacetime. From Eqs. (12) and (15) we find that the universe accelerates at \(a(t)<\beta ^{1/4}\sqrt{B_0}(2\gamma -1)^{1/(4\gamma )}\), and inflation of the universe occurs.

3 Evolution of the universe

We will use the Friedmann equation for a three-dimensional flat universe to describe the evolution of the universe, which is given by

$$\begin{aligned} \left( \frac{\dot{a}}{a}\right) ^2=\frac{\kappa ^2\rho }{3}. \end{aligned}$$
(21)

Using Eqs. (10) and (21), one obtains

$$\begin{aligned} \dot{a} =\frac{\kappa B_0a^{2\gamma -1}}{\sqrt{6}\sqrt{a^{4\gamma }+(\beta B_0^2)^{\gamma }}}. \end{aligned}$$
(22)

With the help of the unitless variables \(x\equiv a/(\beta ^{1/4}\sqrt{B_0})\), \(y\equiv \sqrt{6\beta }\dot{x}/\kappa \), Eq. (22) becomes

$$\begin{aligned} y =\frac{ x^{2\gamma -1}}{\sqrt{x^{4\gamma }+1}}. \end{aligned}$$
(23)

The function y versus x is depicted in Fig. 4.

Fig. 4
figure 4

The function \(y=\sqrt{6\beta }\dot{x}/\kappa \) vs. \(x=a/(\beta ^{1/4}\sqrt{B_0})\) for \(\gamma =0.75,~1,~1.5\)

According to Fig. 4, the inflation lasts from the Big Bang until the graceful exit, \(x_\mathrm{{end}}=(2\gamma -1)^{1/(4\gamma )}\), and then the universe decelerates. After integrating Eq. (22), we obtain

$$\begin{aligned} \int _{a(t_\mathrm{{in}})}^{a(t_\mathrm{{end}})} \frac{\sqrt{a^{4\gamma }+(\beta B_0^2)^\gamma }}{a^{2\gamma -1}}\mathrm{{d}}a =\frac{\kappa B_0}{\sqrt{6}}\int _{t_\mathrm{{in}}}^{t_\mathrm{{end}}} \mathrm{{d}}t. \end{aligned}$$
(24)

From Eq. (24) we arrive at the equation

$$\begin{aligned}{} & {} \frac{a(t_\mathrm{{end}})^{2(1-\gamma )}(\beta B_0^2)^{\gamma /2}}{2(1-\gamma )}F\nonumber \\{} & {} \quad \times \left( -\frac{1}{2},\frac{1}{2\gamma }-\frac{1}{2};\frac{1}{2\gamma }+\frac{1}{2};-\frac{a(t_\mathrm{{end}})^{4\gamma }}{(\beta B_0^2)^\gamma }\right) \nonumber \\{} & {} \quad -\frac{a(t_\mathrm{{in}})^{2(1-\gamma )}(\beta B_0^2)^{\gamma /2}}{2(1-\gamma )}F\nonumber \\{} & {} \quad \times \left( -\frac{1}{2},\frac{1}{2\gamma }-\frac{1}{2};\frac{1}{2\gamma }+\frac{1}{2};-\frac{a(t_\mathrm{{in}})^{4\gamma }}{(\beta B_0^2)^\gamma }\right) =\frac{\kappa B_0}{\sqrt{6}}\Delta t, \nonumber \\ \end{aligned}$$
(25)

where F(abcz) is the hypergeometric function and \(\triangle t\) is the duration of the inflation. It is worth noting that the hypergeometric function entering Eq. (25) has the property \(c-b=1\), and therefore it can be expressed through the incomplete B-function by the relation \(B_z(p,q)=p^{-1}z^pF(1-q,p;p+1;z)\) [29]. Equation (25) allows us to study the evolution of the universe inflation.

3.1 Universe inflation

The expansion of the universe can be described by the deceleration parameter. From Eqs. (9), (10), (15), and (21), we obtain the deceleration parameter

$$\begin{aligned} q=-\frac{\ddot{a}a}{(\dot{a})^2}=\frac{x^{4\gamma }+1-2\gamma }{x^{4\gamma }+1}. \end{aligned}$$
(26)
Fig. 5
figure 5

The function q vs. \(x=a/(\beta B_0^2)^{1/4}\)

The plot of the deceleration parameter q versus \(x=a/(\beta B_0^2)^{1/4}\) is depicted in Fig. 5. The inflation, \(q<0\), takes place until the graceful exit \(q=0\) (\(x_\mathrm{{end}}=(2\gamma -1)^{1/(4\gamma )}\)). When \(x=(2\gamma -1)^{1/(4\gamma )}\), the acceleration stops, the deceleration parameter is zero, and one then has the deceleration phase (\(q>0\)). Singularities at the early epoch are absent.

Now we evaluate the amount of inflation with the help of e-folding [30]

$$\begin{aligned} N=\ln \frac{a(t_\mathrm{{end}})}{a(t_\mathrm{{in}})}, \end{aligned}$$
(27)

where \(t_\mathrm{{end}}\) corresponds to the final time of the inflation, and \(t_\mathrm{{in}}\) is an initial time. The graceful exit point is \(x_\mathrm{{end}}= (2\gamma -1)^{1/(4\gamma )}\), and one finds \(a(t_\mathrm{{end}})= (2\gamma -1)^{1/(4\gamma )} b\) (\(b= \beta ^{1/4}\sqrt{B_0}\)). It is known that the horizon and flatness problems can be solved when e-folds \(N\approx 70\) [30]. From Eq. (27) we find the scale factor corresponding to the inflation initial time

$$\begin{aligned} a(t_\mathrm{{in}})=\frac{(2\gamma -1)^{1/(4\gamma )}b}{\exp (70)}\approx (2\gamma -1)^{1/(4\gamma )}\times 10^{-31}b. \end{aligned}$$
(28)

One can analyse different scenarios of universe inflation by varying \(\gamma \), b, and N. This model possesses phases of the universe inflation, the graceful exit, and deceleration. Making use of Eq. (25) and condition \(a(t_\mathrm{{end}})\gg a(t_\mathrm{{in}})\) (\(a(t_\mathrm{{end}})= 10^{31}a(t_\mathrm{{in}})\)), we obtain

$$\begin{aligned} \triangle t= & {} \frac{\sqrt{3}a(t_\mathrm{{end}})^{2(1-\gamma )}\beta ^{\gamma /2}B_0^{\gamma -1}}{\sqrt{2}(1-\gamma )\kappa } F\nonumber \\{} & {} \times \left( -\frac{1}{2},\frac{1}{2\gamma }-\frac{1}{2};\frac{1}{2\gamma }+\frac{1}{2};-\frac{a(t_\mathrm{{end}})^{4\gamma }}{(\beta B_0^2)^\gamma }\right) . \end{aligned}$$
(29)

To study the scale factor at \(a(t_\mathrm{{end}})\gg 1\), we use the Pfaff transformation [29]

$$\begin{aligned} F(a,b;c;z)=(1-z)^{-a}F\left( a,c-b;c;\frac{z}{z-1}\right) . \end{aligned}$$
(30)

Using Eq. (30), at \(a(t_\mathrm{{end}})\gg 1\) we obtain

$$\begin{aligned}{} & {} F\left( -\frac{1}{2},\frac{1}{2\gamma }-\frac{1}{2};\frac{1}{2\gamma }+\frac{1}{2};-\frac{a(t_\mathrm{{end}})^{4\gamma }}{(\beta B_0^2)^\gamma }\right) \nonumber \\{} & {} \quad \approx \sqrt{1+\frac{a(t_\mathrm{{end}})^{4\gamma }}{(\beta B_0^2)^\gamma }}F\left( -\frac{1}{2},1;\frac{\gamma +1}{2\gamma };1\right) \nonumber \\{} & {} \quad =\sqrt{1+\frac{a(t_\mathrm{{end}})^{4\gamma }}{(\beta B_0^2)^\gamma }} \frac{\Gamma \left( \frac{\gamma +1}{2\gamma }\right) \Gamma \left( \frac{1}{2\gamma }\right) }{\Gamma \left( \frac{2\gamma +1}{2\gamma }\right) \Gamma \left( \frac{1-\gamma }{2\gamma }\right) }, \end{aligned}$$
(31)

where \(\Gamma (x)\) is the gamma function. From Eqs. (29) and (31), at \(a(t_\mathrm{{end}})\gg 1\), we obtain in the leading order the equation as follows:

$$\begin{aligned} \frac{a(t_\mathrm{{end}})^2}{2(1-\gamma )}\frac{\Gamma \left( \frac{\gamma +1}{2\gamma }\right) \Gamma \left( \frac{1}{2\gamma }\right) }{\Gamma \left( \frac{2\gamma +1}{2\gamma }\right) \Gamma \left( \frac{1-\gamma }{2\gamma }\right) }=\frac{\kappa B_0}{\sqrt{6}}\Delta t. \end{aligned}$$
(32)

Using Eq. (32), at \(a(t_\mathrm{{end}})\gg 1\) we arrive at

$$\begin{aligned} a(t_\mathrm{{end}})= \sqrt{\frac{2\kappa B_0(1-\gamma )}{\sqrt{6}}\frac{\Gamma \left( \frac{2\gamma +1}{2\gamma }\right) \Gamma \left( \frac{1-\gamma }{2\gamma }\right) }{\Gamma \left( \frac{\gamma +1}{2\gamma }\right) \Gamma \left( \frac{1}{2\gamma }\right) }\Delta t}, \end{aligned}$$
(33)

which corresponds to the radiation era. With relation \(\Gamma (1+z)=z\Gamma (z)\), we obtain

$$\begin{aligned} \frac{\Gamma \left( \frac{2\gamma +1}{2\gamma }\right) \Gamma \left( \frac{1-\gamma }{2\gamma }\right) }{\Gamma \left( \frac{\gamma +1}{2\gamma }\right) \Gamma \left( \frac{1}{2\gamma }\right) }=\frac{1}{1-\gamma }. \end{aligned}$$

where

$$\begin{aligned} A(\gamma )\equiv \frac{\Gamma \left( \frac{2\gamma +1}{2\gamma }\right) \Gamma \left( \frac{1-\gamma }{2\gamma }\right) }{\Gamma \left( \frac{\gamma +1}{2\gamma }\right) \Gamma \left( \frac{1}{2\gamma }\right) }. \end{aligned}$$

Taking the duration of the inflation to be \(\triangle t \approx 10^{-32}s\) and the values of \(\kappa =\sqrt{8\pi G}\) and \(a(t_\mathrm{{end}})= (2\gamma -1)^{1/(4\gamma )} \beta ^{1/4}\sqrt{B_0}\), one can find from Eq. (33) the coupling \(\beta \)

$$\begin{aligned} \beta =\frac{2\kappa ^2\Delta t^2}{3(2\gamma -1)^\gamma }. \end{aligned}$$
(34)
Fig. 6
figure 6

The function \(y=\beta /(\kappa ^2\Delta t^2)\) vs. \(\gamma \)

Figure 6 shows the dependence of \(y=\beta /(\kappa ^2\Delta t^2)\) versus \(\gamma \), where we use \(a(t_\mathrm{{end}})= (2\gamma -1)^{1/(4\gamma )}\beta ^{1/4}\sqrt{B_0}\). According to Fig. 6, when parameter \(\gamma \) increases, the coupling \(\beta \) decreases, obtaining the same time of the universe inflation.

3.2 Sound speed, causality, and unitarity

The causality holds when the speed of sound is less than the local speed of light (\(c_s\le 1\)) [31]. If the square sound speed is positive (\(c^2_s> 0\)), a classical stability takes place. From Eq. (10) one obtains the speed squared of sound

$$\begin{aligned} c^2_s= & {} \frac{\mathrm{{d}}p}{\mathrm{{d}}\rho }=\frac{\mathrm{{d}}p/\mathrm{{d}} B}{\mathrm{{d}}\rho /\mathrm{{d}}B}\nonumber \\= & {} \frac{(4\gamma -1)(\gamma -1)(\beta B^2)^{2\gamma }-(4\gamma ^2+5\gamma -2)(\beta B^2)^{\gamma }+1}{3(1+(\beta B^2)^{\gamma })(1-(\gamma -1)(\beta B^2)^{\gamma })}. \nonumber \\ \end{aligned}$$
(35)

The plots of the function \(c_s^2\) versus \(\beta B^2\) are depicted in Fig. 7.

Fig. 7
figure 7

The function \(c_s^2\) vs. \((\beta B^2)^{\gamma }\)

Figure 7 shows that with an increasing parameter \(\gamma \), the causality and unitarity take place for a smaller background magnetic field. It follows from Eq. (35) that \(c^2_s=0\) at \(\gamma =3/4\), \(\beta B^2=(\sqrt{18}-4)^{4/3}\approx 0.15\); \(\gamma =1\), \(\beta B^2=1/7\approx 0.14\); \(\gamma =1.5\), \(\beta B^2=(2.9-\sqrt{8.01})^{2/3}\approx 0.17\). Using Eq. (12), we obtain that acceleration occurs at \(\gamma =3/4\), \(\beta B^2>0.5^{-4/3}\approx 2.5\); \(\gamma =1\), \(\beta B^2>1\); \(\gamma =1.5\), \(\beta B^2>2^{-2/3}\approx 0.63\). Thus, at the acceleration phase, the classical stability, causality, and unitarity are broken.

4 Cosmological parameters

Using Eq. (10), one obtains

$$\begin{aligned} p=-\rho +\frac{2 B^2)[1-(\gamma -1)(\beta B^2)^\gamma ]}{3[(\beta B^2)^\gamma +1]^2}, \end{aligned}$$
(36)
$$\begin{aligned} 2\beta \rho [(\beta B^2)^\gamma +1]-\beta B^2=0. \end{aligned}$$
(37)

By solving Eq. (37) for a particular \(\gamma \), one can express \(\beta B^2\) as a function of \(\rho \). Then Eq. (36) may be represented as the EoS for the perfect fluid

$$\begin{aligned} p=-\rho +f(\rho ),~~f(\rho )=\frac{2z[1-(\gamma -1)z^\gamma ]}{3\beta [z^\gamma +1]^2}, \end{aligned}$$
(38)

where \(z=\beta B^2\) is the solution to Eq. (37) (\(2\beta \rho [z^\gamma +1]-z=0\)) and z is a function of \(\rho \). The analytical solution to Eq. (37) is possible only for several values of \(\gamma \). The case of \(\gamma =1\) was studied in [17]. Here, we will investigate the case of \(\gamma =2\). For this case, the solution to Eq. (37) is given by

$$\begin{aligned} z=\frac{1- \sqrt{1-16(\beta \rho )^2}}{4\beta \rho }. \end{aligned}$$
(39)

In the following, we use the negative branch of the root squared to obtain the positive physical function \(f(\rho )\) as \(p+\rho >0\) (see Eq. (14)). Then, from Eqs. (38) and (39), we obtain (at \(\gamma =2\))

$$\begin{aligned} f(\rho )=\frac{4\rho }{3}\sqrt{1-16(\beta \rho )^2}. \end{aligned}$$
(40)

In the case when \(|f(\rho )/\rho |\ll 1\), the expressions for the spectral index \(n_s\), the tensor-to-scalar ratio r, and the running of the spectral index \(\alpha _s=dn_s/d\ln k\) are given by [32]

$$\begin{aligned} n_s\approx 1-6\frac{f(\rho )}{\rho },~~~r\approx 24\frac{f(\rho )}{\rho },~~~\alpha _s\approx -9\left( \frac{f(\rho )}{\rho }\right) ^2. \nonumber \\ \end{aligned}$$
(41)

From Eq. (41) we obtain the relations

$$\begin{aligned} r=4(1-n_s)=8\sqrt{-\alpha _s}=32\sqrt{1-16(\beta \rho )^2}. \end{aligned}$$
(42)

The Planck experiment [33] and WMAP data [34, 35] gave the result

$$\begin{aligned} n_s=0.9603\pm 0.0073 ~(68\% CL),~~~r<0.11 ~(95\%CL), \nonumber \\ \alpha _s=-0.0134\pm 0.0090 ~(68\% CL). \nonumber \\ \end{aligned}$$
(43)

From the requirements \(|f(\rho )/\rho |\ll 1\) and \(16(\beta \rho )^2<1\), one finds

$$\begin{aligned} \frac{1}{4}>\beta \rho \gg \frac{\sqrt{7}}{16}. \end{aligned}$$
(44)

Using Eq. (42), at \(r=0.13\), we obtain the values for the spectral index \(n_s=0.9675\) and the running of the spectral index \(\alpha _s=-2.64\times 10^{-4}\). By virtue of Eq. (42), one finds the value \(\beta \rho \approx 0.249998\) which satisfies Eq. (44) and corresponds to values of the cosmological parameters. To find the value of the magnetic field, one can use Eq. (10) (at \(\gamma =2\)) by fixing the coupling \(\beta \) and using the value \(\beta \rho \approx 0.249998\). The plot of the function \(\beta B^2\) versus \(\beta \rho \) is depicted in Fig. 8.

Fig. 8
figure 8

The function \(\beta B^2\) vs. \(\beta \rho \)

For \(\beta \rho \approx 0.249998\), we have \(\beta B^2\approx 0.996\).

5 Summary

We have studied Einstein’s gravity coupled to nonsingular NED with two parameters. The stochastic magnetic fields of background as a source of gravity were implied. The range of magnetic fields when inflation of the universe takes place were obtained. It was shown that there are no singularities of energy density and pressure at \(\gamma \ge 1\). We demonstrated that as the scale factor goes to infinity, the EoS of the ultra-relativistic case takes place. It was shown that singularities of curvature invariants are absent for \(\gamma \ge 1\). We investigated the evolution of the universe, and the dependence of the scale factor on time was obtained. To study the evolution of the universe, the deceleration parameter as a function of the scale factor was calculated. To analyse the amount of inflation, we calculated the e-folds. It was shown that for some parameters, the reasonable number of e-folds \(N\approx 70\) holds. The duration of the universe inflation as a function of the parameters \(\beta \) and \(\gamma \) was obtained. We computed the speed of sound to study the causality and unitarity principles in our model. The range of background magnetic fields when causality and unitarity hold was obtained. The cosmological parameters, spectral index \(n_s\), tensor-to-scalar ratio r, and running of the spectral index \(\alpha _s\) were computed. We showed that \(n_s\), r, and \(\alpha _s\) are in agreement with the Planck and WMAP data.

Let us discuss the similarities and differences between our model of the universe inflation and the model in Ref. [36].

Similarities: The Ricci scalar curvature, the Ricci tensor squared, and the Kretschmann scalar have no singularities at the early/late stages, as \(a\rightarrow 0\). In the model [36] and in our model, \(w =1/3\), \(q=1\) as \(a\rightarrow \infty \). The early universe did not have Big-Bang singularity and had accelerated in the past. The slow-roll parameters including the spectral index \(n_s\) and tensor-to-scalar ratio r were analysed and compared with the results of observational data. The classical stability and causality were studied.

Differences: The behaviour of the EoS parameter w and deceleration parameter q as \(a\rightarrow 0\) are different. In our model, \(w=(1-4\gamma )/3\), \(q=1-2\gamma \), but in the model of [36], \(w=-1\), \(q=-1\) for any \(\alpha \) as \(a\rightarrow 0\). The duration of the universe inflation as a function of the parameters \(\beta \) and \(\gamma \) was computed in our model. Phase space analysis was performed in [36]. Corrections of the NED Lagrangian to Maxwell’s Lagrangian were different at the weak-field limit.