1 Introduction

With the rapid development of nonlinear science,various kinds of analytical methods were used to handle nonlinear problems, such as the homotopy perturbation method (He 1999, 2002, 2004, 2009, 2014; Anjum and He 2020a, b; Yu et al. 2019; Anjum et al. 2019; Ren et al. 2019; He and El-Dib 2020a, b, 2021), variational iteration method (He 1999, 2007, 2011, 2012a, b; He and Wu 2007; Anjum and He 2019; Liu et al. 2021), Taylor series method (He and Ji 2019; He 2019a, 2020a; He et al. 2020), Exp-function method (He and Wu 2006; He 2013; He et al. 2021), and variational-based methods (He 2020b, 2021; He and Ain 2020; Wu 2021; Wang and Wei 2021). Recently, there have been some reasearch results in the field of differential equations, for example, in Wang et al. (2020), the ZIR of the fractal RC circuit are modeled by LFD,where the transient local fractional ordinary differential equation is obtained with aid of the law of switch and Kirchhoff Voltage Laws. In Cao and Dai (2021), Dai and Wang (2020), Liu et al. (2020), Yu et al. (2020), Wu et al. (2020), new methods are presented to find traveling wave solutions of PDEs. In addition,the author has done some work on nonlinear problems, e.g. exact solutions (Tian 2019a, b, 2016) and numerical solutions (Tian 2018; Tian and Yan 2016) of integral and differential equations.

Each method has its advantages and disadvantages. For example, the Taylor series method is simple, but it is low convergence hinders its wide applications.The Exp-function method can lead to the analytical solutions, but its complex calculation makes those inaccessible who are not familiar some mathematics software. The variational-based methods can obtain a globally valid solution, however, it is extremely difficult to establish a needed variational principle for a complex nonlinear problem, etc..

The variational principle play a important role in nonlinear science,especially for differential equations. For example, it can provides the conservation laws in an energy form, and reveals the possible solution structures of PDEs (He 2019b). In this paper, the semi-inverse method (He 2003a, b) is used to search variational principle of differential equations, then the Ritz method is effectively and conveniently used. In this process, it may be difficult to solve a large system of algebraic equations,the Groebner bases theory (Buchberger’s algorithm) is applied to solve this problem.

The rest of this paper is organized as follows. In Sect. 2, we briefly review the basic Groebner Bases theory. In Sect. 3, Variational approach to some boundary value problems are studied. In Sect. 4, He’s semi-inverse method is applied to solve some nonlinear problems. In Sect. 5, we conclude this paper and some discussions are also given there.

2 Groebner Bases

In the following, we list the basic results of Groebner Bases theory (Cox et al. 2007).

Definition 1

A subset \(I\subset k[x_{1},\ldots ,x_{n}]\) is an ideal if it satisfies:

  1. (i)

    \(0\in I.\)

  2. (ii)

    If \(f,g\in I\),then \(f+g\in I.\)

  3. (iii)

    If \(f\in I\),and \(h\in k[x_{1},\ldots ,x_{n}]\),then \(hf\in I.\)

Definition 2

Let \(f_{1},\ldots ,f_{s}\) be polynomials in \(k[x_{1},\ldots ,x_{n}]\). Then we set

$$\begin{aligned} \langle f_{1},\ldots ,f_{s}\rangle =\left\{ \sum _{i=1}^{s}h_{i}f_{i}:h_{1},\ldots ,h_{s}\in k[x_{1},\ldots ,x_{n}]\right\} . \end{aligned}$$

The crucial fact is that \(\langle f_{1},\ldots ,f_{s}\rangle \) is an ideal.

Definition 3

We will write \({\overline{f}}^{F}\) for the remainder on division of f by the ordered s-tuple \(F=(f_{1},\ldots ,f_{s})\). If F is a Groebner basis for \((f_{1},\ldots ,f_{s})\),then we can regard F as a set (without any particular order) by Proposition I.

Definition 4

Let \(I\subset k[x_{1},\ldots ,x_{n}]\) be an ideal. We will denote by \(\mathbf{V }(I)\) the set

$$\begin{aligned} \mathbf{V }(I)=\{(a_{1},\ldots ,a_{n})\in k^{n}:f(a_{1},\ldots ,a_{n})=0 \text{ for } \text{ all }f\in I\}. \end{aligned}$$

Definition 5

(Lexicographic Order) Let \(\alpha =(\alpha _{1},\ldots ,\alpha _{n})\) and \(\beta =(\beta _{1},\ldots ,\beta _{n})\in Z_{\ge 0}^{n}.\) We say \(\alpha >_{lex}\beta \) if, in the vector difference \(\alpha -\beta \in Z^{n}\), the leftmost nonzero entry is positive. we will write \(x^{\alpha }>_{lex}x^{\beta }\) if \(\alpha >_{lex}\beta \).

Theorem 1

(Buchberger’s Algorithm) Let \(I=\langle f_{1},\ldots ,f_{s}\rangle \ne {0}\) be a polynomial ideal. Then a Groebner basis for I can be constructed in a finite number of steps by the following algorithm:

Input: \(F=(f_{1},\ldots ,f_{s})\)

Output: a Groebner basis \(G=(g_{1},\ldots ,g_{t})\) for I, with \(F\subset G\)

\(G:=F\)

REPEAT

           \(G':=G\)

           FOR each pair \(\{p,q\},p\ne q\) in \(G'\) DO

                  \(S:=\overline{S(p,q)}^{G'}\)

                  IF \(S:\ne 0\) THEN \(G:=G\cup \{S\}\)

UNTIL \(G=G'\)

3 Variational approach to the boundary value problems

3.1 ODEs boundary value problems

Example 1

Consider the following ODE (Lao 2015):

$$\begin{aligned} y^{''}+y=2x, \end{aligned}$$
(1)

with the boundary conditions

$$\begin{aligned} y(0)=0,y(1)=0, \end{aligned}$$
(2)

where \(y'\) is the differentiation with respect to x.

By the semi-inverse method, the variational principle of Eq. (1) reads

$$\begin{aligned} J(y)=\int _{0}^{1}\left\{ -\frac{1}{2}(y')^2+\frac{1}{2} y^2-2xy\right\} dx, \end{aligned}$$
(3)

applying Ritz’s method, we choose a trial function satisfying all the boundary conditions.

$$\begin{aligned} \varphi _{n}=x^{n}(x-1)(n=1,2,\ldots ), \end{aligned}$$
(4)

the approximate solution can be expressed as

$$\begin{aligned} y_{n}(x)=\sum _{i=1}^{n}a_{i}\varphi _{i}=\sum _{i=1}^{n}a_{i}x^{i}(x-1). \end{aligned}$$
(5)

Case 1. \(n=1\).

$$\begin{aligned} y_{1}=a x (x-1), \end{aligned}$$
(6)

where a is a unknown constant to be further determined.

Substituting (6) into (3) yields

$$\begin{aligned} J_{n=1}=\frac{a}{6}-\frac{3 a^2}{20}, \end{aligned}$$
(7)

making \(J_{n=1}\) stationary with respect to a results in

$$\begin{aligned} \frac{\partial J_{n=1}}{\partial a}=\frac{1}{6}-\frac{3 a}{10}=0, \end{aligned}$$
(8)

we have \(a=\frac{5}{9}\), and the first-order approximate solution of Eq. (1) is

$$\begin{aligned} y_{1}=\frac{5}{9}x(x-1). \end{aligned}$$
(9)

Case 2. \(n=2\).

$$\begin{aligned} y_{2}=a x (x-1)+b x^2 (x-1), \end{aligned}$$
(10)

where ab are unknown constants to be determined.

Substituting (10) into (3) yields

$$\begin{aligned} J_{n=2}=-\frac{3 a^2}{20}-\frac{3 a b}{20}+\frac{a}{6}-\frac{13 b^2}{210}+\frac{b}{10}, \end{aligned}$$
(11)

making \(J_{n=2}\) stationary with respect to ab results in

$$\begin{aligned} -\frac{3 a}{10}-\frac{3 b}{20}+\frac{1}{6}=0, \end{aligned}$$
(12)
$$\begin{aligned} -\frac{3 a}{20}-\frac{13 b}{105}+\frac{1}{10}=0, \end{aligned}$$
(13)

we have \(a=\frac{142}{369},b=\frac{14}{41}\), and the second-order approximate solution of Eq. (1) is

$$\begin{aligned} y_{2}=\frac{142}{369} x (x-1)+\frac{14}{41} x^2 (x-1). \end{aligned}$$
(14)

Case 3. \(n=3\).

$$\begin{aligned} y_{1}=a x (x-1)+b x^2 (x-1)+c x^3 (x-1), \end{aligned}$$
(15)

where abc are unknown constants to be determined.

Substituting (15) into (3) yields

$$\begin{aligned} J_{n=3}=-\frac{3 a^2}{20}-\frac{3 a b}{20}-\frac{19 a c}{210}+\frac{a}{6}-\frac{13 b^2}{210}-\frac{79 b c}{840}+\frac{b}{10}-\frac{103 c^2}{2520}+\frac{c}{15},\nonumber \\ \end{aligned}$$
(16)

making \(J_{n=3}\) stationary with respect to abc results in

$$\begin{aligned} \left\{ \begin{array}{lll} -\frac{3 a}{10}-\frac{3 b}{20}-\frac{19 c}{210}+\frac{1}{6}=0,\\ -\frac{3 a}{20}-\frac{13 b}{105}-\frac{79 c}{840}+\frac{1}{10}=0,\\ -\frac{19 a}{210}-\frac{79 b}{840}-\frac{103 c}{1260}+\frac{1}{15}=0, \end{array} \right. \end{aligned}$$
(17)

Equation (17) sometimes is large and difficult to be solved by hand, even by software,such as MAPLE and MATLAB. In this paper,we use Buchberger’s algorithm to solve this problem.

Let I be the ideal

$$\begin{aligned} I= & {} \left\langle -\frac{3 a}{10}-\frac{3 b}{20}-\frac{19 c}{210}+\frac{1}{6}, -\frac{3 a}{20}-\frac{13 b}{105}-\frac{79 c}{840}+\frac{1}{10},\right. \nonumber \\&\left. -\frac{19 a}{210}-\frac{79 b}{840}-\frac{103 c}{1260}+\frac{1}{15}\right\rangle \subset k[a,b,c], \end{aligned}$$
(18)

corresponding to the original system of Eq. (17), and we want to find all points in \(\mathbf{V } (I)\).

Using Buchberger’s algorithm with the lex order \(a>b>c\),we find a Groebner basis:

$$\begin{aligned} g_{1}= & {} 299 c+14, \end{aligned}$$
(19)
$$\begin{aligned} g_{2}= & {} 12259 b-4760, \end{aligned}$$
(20)
$$\begin{aligned} g_{3}= & {} 36777 a-13811, \end{aligned}$$
(21)

thus,there are three solutions altogether of \(g_{1}=g_{2}=g_{3}=0\), which are

$$\begin{aligned} a=\frac{13811}{36777},b=\frac{4760}{12259},c= -\frac{14}{299}, \end{aligned}$$
(22)

since \(\mathbf{V } (I)=\mathbf{V } (g_{1},g_{2},g_{3})\),we have found all solutions of the original equations (17), and the third-order approximate solution of Eq. (1) is

$$\begin{aligned} y_{3}=\frac{13811}{36777} x (x-1)+\frac{4760}{12259} x^2 (x-1)-\frac{14}{299} x^3 (x-1). \end{aligned}$$
(23)

Example 2

Consider the following example (He 2003b):

$$\begin{aligned} y^{(vi)}(x)=-6e^{x}+y(x),0<x<1, \end{aligned}$$
(24)

subject to the boundary conditions

$$\begin{aligned} y(0)=1,y''(0)=-1,y^{(iv)}(0)=-3, \end{aligned}$$
(25)
$$\begin{aligned} y(1)=0,y''(1)=-2e,y^{(iv)}(1)=-4e. \end{aligned}$$
(26)

By the semi-inverse method,the variational principle of Eq. (24) reads

$$\begin{aligned} J(y)=\int _{0}^{1}\left\{ \frac{1}{2}(y''')^2-6e^{x}y+\frac{1}{2}y^{2}\right\} dx, \end{aligned}$$
(27)

applying Ritz’s method, we choose a trial function

$$\begin{aligned} \varphi _{n}=x^{n}(x-1)(n=1,2,\ldots ), \end{aligned}$$
(28)

the approximate solution can be expressed as

$$\begin{aligned} y_{n}(x)=\sum _{i=1}^{n}a_{i}\varphi _{i}=\sum _{i=1}^{n}a_{i}x^{i}(x-1). \end{aligned}$$
(29)

Case 1. \(n=1.\)

$$\begin{aligned} y_{1}=a x (x-1), \end{aligned}$$
(30)

where a is a unknown constant to be further determined.

Substituting (30) into (27) yields

$$\begin{aligned} J_{n=1}=\frac{1}{60} a (a-360 (e-3)), \end{aligned}$$
(31)

making \(J_{n=1}\) stationary with respect to a results in

$$\begin{aligned} \frac{\partial J_{n=1}}{\partial a}=\frac{a}{60}+\frac{1}{60} (a-360 (e-3))=0, \end{aligned}$$
(32)

we have \(a=180 (e-3)\), and the first-order approximate solution of Eq. (24) is

$$\begin{aligned} y_{1}=180 (e-3)x(x-1). \end{aligned}$$
(33)

Case 2. \(n=2.\)

$$\begin{aligned} y_{2}=a x (x-1)+b x^2 (x-1), \end{aligned}$$
(34)

where ab are unknown constants to be determined.

Substituting (34) into (27) yields

$$\begin{aligned} J_{n=2}=\frac{1}{420} \left( 7 a^2+7 a b-2520 ((e-3) a+(8-3 e) b)+7562 b^2\right) , \end{aligned}$$
(35)

making \(J_{n=2}\) stationary with respect to ab results in

$$\begin{aligned} \frac{1}{420} (14 a+7 b-2520 (e-3))=0, \end{aligned}$$
(36)
$$\begin{aligned} \frac{1}{420} (7 a+15124 b-2520 (8-3 e))=0, \end{aligned}$$
(37)

we have

$$\begin{aligned} a=\frac{360 (15145 e-45428)}{30241}, b=-\frac{2520 (7 e-19)}{30241}, \end{aligned}$$
(38)

and the second-order approximate solution of Eq. (24) is

$$\begin{aligned} y_{2}=\frac{360 (15145 e-45428)}{30241} x (x-1)-\frac{2520 (7 e-19)}{30241} x^2 (x-1). \end{aligned}$$
(39)

Case 3. \(n=3.\)

$$\begin{aligned} y_{3}=a x (x-1)+b x^2 (x-1)+c x^3 (x-1), \end{aligned}$$
(40)

where abc are unknown constants to be determined.

Substituting (40) into (27) yields

$$\begin{aligned} J_{n=3}= & {} \frac{42 a^2-15120 ((e-3) a+(8-3 e) b+(11 e-30) c)}{2520} \nonumber \\&+\frac{42 a b+24 a c+45372 b^2+90735 b c+105845 c^2}{2520}, \end{aligned}$$
(41)

making \(J_{n=3}\) stationary with respect to abc results in

$$\begin{aligned} \left\{ \begin{array}{lll} \frac{84 a+42 b+24 c-15120 (e-3)}{2520}=0,\\ \frac{42 a+90744 b+90735 c-15120 (8-3 e)}{2520}=0,\\ \frac{24 a+90735 b+211690 c-15120 (11 e-30)}{2520}=0, \end{array} \right. \end{aligned}$$
(42)

Let I be the ideal

$$\begin{aligned} I= & {} \left\langle \frac{84 a+42 b+24 c-15120 (e-3)}{2520}, \frac{42 a+90744 b+90735 c-15120 (8-3 e)}{2520},\right. \nonumber \\&\left. \frac{24 a+90735 b+211690 c-15120 (11 e-30)}{2520}\right\rangle \subset k[a,b,c], \end{aligned}$$
(43)

corresponding to the system of Eq. (42).

Using Buchberger’s algorithm with the lex order \(a>b>c\),we find a Groebner basis:

$$\begin{aligned} g_{1}= & {} 846721 c-1504440 e+4089960, \end{aligned}$$
(44)
$$\begin{aligned} g_{2}= & {} -25605689761 b-60431928480 e+164225481840, \end{aligned}$$
(45)
$$\begin{aligned} g_{3}= & {} -25605689761 a+4626241329780 e-13873846788900, \end{aligned}$$
(46)

thus,

$$\begin{aligned} \mathbf{V } (I)= & {} \mathbf{V } (g_{1},g_{2},g_{3})= \left\{ a=\frac{1260 (3671620103 e-11010989515)}{25605689761},\right. \nonumber \\&\left. b=-\frac{5040 (11990462 e-32584421)}{25605689761}, c=\frac{7560 (199 e-541)}{846721}\right\} \end{aligned}$$
(47)

and the third-order approximate solution of Eq. (24) is

$$\begin{aligned} y_{3}= & {} \frac{1260 (3671620103 e-11010989515)}{25605689761} x (x-1)\nonumber \\&- \frac{5040 (11990462 e-32584421)}{25605689761} x^2 (x-1)+\frac{7560 (199 e-541)}{846721} x^3 (x-1).\nonumber \\ \end{aligned}$$
(48)

Remark 1

The solutions of Eq. (24) we obtained are not presented in (He 2003b).

3.2 PDEs boundary value problems

Example 3

Consider the following elliptic equation:

$$\begin{aligned} -u_{xx}-u_{tt}+u=x^2+t^2,x\in [0,1]\times [0,1] \end{aligned}$$
(49)

subject to the boundary conditions

$$\begin{aligned} u(x,0)=u(x,1)=u(0,t)=u(1,t)=0, \end{aligned}$$
(50)

By the semi-inverse method,the variational principle of Eq. (49) reads

$$\begin{aligned} J(x,t)=\int _{0}^{1}\int _{0}^{1}\left\{ \frac{1}{2}u_{x}^2+ \frac{1}{2}u_{t}^2+\frac{1}{2}u^2-u(x^2+t^2)\right\} dxdt, \end{aligned}$$
(51)

applying Ritz’s method, we choose a trial function satisfying all the boundary conditions.

$$\begin{aligned} \varphi _{n}=x^{n}(x-1)t(t-1)(n=1,2,\ldots ), \end{aligned}$$
(52)

the approximate solution can be expressed as

$$\begin{aligned} u_{n}(x,t)=\sum _{i=1}^{n}a_{i}\varphi _{i}=\sum _{i=1}^{n}a_{i}x^{i}(x-1)t(t-1). \end{aligned}$$
(53)

Case 1. \(n=1.\)

$$\begin{aligned} u_{1}=a x (x-1)t(t-1), \end{aligned}$$
(54)

where a is a unknown constant to be further determined.

Substituting (54) into (51) yields

$$\begin{aligned} J_{n=1}=\frac{1}{600} a (7 a-10), \end{aligned}$$
(55)

making \(J_{n=1}\) stationary with respect to a results in

$$\begin{aligned} \frac{\partial J_{n=1}}{\partial a}=\frac{7 a}{600}+\frac{1}{600} (7 a-10)=0, \end{aligned}$$
(56)

we have \(a=\frac{5}{7}\), and the first-order approximate solution of Eq. (49) is

$$\begin{aligned} u_{1}=\frac{5}{7} x (x-1)t(t-1). \end{aligned}$$
(57)

Case 2. \(n=2.\)

$$\begin{aligned} u_{2}=a x (x-1)t(t-1)+b x^2 (x-1)t(t-1), \end{aligned}$$
(58)

where ab are unknown constants to be determined.

Substituting (58) into (51) yields

$$\begin{aligned} J_{n=2}=\frac{294 a^2+42 a (7 b-10)+5 b (20 b-49)}{25200}, \end{aligned}$$
(59)

making \(J_{n=2}\) stationary with respect to ab results in

$$\begin{aligned} \frac{588 a+42 (7 b-10)}{25200}=0, \end{aligned}$$
(60)
$$\begin{aligned} \frac{294 a+100 b+5 (20 b-49)}{25200}=0, \end{aligned}$$
(61)

we have \(a=\frac{285}{742},b=\frac{35}{53}\), and the second-order approximate solution of Eq. (49) is

$$\begin{aligned} u_{2}=\frac{285}{742} x (x-1)t(t-1)+\frac{35}{53} x^2 (x-1)t(t-1). \end{aligned}$$
(62)

Case 3. \(n=3.\)

$$\begin{aligned} u_{3}=a x (x-1)t(t-1)+b x^2 (x-1)t(t-1)+c x^3 (x-1)t(t-1), \end{aligned}$$
(63)

where abc are unknown constants to be determined.

Substituting (63) into (51) yields

$$\begin{aligned} J_{n=3}=\frac{882 a^2+6 a (147 b+86 c-210)+300 b^2+b (417 c-735)+163 (c-3) c}{75600},\nonumber \\ \end{aligned}$$
(64)

making \(J_{n=3}\) stationary with respect to abc results in

$$\begin{aligned} \left\{ \begin{array}{lll} \frac{1764 a+6 (147 b+86 c-210)}{75600}=0,\\ \frac{882 a+600 b+417 c-735}{75600}=0,\\ \frac{516 a+417 b+163 (c-3)+163 c}{75600}=0, \end{array} \right. \end{aligned}$$
(65)

Let I be the ideal

$$\begin{aligned} I= & {} \left\langle \frac{1764 a+6 (147 b+86 c-210)}{75600}, \frac{882 a+600 b+417 c-735}{75600},\right. \nonumber \\&\left. \frac{516 a+417 b+163 (c-3)+163 c}{75600}\right\rangle \subset k[a,b,c], \end{aligned}$$
(66)

corresponding to the system of Eq. (65).

Using Buchberger’s algorithm with the lex order \(a>b>c\), we find a Groebner basis:

$$\begin{aligned} g_{1}= & {} 787 c-756, \end{aligned}$$
(67)
$$\begin{aligned} g_{2}= & {} 41711 b+12523, \end{aligned}$$
(68)
$$\begin{aligned} g_{3}= & {} 83422 a-48669, \end{aligned}$$
(69)

thus,

$$\begin{aligned} \mathbf{V }(I)=\mathbf{V } (g_{1},g_{2},g_{3})=\left\{ a=\frac{48669}{83422},b= -\frac{12523}{41711},c=\frac{756}{787}\right\} , \end{aligned}$$
(70)

and the third-order approximate solution of Eq. (49) is

$$\begin{aligned} u_{3}=\frac{48669}{83422} x (x-1)t(t-1)-\frac{12523}{41711} x^2 (x-1)t(t-1)+\frac{756}{787} x^3 (x-1)t(t-1).\nonumber \\ \end{aligned}$$
(71)

4 He’s semi-inverse method

For a given nonlinear partial differential equation

$$\begin{aligned} R(u,u_{x},u_{t},u_{xx},u_{xt},u_{tt},\ldots )=0, \end{aligned}$$
(72)

the main steps of this method are as follows (Elboree 2015; Najafi and Arbabi 2016):

Step 1. seek solitary solutions of Eq. (72) by taking \(u(x,t)=u(\xi ),\xi =x-ct\),and transform Eq. (72) to the ordinary differential equation

$$\begin{aligned} S(u,u',u'',\ldots )=0, \end{aligned}$$
(73)

where prime denotes the derivative with respect to \(\xi \).

Step 2. If possible,integrate Eq. (73) term by term one or more times, for simplicity, the integration constants set to zero.

Step 3. According to He’s semi-inverse method, we construct the following trial-functional

$$\begin{aligned} J(u)=\int L d\xi , \end{aligned}$$
(74)

where L is a Lagrangian for Eq. (73).

Step 4. By the Ritz method, we can obtain different forms of solitary wave solutions, such as \(u(\xi )=A\cdot sech(B\xi ),u(\xi )=A\cdot csch(B\xi ),u(\xi )=A\cdot tanh(B\xi ),u(\xi )=A\cdot coth(B\xi )\) and so on.In this paper, we search a solitary wave solution in the form

$$\begin{aligned} u(\xi )=A\cdot sech(B\xi ), \end{aligned}$$
(75)

where A and B are constants to be further determined.

Substituting Eq. (75) into Eq. (74) and making J stationary with respect to A and B results in

$$\begin{aligned} \displaystyle \frac{\partial J}{\partial A}=0, \end{aligned}$$
(76)
$$\begin{aligned} \displaystyle \frac{\partial J}{\partial B}=0, \end{aligned}$$
(77)

solving simultaneously Eqs. (76) and (77), we obtain A and B. Hence, the solitary wave solution Eq. (75) is well determined.

4.1 The PHi-4 equation

The PHi-4 equation play an important role in nuclear and particle physics over the decades. Let us consider the Phi-4 equation in the form (Akter and Akbar 2015):

$$\begin{aligned} u_{tt}-u_{xx}+m^{2}u+\lambda u^{3}=0, \end{aligned}$$
(78)

where m and \(\lambda \) are real valued constants.

Using the traveling wave variable \(\xi =x-ct\), Eq. (78) is transformed into the following ODE:

$$\begin{aligned} (c^{2}-1)u''+m^{2}u+\lambda u^{3}=0, \end{aligned}$$
(79)

by He’s semi-inverse method,we can obtain the following variational formulation:

$$\begin{aligned} J(u)=\int _{0}^{\infty }\left[ \frac{(1-c^2)}{2}(u')^2+ \frac{m^{2}}{2}u^2+\frac{\lambda }{4}u^4\right] d\xi . \end{aligned}$$
(80)

Case A: we search for a soliton solution in the form

$$\begin{aligned} u(\xi )=A\cdot sech(\xi ), \end{aligned}$$
(81)

by substituting (81) into (80), we obtain

$$\begin{aligned} J=\frac{1}{6} A^2 \left( A^2 \lambda -c^2+3 m^2+1\right) , \end{aligned}$$
(82)

to find the constant A,we need to solve the following equation:

$$\begin{aligned} \frac{\partial J}{\partial A}=\frac{A^3 \lambda }{3}+ \frac{1}{3} A \left( A^2 \lambda -c^2+3 m^2+1\right) =0, \end{aligned}$$
(83)

form Eq. (83),we obtain

$$\begin{aligned} A= \pm \frac{\sqrt{c^2-3 m^2-1}}{\sqrt{2} \sqrt{\lambda }}, \end{aligned}$$
(84)

therefore,the solitary wave solutions to the PHi-4 equations are constructed as follows:

$$\begin{aligned} u(x,t)=\pm \frac{\sqrt{c^2-3 m^2-1}}{\sqrt{2} \sqrt{\lambda }}\cdot sech(x-ct). \end{aligned}$$
(85)

Case B: we search for a soliton solution in the form

$$\begin{aligned} u(\xi )=A\cdot sech^2(\xi ), \end{aligned}$$
(86)

by substituting (86) into (80), we obtain

$$\begin{aligned} J=\frac{1}{105} A^2 \left( 12 A^2 \lambda -28 c^2+35 m^2+28\right) , \end{aligned}$$
(87)

to find the constant A,we need to solve the following equation:

$$\begin{aligned} \frac{\partial J}{\partial A}=\frac{8 A^3 \lambda }{35}+\frac{2}{105} A \left( 12 A^2 \lambda -28 c^2+35 m^2+28\right) =0, \end{aligned}$$
(88)

form Eq. (88),we obtain

$$\begin{aligned} A= \pm \frac{\sqrt{\frac{7}{6}} \sqrt{4 c^2-5 m^2-4}}{2 \sqrt{\lambda }}, \end{aligned}$$
(89)

therefore,the solitary wave solutions to the PHi-4 equations are:

$$\begin{aligned} u(x,t)=\pm \frac{\sqrt{\frac{7}{6}} \sqrt{4 c^2-5 m^2-4}}{2 \sqrt{\lambda }}\cdot sech^2(x-ct). \end{aligned}$$
(90)

By a similar manipulation,we have:

$$\begin{aligned} u(x,t)=\pm \frac{\sqrt{\frac{33}{10}} \sqrt{9 c^2-7 m^2-9}}{4 \sqrt{\lambda }}\cdot sech^3(x-ct), \end{aligned}$$
(91)
$$\begin{aligned} u(x,t)=\pm \frac{\sqrt{\frac{143}{14}} \sqrt{16 c^2-9 m^2-16}}{8 \sqrt{\lambda }}\cdot sech^4(x-ct), \end{aligned}$$
(92)
$$\begin{aligned} u(x,t)=\pm \frac{\sqrt{\frac{4199}{14}} \sqrt{25 c^2-11 m^2-25}}{48 \sqrt{\lambda }}\cdot sech^5(x-ct), \end{aligned}$$
(93)
$$\begin{aligned} u(x,t)=\pm \frac{\sqrt{\frac{7429}{66}} \sqrt{36 c^2-13 m^2-36}}{32 \sqrt{\lambda }}\cdot sech^6(x-ct), \end{aligned}$$
(94)

and so on.

Case C: we search for a soliton solution in the form

$$\begin{aligned} u(\xi )=A\cdot sech(\xi )\cdot tanh(\xi ), \end{aligned}$$
(95)

by substituting (95) into (80), we obtain

$$\begin{aligned} J=\frac{1}{210} A^2 \left( 3 A^2 \lambda -49 c^2+35 m^2+49\right) , \end{aligned}$$
(96)

to find the constant A,we need to solve the following equation:

$$\begin{aligned} \frac{\partial J}{\partial A}=\frac{A^3 \lambda }{35}+\frac{1}{105} A \left( 3 A^2 \lambda -49 c^2+35 m^2+49\right) =0, \end{aligned}$$
(97)

form Eq. (97),we obtain

$$\begin{aligned} A= \pm \frac{\sqrt{\frac{7}{6}} \sqrt{7 c^2-5 m^2-7}}{\sqrt{\lambda }}, \end{aligned}$$
(98)

therefore,the solitary wave solutions to the PHi-4 equations are:

$$\begin{aligned} u(x,t)=\pm \frac{\sqrt{\frac{7}{6}} \sqrt{7 c^2-5 m^2-7}}{\sqrt{\lambda }} \cdot sech(x-ct)\cdot tanh(x-ct). \end{aligned}$$
(99)

Remark 2

As far as the author know,the soliton solutions of Eq. (78) we obtained above are different from Akter and Akbar (2015).

4.2 The conformable time-fractional Boussinesq equation

Let us consider the time-fractional Boussinesq equation (Lakestani and Manafian 2018):

$$\begin{aligned} D_{t}^{2\alpha }u-u_{xx}-(u^2)_{xx}+u_{xxxx}=0,0<\alpha \le 1, \end{aligned}$$
(100)

Utilizing the wave transformation

$$\begin{aligned} u(x,t)=u(\xi ),\xi =x-\frac{k t^\alpha }{\alpha },\end{aligned}$$
(101)

where \(k\ne 0\). Substituting (101) into Eq. (100) yields a nonlinear ordinary differential equation,

$$\begin{aligned} (k^2-1)u''-(u^2)''+u^{(4)}=0, \end{aligned}$$
(102)

where the prime indicates the derivation with respect to \(\xi \). Integrating Eq. (102) twice and setting the constants of integration equal to zero, we have

$$\begin{aligned} (k^2-1)u-u^2+u''=0, \end{aligned}$$
(103)

by He’s semi-inverse method,we can obtain the following variational formulation:

$$\begin{aligned} J=\int _{0}^{\infty }[\frac{(k^2-1)}{2}u^2-\frac{1}{3} u^3-\frac{1}{2}(u')^2]d\xi . \end{aligned}$$
(104)

Case A: we search for a soliton solution in the form

$$\begin{aligned} u(\xi )=A\cdot sech(\xi ), \end{aligned}$$
(105)

by substituting (105) into (103), we obtain

$$\begin{aligned} J=\frac{1}{12} A^2 \left( \pi A-6 k^2+8\right) , \end{aligned}$$
(106)

to find the constant A,we need to solve the following equation:

$$\begin{aligned} \frac{\partial J}{\partial A}=-\frac{\pi A^2}{12}-\frac{1}{6} A \left( \pi A-6 k^2+8\right) =0, \end{aligned}$$
(107)

form Eq. (107),we obtain

$$\begin{aligned} A= \frac{4 \left( 3 k^2-4\right) }{3 \pi }, \end{aligned}$$
(108)

therefore,the solitary wave solutions is constructed as follows:

$$\begin{aligned} u(\xi )=\frac{4 \left( 3 k^2-4\right) }{3 \pi }\cdot sech(\xi ). \end{aligned}$$
(109)

Case B: suppose soliton solution in the form

$$\begin{aligned} u(\xi )=A\cdot sech^2(\xi ), \end{aligned}$$
(110)

by substituting (110) into (103), we obtain

$$\begin{aligned} J=-\frac{1}{45} A^2 \left( 8 A-15 k^2+27\right) , \end{aligned}$$
(111)

to find the constant A,we need to solve the following equation:

$$\begin{aligned} \frac{\partial J}{\partial A}=-\frac{8 A^2}{45}-\frac{2}{45} A \left( 8 A-15 k^2+27\right) =0, \end{aligned}$$
(112)

form Eq. (112), we obtain

$$\begin{aligned} A= \frac{1}{4} \left( 5 k^2-9\right) , \end{aligned}$$
(113)

therefore,the solitary wave solutions is:

$$\begin{aligned} u(\xi )=\frac{1}{4} \left( 5 k^2-9\right) \cdot sech^2(\xi ). \end{aligned}$$
(114)

By a similar manipulation,we have:

$$\begin{aligned} u(\xi )=\frac{2048 \left( 7 k^2-16\right) }{3675 \pi }\cdot sech^3(\xi ), \end{aligned}$$
(115)
$$\begin{aligned} u(\xi )=\frac{11}{80} \left( 9 k^2-25\right) \cdot sech^4(\xi ), \end{aligned}$$
(116)
$$\begin{aligned} u(\xi )=\frac{524288 \left( 11 k^2-36\right) }{1486485 \pi }\cdot sech^5(\xi ), \end{aligned}$$
(117)
$$\begin{aligned} u(\xi )=\frac{85}{896} \left( 13 k^2-49\right) \cdot sech^6(\xi ), \end{aligned}$$
(118)

and so on.

Case C: we search for a soliton solution in the form

$$\begin{aligned} u(\xi )=A\cdot sech(\xi )\cdot tanh(\xi ), \end{aligned}$$
(119)

by substituting (119) into (103), we obtain

$$\begin{aligned} J=-\frac{1}{90} A^2 \left( 4 A-15 k^2+36\right) , \end{aligned}$$
(120)

to find the constant A, we need to solve the following equation:

$$\begin{aligned} \frac{\partial J}{\partial A}=-\frac{2 A^2}{45}-\frac{1}{45} A \left( 4 A-15 k^2+36\right) =0, \end{aligned}$$
(121)

form Eq. (121), we obtain

$$\begin{aligned} A= \frac{1}{2} \left( 5 k^2-12\right) , \end{aligned}$$
(122)

therefore,the solitary wave solution is:

$$\begin{aligned} u(\xi )=\frac{1}{2} \left( 5 k^2-12\right) \cdot sech(\xi )\cdot tanh(\xi ). \end{aligned}$$
(123)

5 Conclusion

In this paper,based on the semi-inverse method, variational formulation for some nonlinear problems are established, and the approximate solutions are easily obtained by the Ritz method. In this process, it may be difficult to solve a large system of algebraic equations, the Groebner bases theory (Buchberger’s algorithm) is applied to solve this problem. At present, the application of Groebner bases theory maily on algebra polynomial ideals, in the next, we will study how to extend it to differential case.