1 Introduction

Polytropes refers to the general solution of Lane-Emden equation (LEe), contributing significantly in modeling of compact objects. The form of polytropic equation of state (EoS) attracted many researchers to explore physical attributes of polytropic models. Lane [1] presented the fundamental results related to modeling of stellar structures via polytropes. Chandareskhar [2] contributed majorally in this field by presenting the theory of polytropes in perspective of Newtonian regime. Tooper [3,4,5] formulated the basic scheme of relativistic polytropes by assuming qausi-static equilibrium. Kovetz [6] made some modifications in Chandareskhar’s work by discussing slowly rotating polytropes. Shapiro and Teukolsky [7] discussed white dwarfs with the help of theory of polytropes. Abramowicz [8] described polytropes in higher dimension for evolution of LEe. Komatsu et al. [9] explained numerical methods and applications of rapidly rotating general relativistic stars to uniformly rotating polytropes. Cook et al. [10] constructed equilibrium sequences for rotating polytropes. Azam et al. [11] presented two models which describe general framework of polytropes in general relativity.

In the study of astrophysical objects anisotropy plays a vital role. A number of physical problems cannot be modeled without consideration of anisotropy factor. Bowers and Liang [12] discussed equilibrium mass and surface redshift of anisotropic compact stars and provided the results by making comparison with the stars filled with isotropic fluid. In 1981, Cosenza [13] developed a framework for modeling of compact objects with anisotropic fluid inner fluid distribution. A comprehensive study about anisotropy in compact objects was provided by Herrera and Santos [14]. Dev and Gleiser [15] studied properties of gravitationally bounded compact objects under anisotropic pressure. Herrera and Berreto [16] used the concept of effective variables for anisotropic relativistic polytropes. Herrera et al. [17] formulated full set of governing to describe the evolution anisotropic dissipative self-gravitating spherical compact objects. Herrera and Berreto [18, 19] checked the stability of anisotropic polytropic models by using the concept of Tollman mass. Thirukkanesh and Ragel [20] used static spherically symmetric spacetime to developed models of anisotropic compact stars and provided the solution of Einstein field equations (EFEs) within the framework of MIT Bag Model. Reddy et al. [21] discussed the role of anisotropic forces during dissipative gravitational collapse by using perturbation approach.

Isotropic coordinates are very useful in the study of static spherically symmetric spacetime and also used to make spacetime as much Euclidean as possible. Boutros [22] found exact solution of EFEs in isotropic coordinates with perfect inner fluid distribution and proved that one of the model verifies polytropic EoS. Mak and Harko [23] converted EFEs into two independent Riccati-type differential equations using isotropic coordinates and found three new classes of exact solutions. Crothers [24] explained Einstein gravitational field in detail by making use of isotropic coordinates. Govender and Thirukkanesh [25] used linear EoS and presented general framework for exact solution of EFEs with anisotropic inner fluid and isotropic coordinates.

For modeling of relativistic stars, use of polytropic EoS leads to the most elementary and significant contribution. Chavanis [26, 27] used generalized polytropic equation of state (GPEoS) by combining linear EoS (\(P_{r}=\alpha \rho _{0}\)) with polytropic EoS (\(P_{r}=\beta \rho ^{1+\frac{1}{n}}\)), which results in \(P_{r}=\alpha \rho +\beta \rho ^{1+\frac{1}{n}}\), where \(P_{r}\) denotes the radial pressure, K is polytropic constant and n is polytropic index. He described different cosmological models of early and late time universe with the help of GPEoS. Freitas and Goncalves [28] used generalized polytropic EoS to study primordial quantum fluctuations and build a universe with constant density at the origin. Azam et al. [11, 29] used GPEoS to develop general framework for charged spherical and cylindrical objects having anisotropic matter configuration with conformally flat condition.

Stability analysis is significantly important in mathematical modeling of compact objects. Hydrostatic equilibrium equations were initially developed to check the stability of compact objects by Bondi [30]. Different studies have been presented in the past to elaborate polytropic models in Schwarzchild coordinates. Some researchers have also used isotropic coordinates which are derived from Schwarzchild coordinates to explain the stellar structure using range \(1<n<5\) for polytropic index. Pandey et al. [31] used range \(\frac{1}{2}<n<3\) to explain the properties and structure of compact objects. Herrera et al. [32] presented cracking technique to check the stability of system using local density perturbation. Thirukkanesh and Regal [33] used different polytropic indices for exact solutions of EFEs under the effect of anisotropy in spherically symmetric spacetime. Takissa and Maharaj [34] used different values of n to obtain exact solution to the EFEs. Azam et al. [35] used local density perturbation technique to address the instability problem by calculating cracking points for a variety of compact stars. Ngubelanga and Maharaj [36] discovered new classes of polytropic models for different values of polytropic index and obtained masses of several stars. The same authors [37] used \(n=1, \frac{1}{2}, \frac{2}{3},2\) to generate physically well behaved polytropic models.

In this work the main objective is to develop new physically viable polytropic solutions to the EFEs in isotropic coordinates with GPEoS. We assume spherically symmetric spacetime with anisotropic inner fluid in isotropic coordinates with GPEoS. We present three different mathematical models for \(n=1, \frac{1}{2}, \frac{1}{3}\), and a physical analysis indicates that the models are well behaved. For the sake of simplicity, we will explain the properties of model by using polytropic index \(n=1\). Our paper is organized as follows, in Sect. 2, we will comprehensively explain our model. Section 3 contains the integration of the model and in Sect. 4, we will develop different polytropic models for \(n=1,\frac{1}{2}, \frac{1}{3}\). Physical properties of the system for \(n=1\) will be explained in Sect. 5 followed by the conclusion.

2 Einstein field equations

The line element for static spherically symmetric spacetime in isotropic coordinates \((x^{a})=(t,r,\theta ,\phi )\) is given by

$$\begin{aligned} ds^2=-A^{2}(r)dt^{2}+B^{2}(r) \left[ dr^{2}+r^{2} \left( d\theta ^{2}+sin^2\theta d \phi ^{2} \right) \right] ,\nonumber \\ \end{aligned}$$
(1)

where the metric quantities A(r) and B(r) are gravitational potentials. For an anisotropic fluid, energy momentum tensor has the following form

$$\begin{aligned} T_{i j}=diag \left( -\rho , P_{r}, P_{t}, P_{t} \right) , \end{aligned}$$
(2)

where \(\rho \), \(P_{t}\) and \(P_{r}\) are matter quantities representing energy density, tangential pressure and radial pressure. The timelike unit four velocity \(u^{i}=\frac{1}{A}\delta _{0}^{i}\), is used to measure these quantities. From Eqs. (1) and (2), EFEs takes the following form

$$\begin{aligned} 8\pi \rho= & {} -\frac{1}{B^2}\left[ 2\frac{B^{\prime \prime }}{B}-\frac{B^\prime }{B}\left( \frac{B^\prime }{B}-\frac{4}{r}\right) \right] , \end{aligned}$$
(3)
$$\begin{aligned} 8\pi p_{r}= & {} 2\frac{A^{\prime }}{A}\left( \frac{B^\prime }{B^3}+\frac{1}{r}\frac{1}{B^2}\right) +\frac{B^\prime }{B^3}\left( \frac{B^\prime }{B}+\frac{2}{r}\right) , \end{aligned}$$
(4)
$$\begin{aligned} 8\pi p_{r}= & {} 2\frac{1}{B^2}\left[ \frac{B^{\prime \prime }}{B}-\frac{B^\prime }{B}\left( \frac{B^\prime }{B}-\frac{1}{r}\right) \right] +\frac{1}{B^2}\left( \frac{A^{\prime \prime }}{A}+\frac{1}{r}\frac{A^\prime }{A}\right) .\nonumber \\ \end{aligned}$$
(5)

The above system of Eqs. (3)–(5) comprises five independent variables (\(\rho \), \(P_{r}\), \(P_{t}\), A(r), B(r)) with three equations. To understand the system more efficiently, we use new following transformation [36, 37]

$$\begin{aligned} x\equiv r^2,~~~~~~~~~L\equiv B^{-1},~~~~~~~~~G\equiv LA, \end{aligned}$$
(6)

applying transformation given in above Eq. (6) to system of Eqs. (3)–(5), we get the following set of equation

$$\begin{aligned} 8\pi \rho= & {} 4\left[ 2xLL_{xx}-3(x L_x-L)L_x\right] , \end{aligned}$$
(7)
$$\begin{aligned} 8\pi p_r= & {} 4L(L-2x L_x)\frac{G_x}{G}-4(2L-3x L_x)L_x, \end{aligned}$$
(8)
$$\begin{aligned} \nonumber 8\pi p_t= & {} 4x L^2\frac{G_{xx}}{G}+4L\left( L-2x L_x \right) \frac{G_x}{G} \nonumber \\&-\,4(2L-3x L_x)L_x-8x L L_{xx}. \end{aligned}$$
(9)

for line element in Eq. (1). The subscript x represents derivative with respect to x. we assume that matter should satisfy GPEoS which has the form [11]

$$\begin{aligned} P_r =\beta \rho +\alpha \rho ^\Gamma , \end{aligned}$$
(10)

where \(\Gamma =1+\frac{1}{n}\).

The EFEs (7)–(9) together with the GPEoS (10), leads to following relations

$$\begin{aligned} 8\pi \rho= & {} 4\left[ 2xLL_{xx}-3 \left( xL_{x}-L \right) L_{x} \right] , \end{aligned}$$
(11)
$$\begin{aligned} P_r= & {} \beta \rho +\alpha \rho ^{1+\frac{1}{n}}, \end{aligned}$$
(12)
$$\begin{aligned} 8\pi P_{t}= & {} 8\pi P_{r}+\Delta , \end{aligned}$$
(13)
$$\begin{aligned} \Delta= & {} 4xL^2\frac{G_{xx}}{G}+4L \left( L-2xL_{x} \right) \frac{G_{x}}{G}\nonumber \\&-4 \left( 2L-3xL_{x} \right) L_{x} \nonumber \\&- 8xLL_{xx}-\frac{\beta }{2}[8(2xLL_{xx}-3(xL_{x}-L)L_{x})] \nonumber \\&- \frac{8\pi \alpha }{(16\pi )^{1+ \frac{1}{n}}}\left[ 8 \left( 2xLL_{xx}-3 \left( x L_{x}-L \right) L_{x} \right) \right] ^{1+\frac{1}{n}}, \nonumber \\\end{aligned}$$
(14)
$$\begin{aligned} \frac{G_{x}}{G}= & {} \frac{2\beta }{L(L-2xL_{x})}\left[ \left( 2xLL_{xx}-3\left( xL_{x}-L \right) L_{x}\right) \right] \nonumber \\&+ \frac{\left( 2L-3xL_{x}\right) L_{x}}{L \left( L-2xL_{x}\right) } \nonumber \\&+ \frac{2\pi \alpha }{L(L-2xL_{x})} \nonumber \\&\times \quad \left[ \frac{8 \left( 2xLL_{xx}-3 \left( xL_{x}-L \right) L_{x} \right) }{2\pi }\right] ^{1+\frac{1}{n}}, \end{aligned}$$
(15)

where \(\Delta =8\pi (P_{t}-P_{r})\) defines measure of anisotropy. System of Eqs. (11)–(15) is nonlinear for L and G. This system has six unknowns \((P_{r}, \rho , P_{t}, \Delta , L, G)\) and five independent equations. In order to get exact solution by integration we need value of one variable. We write mass function as in [34]

$$\begin{aligned} m(r)=2\pi \int _{0}^{x}\frac{1}{\sqrt{\gamma }}\left[ \gamma \rho (\gamma )\right] d\gamma , \end{aligned}$$
(16)

where \(\gamma \) denotes integration variable.

3 Integration

To obtain functional forms of the matter variables, we solve the system of Eqs. (11)–(15) by means of integration. In order to make physically viable choice of the independent variable, we introduce gravitational potential L of the form

$$\begin{aligned} L=ax^{2}+bx+c, \end{aligned}$$
(17)

which is quadratic in nature, where a, b and c are constants.

Using of above relation in Eq. (11), we obtain result for energy density as

$$\begin{aligned} \rho =\frac{1}{2\pi }\left[ 3bc+10acr^{2}+abr^{4}-2a^{2}r^{6} \right] , \end{aligned}$$
(18)

and the radial pressure from Eq. (12) takes the from

$$\begin{aligned} P_{r}= & {} \frac{\beta }{2\pi }\Big (3bc+10acr^{2}+abr^{4}-2a^{2}r^{6}\Big ) \nonumber \\&+ \frac{\alpha }{(2\pi )^{1+\frac{1}{n}}} \Big (12bc+40acr^{2}+4abr^{4}-8a^{2}r^{6}\Big )^{1+\frac{1}{n}}. \end{aligned}$$
(19)

Now Eq. (15) reduces to

$$\begin{aligned} \frac{G_{x}}{G}= & {} \frac{2\beta }{(ax^{2}+bx+c)(-3ax^{2}-bx+c)} \nonumber \\&\left[ -2a^{2}x^{3}+abx^{2}+10acx+3ac\right] \nonumber \\&+ \frac{(-4ax^{2}-bx+2c)(2ax+b)}{(ax^{2}+bx+c)(-3ax^{2}-bx+c)} \nonumber \\&+\frac{2\pi \alpha }{(ax^{2}+bx+c)(-3ax^{2}-bx+c)} \nonumber \\&\times \left[ \frac{-2a^{2}x^{3}+abx^{2}+10acx+3ac}{2\pi }\right] ^{1+\frac{1}{n}}, \end{aligned}$$
(20)

the above equation is in the form of gravitational potential G and its difficult to integrate it due the presence of polytropic index n. To obtain exact models we integrate it for specific values of polytropic indices \(n=1\), \(n=1/2\), \(n=1/3\).

4 Polytropic models

In this section we present three exact polytropic models for selected values of polytropic index as mentioned in the previous section. With the general value of polytropic index n, it is difficult to integrate Eq. (20) and present exact solutions. That is why, we have chosen different constant values of n to integrate Eq. (20) and generate a variety of polytropic models.

4.1 n = 1

For \(n=1\), Eq. (20) can be integrated as

$$\begin{aligned}&G(r)=K \left( ar^{4}+br^{2}+c \right) ^P \nonumber \\&\qquad \quad \quad \times \left( -3ar^{4}-br^{2}+c \right) ^Q e^{N(r)}\left[ U(r) \right] ^{R}\left[ V(r)\right] ^{S},\nonumber \\ \end{aligned}$$
(21)

where K is constant of integration, we take

$$\begin{aligned} P= & {} \frac{3}{8a\pi }\left[ 3b^{3}\alpha +4a(\pi -3bc\alpha +2\pi \beta )\right] , \end{aligned}$$
(22)
$$\begin{aligned} Q= & {} \frac{1}{648a\pi }\left[ 25b^3\alpha +12a(77bc\alpha +9\pi (1+14\beta ))\right] , \end{aligned}$$
(23)
$$\begin{aligned} N(r)= & {} \frac{-(109b^{2}-384ac)\alpha +42abr^{4}-12a^{2}r^{6}\alpha }{54\pi }, \end{aligned}$$
(24)
$$\begin{aligned} U(r)= & {} \frac{\sqrt{(4ac-b^{2})}+b+2ar^{2}}{\sqrt{(4ac-b^{2})}-b-2ar^{2}}, \end{aligned}$$
(25)
$$\begin{aligned} V(r)= & {} \frac{\sqrt{(-12ac-b^{2})}+b+6ar^{2}}{\sqrt{(-12ac-b^{2})}-b-6ar^{2}}, \end{aligned}$$
(26)
$$\begin{aligned} R(r)= & {} \frac{9\alpha (-b^{2}+4ac)^{\frac{3}{2}}}{8a\pi }, \end{aligned}$$
(27)
$$\begin{aligned} S= & {} \frac{-25b^{4}\alpha +7056a^{2}c^{2}\alpha +24ab(16bc\alpha +9\pi (1+2\beta ))}{648a\pi \sqrt{-b^{2}-12ac}}. \end{aligned}$$
(28)

The degree of anisotropy becomes

$$\begin{aligned}&\Delta =\frac{4Q(-b-6ar^{2})(ar^{4}+br^{2}+c)}{(-3ar^{4}-br^{2}+c)^{2}} \nonumber \\&\qquad \times \Big [2P(b+2ar^{2})(-3ar^{4}-br^{2}+c) \nonumber \\&\qquad +\,\,(Q-1)(-b-6ar^{2})\nonumber \\&\qquad +\,\,r^{2}(-3ar^{4}-br^{2}+c)(ar^{4}+br^{2}+c) \nonumber \\&\qquad \times \Big (N^{'}2R\frac{U^{'}}{U}+2S\frac{V^{'}}{V}\Big ) \nonumber \\&\qquad -\,\,\frac{-6}{Q(-b-6ar^{2})}\Big ]+8r^{2}P(b+2ar^{2})(ar^{4}+br^{2}+c) \nonumber \\&\qquad \times \left[ R\frac{U^{'}}{U}+S\frac{V^{'}}{V}\right] +4r^{2}(ar^{4}+br^{2}+c) \nonumber \\&\qquad \times \left[ R\frac{U^{''}}{U}+S\frac{V^{''}}{V}\right] +4r^{2}(ar^{4}+br^{2}+c)^{2} \nonumber \\&\qquad \times \Big [R(R-1)\Big (\frac{U^{'}}{U}\Big )^{2}+S(S-1)\Big (\frac{V^{'}}{V}\Big )^{2}\nonumber \\&\qquad +\,\, 4r^{2}(-3ar^{4}-br^{2}+c)\Big [R\frac{U^{'}}{U}+S\frac{V^{'}}{V}\Big ] \nonumber \\&\qquad +\,\,4r^{2}(ar^{4}+br^{2}+c) \nonumber \\&\qquad \times \Big [N^{''}+2RS(ar^{4}+br^{2}+c)\frac{U^{'}V^{'}}{UV}\nonumber \\&\qquad +\,\, \Big (P(b+2ar^{2})+R(ar^{4}+br^{2}+c)\frac{U^{'}}{U} \nonumber \\&\qquad +\,\, S(ar^{4}+br^{2}+c)\frac{V^{'}}{V}+(ar^{4}+br^{2}+c)N^{'}\Big )N^{'}\Big ]\nonumber \\&\qquad +\,\, 4P(2ar^{2}+b)\Big [r^{2}(P-1)(2ar^{2}+b) \nonumber \\&\qquad +\,\,(-3ar^{4}-br^{2}+c)\Big ]\nonumber \\&\qquad + \,\,4(ar^{4}+br^{2}+c)\Big [2ar^{2}P+Q(-b-6ar^{2})\Big ]\nonumber \\&\qquad +\,\, 4(ar^{4}+br^{2}+c)(-3ar^{4}-br^{2}+c)N^{'} \nonumber \\&\qquad - \,\,4(2ar^{2}+b)(-4ar^{4}-br^{2}+c) \nonumber \\&\qquad -\,\,16ar^{2}(ar^{4}+br^{2}+c) \nonumber \\&\qquad - \,\,4\beta \Big [4ar^{2}(ar^{4}+br^{2}+c)-3(2ar^{2}+b)(ar^{4}-c)\Big ] \nonumber \\&\qquad - \,\,\frac{8\pi \alpha }{(2\pi )^{2}}\Big [4ar^{2}(ar^{4}+br^{2}+c) \nonumber \\&\qquad -\,\,3(2ar^{2}+b)(ar^{4}-c)\Big ]^{2}. \end{aligned}$$
(29)

The line element in Eq. (1) for \(n=1\) takes the form

$$\begin{aligned} ds^{2}= & {} -K(ar^{4}+br^{2}+c)^{2P}\left( -3ar^{4}-br^{2}+c \right) ^{2(Q-1)} \nonumber \\&\times \left[ U(r)\right] ^{2R}\left[ V(r)\right] ^{2S}e^{2N(r)}dt^{2} \nonumber \\&+ (-3ar^{4}-br^{2}+c)^{-2} \nonumber \\&\times \left[ dr^{2}+r^{2}\left( d\theta ^{2}+sin^{2}\theta d\phi ^{2}\right) \right] . \end{aligned}$$
(30)

This form of solution is characterized by GPEoS \(P_r =\beta \rho +\alpha \rho ^2\).

4.2 \(n=\frac{1}{2}\)

For \(n=\frac{1}{2}\), Eq. (20) can be integrated as

$$\begin{aligned} G(r)= & {} K(ar^{4}+br^{2}+c)^P \nonumber \\&\quad \times (-3ar^{4}-br^{2}+c)^Q e^{N(r)}[U(r)]^{R}[V(r)]^{S}, \end{aligned}$$
(31)

where K is constant of integration

$$\begin{aligned}&P=\frac{3}{16a^{2}\pi ^{2}}\Big [-9b^{6}\alpha +90ab^{4}c\alpha +288a^{3}c^{3}\alpha \nonumber \\&\qquad - \,\,8a^{2}(36b^{2}c^{2}\alpha +\pi ^{2}(1+2\beta ))\Big ], \end{aligned}$$
(32)
$$\begin{aligned}&Q=\frac{1}{349928a^{2}\pi ^{2}}\Big [125b^6\alpha +1650ab^{4}c\alpha \nonumber \\&\qquad +\,\,296352a^{3}c^{2}\alpha +216a^{2}(224b^{2}c^{2}\alpha \nonumber \\&\qquad +\,\, 27\pi ^{2}(1+14\beta ))\Big ], \end{aligned}$$
(33)
$$\begin{aligned}&N(r)=\frac{r^{2}\alpha }{29160a\pi ^{2}}\Big [-97790b^{5}+48270ab^{4}r^{2} \nonumber \\&\qquad +\,\,3ab^{3}(29737c-1031ar^{4}) \nonumber \\&\qquad +\,\, 135a^{2}b^{2}r^{2}(-2966c+151ar^{4}) \nonumber \\&\qquad +\,\,540a^{3}r^{2}(1544c^{2}-141acr^{4}+6a^{2}r^{8}) \nonumber \\&\qquad - \,\,72a^{2}b(35100c^{2}-2995acr^{4}+153a^{2}r^{8})\Big ], \end{aligned}$$
(34)
$$\begin{aligned}&U(r)=\frac{\sqrt{(4ac-b^{2})}+b+2ar^{2}}{\sqrt{(4ac-b^{2})}-b-2ar^{2}}, \end{aligned}$$
(35)
$$\begin{aligned}&V(r)=\frac{\sqrt{(-12ac-b^{2})}+b+6ar^{2}}{\sqrt{(-12ac-b^{2})}-b-6ar^{2}}, \end{aligned}$$
(36)
$$\begin{aligned}&R=\frac{27b\alpha }{8a^{2}\pi ^{2}}(-b^{2}+4ac)^{\frac{5}{2}}, \end{aligned}$$
(37)
$$\begin{aligned}&S=\frac{b}{17496a^{2}\pi ^{2}\sqrt{-b^{2}-12ac}}\Big [125b^{6}\alpha +2400ab^{4}c\alpha , \nonumber \\&\qquad -\,\, 846720a^{3}c^{3}\alpha -144a^{2}(431b^{2}c^{2}\alpha \nonumber \\&\qquad +\,\,81\pi ^{2}(1+2\beta ))\Big ]. \end{aligned}$$
(38)

The degree of anisotropy is of the following form

$$\begin{aligned}&\Delta =\frac{4Q(-b-6ar^{2})(ar^{4}+br^{2}+c)}{(-3ar^{4}-br^{2}+c)^{2}} \nonumber \\&\qquad \times \Big [2P(b+2ar^{2})(-3ar^{4}-br^{2}+c) \nonumber \\&\qquad +\,\,(Q-1)(-b-6ar^{2}) \nonumber \\&\qquad +\,\, r^{2}(-3ar^{4}-br^{2}+c)(ar^{4}+br^{2}+c) \nonumber \\&\qquad \times \Big (N^{'}2R\frac{U^{'}}{U}+2S\frac{V^{'}}{V}\Big ) \nonumber \\&\qquad -\,\, \frac{-6}{Q(-b-6ar^{2})}\Big ]+8r^{2}P(b+2ar^{2})(ar^{4}+br^{2}+c) \nonumber \\&\qquad \times \left[ R\frac{U^{'}}{U}+S\frac{V^{'}}{V}\right] +4r^{2}(ar^{4}+br^{2}+c) \nonumber \\&\qquad \times \left[ R\frac{U^{''}}{U}+S\frac{V^{''}}{V}\right] \nonumber \\&\qquad +\,\,4r^{2}(ar^{4}+br^{2}+c)^{2} \nonumber \\&\qquad \times \Big [R(R-1)\left( \frac{U^{'}}{U}\right) ^{2}+S(S-1)\left( \frac{V^{'}}{V}\right) ^{2}\nonumber \\&\qquad +\,\, 4r^{2}(-3ar^{4}-br^{2}+c)\left[ R\frac{U^{'}}{U}+S\frac{V^{'}}{V}\right] \nonumber \\&\qquad +\,\,4r^{2}(ar^{4}+br^{2}+c) \nonumber \\&\qquad \times \Big [N^{''}+2RS(ar^{4}+br^{2}+c)\frac{U^{'}V^{'}}{UV}\nonumber \\&\qquad +\,\, \Big (P(b+2ar^{2})+R(ar^{4}+br^{2}+c)\frac{U^{'}}{U} \nonumber \\&\qquad +\,\, S(ar^{4}+br^{2}+c)\frac{V^{'}}{V}+(ar^{4}+br^{2}+c)N^{'}\Big )N^{'}\Big ]\nonumber \\&\qquad +\,\, 4P(2ar^{2}+b) \nonumber \\&\qquad \times \left[ r^{2}(P-1)(2ar^{2}+b)+(-3ar^{4}-br^{2}+c)\right] \nonumber \\&\qquad +\,\, 4(ar^{4}+br^{2}+c)\Big [2ar^{2}P+Q(-b-6ar^{2})\Big ]\nonumber \\&\qquad +\,\, 4(ar^{4}+br^{2}+c)(-3ar^{4}-br^{2}+c)N^{'} \nonumber \\&\qquad -\,\, 4(2ar^{2}+b)(-4ar^{4}-br^{2}+c)\nonumber \\&\qquad -16ar^{2}(ar^{4}+br^{2}+c)\nonumber \\&\qquad -\,\, 4\beta \left[ 4ar^{2}(ar^{4}+br^{2}+c)-3(2ar^{2}+b)(ar^{4}-c)\right] \nonumber \\&\qquad -\,\,\frac{8\pi \alpha }{(2\pi )^{2}} \left[ 4ar^{2}(ar^{4}+br^{2}+c)-3(2ar^{2}+b)(ar^{4}-c)\right] ^{3}.\nonumber \\ \end{aligned}$$
(39)

The line element (1) for \(n=\frac{1}{2}\) takes the form

$$\begin{aligned}&ds^{2}=-K(ar^{4}+br^{2}+c)^{2P}(-3ar^{4}-br^{2}+c)^{2(Q-1)} \nonumber \\&\qquad \quad \times \left[ U(r)\right] ^{2R} \nonumber \\&\qquad \quad \times \left[ V(r)\right] ^{2S}e^{2N(r)}dt^{2} \nonumber \\&\qquad \quad + (-3ar^{4}-br^{2}+c)^{-2} \left[ dr^{2}+r^{2}(d\theta ^{2}+sin^{2}\theta d\phi ^{2})\right] . \end{aligned}$$
(40)

This form of solution is characterized by GPEoS \(P_r =\beta \rho +\alpha \rho ^{\frac{3}{2}}\).

Table 1 Mass (m), central density \((\rho )\) and central radius \(P_{r_{0}}\) of different stars corresponding to \(\alpha =1.95\) and \(b=-10.69\)

4.3 \(n=\frac{1}{3}\)

For \(n=\frac{1}{3}\), the integration of Eq. (20) yields following expression

$$\begin{aligned} G(r)= & {} K(ar^{4}+br^{2}+c)^P \left( -3ar^{4}-br^{2}+c \right) ^Q \nonumber \\&\times e^{N(r)}[U(r)]^{R}[V(r)]^{S}, \end{aligned}$$
(41)
$$\begin{aligned}&P =\frac{3}{32a^{3}\pi ^{3}}\Big [27b^{9}\alpha -405ab^{7}c\alpha +2268a^{2}b^{5}c^{2}\alpha \nonumber \\&\qquad +\,\,5184a^{4}bc^{4}\alpha 16a^{3}(-351b^{3}c^{3}\alpha +pi^{3}(1+2\beta ))\Big ], \end{aligned}$$
(42)
$$\begin{aligned}&Q=\frac{1}{1889568a^{3}\pi ^{3}}\Big [625b^{9}\alpha +11625ab^{7}c\alpha \nonumber \\&\quad -\,\,45900a^{2}b^{5}c^{2}\alpha +51565248a^{4}bc^{4}\alpha \nonumber \\&\quad +\,\,432a^{3}(8897b^{3}c^{3}\alpha +729\pi ^{3}(1+14\beta ))\Big ], \end{aligned}$$
(43)
$$\begin{aligned}&N(r)=\frac{-r^{2}\alpha }{5511240a^{2}\pi ^{3}} \Big [-27889715b^{8}-13933920ab^{7}r^{2} \nonumber \\&\qquad -\,\,945a^{2}b^{5}r^{2}(192128c+7303ar^{4}) \nonumber \\&\qquad +\,\,105ab^{6}(-3721712c+88261ar^{4}) \nonumber \\&\qquad -\,\,3780a^{3}b^{3}r^{2}(218351c^{2}-20427acr^{4}+1113a^{2}r^{8}) \nonumber \\&\qquad +\,\,63a^{2}b^{4}(31462905c^{2}-1776470acr^{4}+85761a^{2}r^{8}) \nonumber \\&\qquad -\,\,11340a^{4}br^{2}(-137728c^{3}+25578ac^{2}r^{4} \nonumber \\&\qquad -\,\,2904a^{2}cr^{8}+135a^{3}r^{12}) \nonumber \\&\qquad +\,\,216a^{3}b^{2}(-18976160c^{3}+2148405ac^{2}r^{4} \nonumber \\&\qquad -\,\,253638a^{2}cr^{8}+13635a^{3}r^{12}) \nonumber \\&\qquad +\,\,1296a^{4}(3091760c^{4}-582400ac^{3}r^{4}+93051a^{2}c^{2}r^{8} \nonumber \\&\qquad -\,\,8370a^{3}cr^{12}+315a^{4}r^{16})\Big ], \end{aligned}$$
(44)
$$\begin{aligned}&U(r)=\frac{\sqrt{(4ac-b^{2})}+b+2ar^{2}}{\sqrt{(4ac-b^{2})}-b-2ar^{2}}, \end{aligned}$$
(45)
$$\begin{aligned}&V(r)=\frac{\sqrt{(-12ac-b^{2})}+b+6ar^{2}}{\sqrt{(-12ac-b^{2})}-b-6ar^{2}}, \end{aligned}$$
(46)
$$\begin{aligned}&R=\frac{81(b^{2}-ac)(-b^{2}+4ac)^{\frac{7}{2}}}{16a^{3}\i ^{3}}, \end{aligned}$$
(47)
$$\begin{aligned}&S=\frac{1}{4629441600a^{3}\pi ^{3}\sqrt{-b^{2}-12ac}} \nonumber \\&\qquad \Big [625b^{10}\alpha +15375ab^{8}c\alpha \nonumber \\&\qquad +12600a^{2}b^{6}c^{2}\alpha -73664640a^{4}b^{2}c^{4}\alpha \nonumber \\&\qquad -149361408a^{5}c^{5}\alpha -864a^{3}b(7106b^{3}c^{3}\alpha \nonumber \\&\qquad +729\pi ^{3}(1+2\beta ))\Big ]. \end{aligned}$$
(48)

In this case degree of anisotropy is written as

$$\begin{aligned}&\Delta =\frac{4Q(-b-6ar^{2})(ar^{4}+br^{2}+c)}{(-3ar^{4}-br^{2}+c)^{2}} \nonumber \\&\qquad \times \Big [2P(b+2ar^{2})(-3ar^{4}-br^{2}+c) \nonumber \\&\qquad +\,\,(Q-1)(-b-6ar^{2}) \nonumber \\&\qquad +\,\,r^{2}(-3ar^{4}-br^{2}+c)(ar^{4}+br^{2}+c) \nonumber \\&\qquad \times \left( N^{'}2R\frac{U^{'}}{U}+2S\frac{V^{'}}{V}\right) \nonumber \\&\qquad - \,\,\frac{-6}{Q(-b-6ar^{2})}\Big ] \nonumber \\&\qquad +\,\,8r^{2}P(b+2ar^{2})(ar^{4}+br^{2}+c) \nonumber \\&\qquad \times \Big [R\frac{U^{'}}{U}+S\frac{V^{'}}{V}\Big ]+4r^{2}(ar^{4}+br^{2}+c) \nonumber \\&\qquad \times \Big [R\frac{U^{''}}{U}+S\frac{V^{''}}{V}\Big ] +\,\,4r^{2}(ar^{4}+br^{2}+c)^{2} \nonumber \\&\qquad \times \Big [R(R-1)\Big (\frac{U^{'}}{U}\Big )^{2}+S(S-1)\Big (\frac{V^{'}}{V}\Big )^{2} \nonumber \\&\qquad +\,\,4r^{2}(-3ar^{4}-br^{2}+c)\Big [R\frac{U^{'}}{U}+S\frac{V^{'}}{V}\Big ] \nonumber \\&\qquad +\,\,4r^{2}(ar^{4}+br^{2}+c) \nonumber \\&\qquad \times \Big [N^{''}+2RS(ar^{4}+br^{2}+c)\frac{U^{'}V^{'}}{UV} \nonumber \\&\qquad +\,\, \Big (P(b+2ar^{2})+R(ar^{4}+br^{2}+c)\frac{U^{'}}{U} \nonumber \\&\qquad +\,\, S(ar^{4}+br^{2}+c)\frac{V^{'}}{V}+(ar^{4}+br^{2}+c)N^{'}\Big )N^{'}\Big ] \nonumber \\&\qquad +\,\,4P(2ar^{2}+b) \nonumber \\&\qquad \left[ r^{2}(P-1)(2ar^{2}+b)+(-3ar^{4}-br^{2}+c)\right] \nonumber \\&\qquad +\,\,4(ar^{4}+br^{2}+c)\Big [2ar^{2}P+Q(-b-6ar^{2})\Big ] \nonumber \\&\qquad +\,\,4(ar^{4}+br^{2}+c)(-3ar^{4}-br^{2}+c)N^{'} \nonumber \\&\qquad -\,\,4(2ar^{2}+b)(-4ar^{4}-br^{2}+c)\nonumber \\&\qquad -16ar^{2}(ar^{4}+br^{2}+C) \nonumber \\&\qquad -\,\,4\beta \left[ 4ar^{2}(ar^{4}+br^{2}+c)-3(2ar^{2}+b)(ar^{4}-c)\right] \nonumber \\&\qquad -\,\,\frac{8\pi \alpha }{(2\pi )^{2}}\left[ 4ar^{2}(ar^{4}+br^{2}+c)-3(2ar^{2}+b)(ar^{4}-c)\right] ^{4}.\nonumber \\ \end{aligned}$$
(49)

The metric (1) becomes

$$\begin{aligned}&ds^{2}=-K(ar^{4}+br^{2}+c)^{2P} \left( -3ar^{4}-br^{2}+c \right) ^{2(Q-1)} \nonumber \\&\qquad \times \left[ U(r)\right] ^{2R}\left[ V(r)\right] ^{2S}e^{2N(r)}dt^{2} \nonumber \\&\qquad +(-3ar^{4}-br^{2}+c)^{-2} \nonumber \\&\qquad \times \left[ dr^{2}+r^{2}(d\theta ^{2}+sin^{2}\theta d\phi ^{2})\right] . \end{aligned}$$
(50)

This form of solution is characterized by GPEoS \(P_r =\beta \rho +\alpha \rho ^{\frac{4}{3}}\).

5 Properties of solutions

In previous section, we presented the line element, anisotropy and solution of the gravitational system for three different values of polytropic index. We will discuss the physical properties of the model for \(n=1\) as its less complicated. For considered value of polytropic index the radial pressure takes the form

$$\begin{aligned} p_{r}=\beta \rho +\alpha \rho ^{2}, \end{aligned}$$
(51)

which is of degree 2 and energy density has the form

$$\begin{aligned} 8\pi \rho = \left[ 12bc+40acr^{2}+4abr^{4}-8a^{2}r^{6}\right] . \end{aligned}$$
(52)

Using Eq. (52) in Eq. (51), we obtain the expression for radial pressure

$$\begin{aligned} P_{r}= & {} \frac{\beta }{2\pi }\Big (3bc+10acr^{2}+abr^{4}-2a^{2}r^{6}\Big ) \nonumber \\&+\frac{\alpha }{(2\pi )^{2}}\Big (3bc+10acr^{2}+abr^{4}-2a^{2}r^{6}\Big )^{2}, \end{aligned}$$
(53)

and expression for m(r) becomes

$$\begin{aligned} m(r)=\Big (4acr^{5}-\frac{4}{9}a^2 r^{9}+2bcr^{3}+\frac{2}{7}a b r^7\Big ), \end{aligned}$$
(54)

all the above quantities are well behaved. The energy density \((\rho )\) and central radial pressure \((P_{{r}_{0}})\) can be written as

$$\begin{aligned} \rho _{0}= & {} \frac{3bc}{2\pi }, \end{aligned}$$
(55)
$$\begin{aligned} P_{r_{0}}= & {} \beta \Big (\frac{3bc}{2\pi }\Big )+\alpha \Big (\frac{3bc}{2\pi }\Big )^{2}. \end{aligned}$$
(56)

The speed of sound is defined as

$$\begin{aligned} \upsilon ^{2}=\frac{dp_{r}}{d\rho }. \end{aligned}$$
(57)

For physically viability, we have the restrictions \(\upsilon \le 1\) and radial pressure must be zero at boundary. For \(r=1\), we obtain the relation

$$\begin{aligned} \beta =\frac{-\alpha (3bc+10acr^{2}+abr^{4}-2a^{2}r^{6})}{2\pi }. \end{aligned}$$
(58)

The numerical values of all model parameters for five different stars are given in Table 1. We have generated masses of five different stars by varying parameters \(\beta \), a and c, which are mentioned in column 1, 2 and 3 of Table 1. The acceptable values for \(\rho _{0}\) and \(P_{r_{0}}\) are also given in Table 1.

Table 2 Energy density \((\rho )\), radial pressure \((P_{r})\) and mass (m) variation from center to boundary of realistic star 4U 1820-30
Fig. 1
figure 1

Energy density for \(r=1\) and \(\alpha =1.95\) and \(b=-10.69\)

Fig. 2
figure 2

Radial pressure for \(r=1\) and \(\alpha =1.95\) and \(b=-10.69\)

By choosing \(\alpha =1.95\) and \(b=-10.69\), we regained mass \(1.58 M_{\bigodot }\) for star \(4U 1820-30\). Table 2 contains varying values of \(\rho \), \(P_{r}\), M and \(\frac{dP_{r}}{d\rho }\) from center of star to its boundary. Graphical analysis shows that density, radial pressure and speed of sound are decreasing functions of r, while mass function is increasing. Graphs clearly shows that all quantities are well behaved and physically acceptable (Figs. 1, 2, 3, 4).

Fig. 3
figure 3

Mass function for \(r=1\) and \(\alpha =1.95\) and \(b=-10.69\)

Fig. 4
figure 4

speed of sound for \(r=1\) and \(\alpha =1.95\) and \(b=-10.69\)

6 Conclusion and discussion

In this work, we have established new polytropic models to the EFEs by utilizing GPEoS, which may be used to model anisotropic relativistic compact objects. We calculated the exact solutions to EFEs with the help of isotropic coordinates have been used which makes the system as much euclidian as possible. In isotropic coordinates all spatial coordinates are treated as same, isotropic coordinates are helpful in modeling of such objects whose gravity has symmetries and does not distinguish between x, y and z coordinates. We have made specific choice for gravitational potential \(L=ax^{2}+bx+c\) to integrate the field equations with GPEoS (\(P_{r}=\beta \rho +\alpha \rho ^{1+\frac{1}{n}}\)), for different values of model parameters, “a”, “b” and “c”. The parametric values along with gravitational potential are chosen in a way that our model remains physically viable and no singularity is observed at any stage. For the selected values of parameters, energy density \((\rho )\) and radial pressure \(P_{r}\) remains positive inside the star, radial pressure \((P_{r})\) should vanishes at the boundary of star, degree of anisotropy \((\Delta )\) was chosen so that gradient pressure \(\left( \frac{dp_{r}}{dr}\right) \) should be less then zero, for \(r=0\), \(\Delta \) must be zero, at the center of star central density \((\rho _{c})\) must be finite, metric quantities A(r) and B(r) remains positive and non-singular inside the star.

For the acceptance of any model its stability analysis is the most important factor. To check stability of any model energy conditions plays a vital role. With the help of energy conditions one can check the stability of model without polytropic EoS. Table 2 in our work contain values of energy density \((\rho )\) and radial pressure \((P_{r})\) which satisfies energy conditions and make our system physically acceptable. A number of techniques are present in the literature for stability analysis of models, we have used speed of sound as a criteria to check stability of our model. The speed of sound remains positive inside the star for the corresponding values of parameters we have used.

It is important to mention that we have regained the masses of five stars PSR J1614-2230, Vela X-1, Vela 4U, PSR J1903+327 and 4U 1820-30 as mentioned in Table 1. We have generally demonstrated the behavior of compact objects by plotting there graphs for \(r=1\), graphs of energy density, radial pressure, mass function and speed of sound were plotted for unit radius, energy density \(\rho \) and radial pressure \(P_{r}\) remains positive and monotonically decreasing inside the star and becomes zero at the surface of the star which satisfies the basic requirements condition of stability. Mass function m increases for increasing r while speed of sound decreases and vanishes at the boundary of star. Graphs were clearly representing that all the models are well behaved and physically viable.