1 Introduction

In the theory of functional equations, there are few methods for solving a broader class of functional equations. In situations where such a method exists, it requires tedious computations. Therefore, in this present paper, we aim to develop a computer code based on the theoretical results obtained in [16] that will operate with symbolic calculations provided by the programming language Python, which means that it does not contain any numerical or approximate methods and it yields the exact polynomial solutions of the following functional equation,

$$\begin{aligned} \textstyle \sum \limits _{i=1}^n \gamma _i F(a_i x + b_i y)=\textstyle \sum \limits _{j=1}^m(\alpha _j x + \beta _j y) f(c_j x + d_j y), \end{aligned}$$
(1.1)

for all \(x,y\in \mathbb {R}\), \(\gamma _i,\alpha _j,\beta _j \in \mathbb {R},\) and \(a_i,b_i,c_j,d_j \in \mathbb {Q},\) and their special forms. This computer code will spare us monotonous calculations and the same tedious procedure. The computer code will significantly improve the level of accuracy and speed in calculations. Additionally, the computer code will be fully equipped with the functionality to solve various real-life problems, for example, the functional equations stemming from quadrature rules such as the Midpoint rule, Simpson rule, and Trapezoidal rule used in numerical analysis for integral approximation; the functional equations connected to the Lagrange mean value theorem which has many applications in mathematical analysis, computational mathematics, and other fields, and the functional equations arising from descriptive geometry, which is still a rigorous way to deal with graphical constructions. We note that using a computer programming language to solve functional equations has been studied by few mathematicians. We mention here some of them, S. Baják and Z. Páles [4], and [5], G.G. Borus and A. Gilányi [6], A. Házy [9], and [10], and C.P. Okeke and M. Sablik [15]. In their works, they used Maple as the programming tool to obtain their results which is less flexible in usage and accessible only to a small portion of the academic research community; however, in our work, we achieved our results using the programming language Python, designed to be an easily readable, highly versatile, general-purpose, open-source programming language, which avails robustness and facilitates the deployment of theorems to computational and symbolic frameworks. Special forms of (1.1) have been studied by several mathematicians. Let us quote here a few of them, J. Aczél [1], J. Aczél and M. Kuczma [2], C. Alsina, M. Sablik, and J. Sikorska [3], W. Fechner and E. Gselmann [7], B. Koclȩga-Kulpa, T. Szostok and S. Wa̧sowicz [11, 12] and [13], T. Nadhomi, C. P. Okeke, M. Sablik and T. Szostok [14], and C. P. Okeke and M. Sablik [15].

Theoretical background

We start by presenting some basic definitions.

Fix a nonnegative integer n,  and let \((G,+)\) and \((H,+)\) be groups. We say that a function \(f:G\rightarrow H\) satisfies the Fréchet equation (of order n) if, and only if

$$\begin{aligned} \Delta _{y_{n+1}y_n\dots y_{1}}^{n+1} f(x)=0, \end{aligned}$$
(1.2)

for all \(y_1,\dots ,y_{n+1}, x\in G\) (here \(\Delta ^{n+1}_{y_{n+1}y_n\dots y_1}f:= \Delta _{y_{n+1}}\circ \Delta ^n_{y_n\dots y_1}f, \) and \(\Delta \) is the Fréchet operator, defined by \(\Delta _yf(x)=f(x+y)-f(x)\) for every \(y, x\in G).\) We say that any solution to (1.2) is a polynomial function of order at most n. Now, we present the characterization of polynomial functions.

Theorem 1.1

(cf. Theorem 9.1 in [19]) Let \((G,+)\) be a commutative semigroup with identity, let \((H,+)\) be a commutative group and let n be a nonnegative integer. Moreover, assume that H is uniquely divisible by n!. Then \(f:G\rightarrow H\) is a solution of (1.2) if and only if it has the form

$$\begin{aligned} f(x)=\sum _{k=0}^n A^*_k(x), \end{aligned}$$
(1.3)

for all \(x \in G\) where \(A^*_k, \, k\in \{0,\cdots ,n\},\) are diagonalizations of k-additive symmetric functions \(A_k:G^k\rightarrow H.\)

In the case of \(G=H=\mathbb {R}, \) we obtain the following

Corollary 1.1

Let n be a nonnegative integer. Then \(f:\mathbb {R}\rightarrow \mathbb {R}\) is a continuous solution of (1.2) if and only if it has the form

$$\begin{aligned} f(x)=\sum _{k=0}^n a_kx^k, \end{aligned}$$
(1.4)

where \(a_k, \, k\in \{0,\cdots ,n\},\) are some real constants.

In other words, a continuous real solution of (1.2) is an ordinary polynomial. Next, we quote all theoretical results obtained in [16] without proofs for completeness and the reader’s convenience. Before we state the results, let us adopt the following notation. Let G and H be commutative groups. Then \(SA^i(G;H)\) denotes the group of all \(i\texttt {-}\)additive, symmetric mappings from \(G^i\) into H for \(i\geqslant 2,\) while \(SA^0(G;H)\) denotes the family of constant functions from G to H and \(SA^1(G;H)= Hom(G;H).\) We also denote by \(\mathcal {I}\) the subset of \(Hom(G;G) \times Hom(G;G)\) containing all pairs \((\alpha , \beta )\) for which \(Ran(\alpha ) \subset Ran(\beta ).\) Furthermore, we adopt the convention that a sum over an empty set of indices equals zero. We denote also for an \(A_i \in SA^i(G;H)\) by \(A_i^*\) the diagonalization of \(A_i,\) \( i\in \mathbb {N}\cup \{0\}.\)

Lemma 1.1

(Lemma 1.1 in [16]) Fix \(N\in \mathbb {N}\cup \{0\}, \, M\in \mathbb {N}\cup \{-1, 0\}\) and, if \(M\ge 0,\) let \(I_{p,n-p}, \, 0\le p\le n, \, n\in \{0,\dots ,M\}\) be finite subsets of \(\mathcal {I}\). Suppose further that H is an Abelian group uniquely divisible by N! and G is an Abelian group. Moreover, let functions \(\varphi _i:G\rightarrow SA^i(G;H),\, i\in \{0,\dots ,N\}\) and, if \(M\ge 0,\) \(\psi _{p,n-p,(\alpha ,\beta )}:G\rightarrow SA^i(G;H),\, (\alpha ,\beta )\in I_{p,n-p},\, 0\le p \le n, n\in \{0,\dots ,M\}\),satisfy

$$\begin{aligned} \varphi _N(x)(y^N) + \sum \limits _{i=0}^{N-1}\varphi _i(x)(y^i) = R_M(x,y), \end{aligned}$$
(1.5)

where \(R_M(x,y)\) is defined in the following way

$$\begin{aligned} R_M(x,y)= \left\{ \begin{array}{ll} 0,\qquad \qquad M=-1,\\ \textstyle \sum \limits _{n=0}^{M}\textstyle \sum \limits _{p=0}^n \textstyle \sum \limits _{(\alpha ,\beta )\in I_{p,n-p}}\psi _{p,n-p,(\alpha ,\beta )}\left( \alpha (x) + \beta (y)\right) (x^p,y^{n-p}), &{} M\ge 0 \end{array} \right. \end{aligned}$$

for every \(x,y\in G.\) Then \(\varphi _N\) is a polynomial function of degree not greater than m, where

$$\begin{aligned} m= \textstyle \sum \limits _{n=0}^M \textrm{card}\left( \textstyle \bigcup \limits _{s=n}^M K_s\right) - 1, \end{aligned}$$
(1.6)

and \(K_s= \bigcup _{p=0}^s I_{p,s-p}\) for each \(s\in \{0,\dots ,M\},\) if \( M\ge 0\). Moreover, if \(M=-1\),

$$\begin{aligned} \varphi _N(x)(y^N) + \textstyle \sum \limits _{i=0}^{N-1}\varphi _i(x)(y^i) =0 \end{aligned}$$

then \(m=-1\) and \(\varphi _N\) is the zero function.

Let us mention a very important result used in [16] due to L. Székelyhidi who proved that every solution of a very general linear equation is a polynomial function (see [19] Theorem 9.5, cf. also W. H. Wilson [20]).

Theorem 1.2

(Theorem 1.2 in [16]) Let G be an Abelian semigroup, S an Abelian group, n a positive integer, \(\varphi _i,\psi _i\) additive functions from G to G and let \(\varphi _i(G)\subset \psi _i(G),\;i\in \{1,\dots ,n\}.\) If functions \(f,f_i:G\rightarrow S\) satisfy the equation

$$\begin{aligned} f(x)+\textstyle \sum \limits _{i=1}^nf_i(\varphi _i(x)+\psi _i(y))=0, \end{aligned}$$
(1.7)

then f satisfies (1.2).

Székelyhidi’s result makes it easier to solve linear equations because it is no longer necessary to deal with each equation separately. Instead, we may formulate results which are valid for large classes of equations.

Now applying Lemma 1.1 and Theorem 1.2 to (1.1), we obtain that (1.1) has polynomial functions as solutions. With such a result, it is now enough to assume that the pair of functions (Ff) satisfying Eq. (1.1) are monomials. A characteristic feature of equation (1.1) is that the existence of solutions depends on the sequences \((L_k)_{k\in \mathbb {N}\cup \{0\}}\) and \((R_k)_{k\in \mathbb {N}\cup \{0\}} \) given by

$$\begin{aligned} L_k=\textstyle \sum \limits _{i=1}^n \gamma _i(a_i + b_i)^{k+1}, \end{aligned}$$
(1.8)

and,

$$\begin{aligned} R_k=\textstyle \sum \limits _{j=1}^m (\alpha _j + \beta _j)(c_j + d_j)^{k}, \end{aligned}$$
(1.9)

respectively, for all \(k \in \mathbb {N} \cup \{0\}.\) Hence, we proceed to the next theorem.

Theorem 1.3

(Theorem 2.1 in [16]) Suppose \(\gamma _i, \alpha _j, \beta _j \in \mathbb {R}, a_i,b_i, c_j,d_j \in \mathbb {Q}, i \in \{1,\dots , n \}, j \in \{1,\dots , m \}.\) Let \((L_k)_{k\in \mathbb {N}\cup \{0\}}\) and \((R_k)_{k\in \mathbb {N}\cup \{0\}}\) be defined by (1.8) and (1.9) respectively. Assume that \(L_k, R_k \ne 0\) for some \(k\in \mathbb {N}\cup \{0\},\) and equation (1.1) is satisfied by the pair \((F,f): \mathbb {R}\longrightarrow \mathbb {R},\) of monomial functions of order \(k+1\) and k,  respectively.

  1. (i)

    If \(k=0,\) then \(f=0=F\) or \(f=A_0\ne 0\) and \(F(x)=\tfrac{R_0}{L_0}A_0x;\) in the latter case necessarily

    $$\begin{aligned} \tfrac{R_0}{L_0}\textstyle \sum \limits _{i=1}^n \gamma _i a_i= \textstyle \sum \limits _{j=1}^m \alpha _j, \end{aligned}$$
    (1.10)

    and,

    $$\begin{aligned} \tfrac{R_0}{L_0}\textstyle \sum \limits _{i=1}^n \gamma _i b_i= \textstyle \sum \limits _{j=1}^m \beta _j. \end{aligned}$$
    (1.11)
  2. (ii)

    If \(k \ne 0,\) then either \(f = F = 0\) is the only solution of (1.1), or f is an arbitrary additive function while F is given by \(F(x)=\tfrac{R_k}{L_k}xf(x),\) \(x\in \mathbb {R}\) when the below equations hold

    $$\begin{aligned} \tfrac{R_k}{L_k}\textstyle \sum \limits _{i=1}^n \gamma _i a_i^{k+1}= \textstyle \sum \limits _{j=1}^m \alpha _jc_j^k, \end{aligned}$$
    (1.12)
    $$\begin{aligned} \tfrac{R_k}{L_k}\textstyle \sum \limits _{i=1}^n \gamma _i b_i^{k+1}= \textstyle \sum \limits _{j=1}^m \beta _jd_j^k, \end{aligned}$$
    (1.13)

    and,

    $$\begin{aligned} \tfrac{R_k}{L_k}\textstyle \sum \limits _{i=1}^n \genfrac(){0.0pt}1{k+1}{p} \gamma _i a_i^pb_i^{k+1-p}= \textstyle \sum \limits _{j=1}^m \genfrac(){0.0pt}1{k}{p}\beta _j c_j^pd_j^{k-p} + \textstyle \sum \limits _{j=1}^m \genfrac(){0.0pt}1{k}{p-1}\,\, \alpha _jc_j^{p-1}d_j^{k+1-p},\nonumber \\ \end{aligned}$$
    (1.14)

    for each \(p\in \{1,\cdots , k\}.\) Furthermore, for non-trivial f we see that either

  3. (a)

    \(\textstyle \sum \limits _{j=1}^m \beta _j c_j^pd_j^{k-p} = \textstyle \sum \limits _{j=1}^m \alpha _jc_j^{p-1}d_j^{k+1-p}\) for each \(p\in \{1,\cdots , k\},\) and f is an arbitrary k-monomial function, or

  4. (b)

    \(\textstyle \sum \limits _{j=1}^m \beta _j c_j^pd_j^{k-p} \ne \textstyle \sum \limits _{j=1}^m \alpha _jc_j^{p-1}d_j^{k+1-p}\) for each \(p\in \{1,\cdots , k\},\) and f is necessarily a continuous monomial function of order k and so is F of order \(k+1.\)

Remark 1.1

(Remark 2.1 in [16]) We note here that in equations (1.1) and (1.8), if \(f=0\) and \(k\in \mathbb {N}\cup \{0\}\) with

$$\begin{aligned} L_k =\textstyle \sum \limits _{i=1}^n \gamma _i (a_i+b_i)^{k+1} = 0, \end{aligned}$$

then F is not necessarily equal to zero. Of course this does not contradict Theorem 1.3 because \(L_k \ne 0.\) Therefore, we state the below propositions.

Proposition 1.4

(Proposition 2.2 in [16]) Let \(\gamma _i \in \mathbb {R},\) \(a_i, b_i \in \mathbb {Q},\) \(i \in \{1,\cdots , n\}.\) Let \((L_k)_{k\in \mathbb {N}\cup \{0\}}\) be defined by (1.8). Assume that \(k=0\) so that

$$\begin{aligned} L_0 =\textstyle \sum \limits _{i=1}^n \gamma _i (a_i+b_i) = 0, \end{aligned}$$
(1.15)

holds then either \(f = F = 0\) is the only solution of (1.1) or,

  1. (a)

    If \(f=0\) and \(F = const = A_0\) where \(A_0\) is any real number is the solution to (1.1) then

    $$\begin{aligned} \textstyle \sum \limits _{i=1}^n \gamma _i =0. \end{aligned}$$
  2. (b)

    If \(f=0\) and \(F = A_1\) is an additive function is the solution to (1.1) then

    $$\begin{aligned} \textstyle \sum \limits _{i=1}^n \gamma _ia_i = \textstyle \sum \limits _{i=1}^n \gamma _i b_i =0. \end{aligned}$$

Proposition 1.5

(Proposition 2.3 in [16]) Let \(\gamma _i \in \mathbb {R},\) \(a_i, b_i \in \mathbb {Q},\) \(i \in \{1,\cdots , n\}.\) Let \((L_k)_{k\in \mathbb {N}\cup \{0\}}\) be defined by (1.8). Assume that \(k\in \mathbb {N}\) such that

$$\begin{aligned} L_k =\textstyle \sum \limits _{i=1}^n \gamma _i (a_i+b_i)^{k+1} = 0, \end{aligned}$$
(1.16)

holds then either \(f = F = 0\) is the only solution of (1.1) or, \(f=0\) and \(F= A_{k+1}^*\) is an arbitrary \(k+1\) additive function when

$$\begin{aligned} \textstyle \sum \limits _{i=1}^n \genfrac(){0.0pt}1{k+1}{p} \gamma _i a_i^pb_i^{k+1-p} =0, \end{aligned}$$

for each \(p\in \{0,\cdots , k+1\}.\)

Remark 1.2

(Remark 2.2 in [16]) We note that if \(f=0,\) \(k=0,\) and \(\textstyle \sum \limits _{i=1}^n \gamma _i =0\) then \(F = A_0,\) where \(A_0\) is any real number, is also a solution to (1.1).

Remark 1.3

(Remark 2.3 in [16]) Since we are interested in the pairs (Ff) of polynomial functions that satisfy (1.1), we mention here that assumptions (1.15), (1.16) and Remark 1.2 are essential when \(f = 0.\) Therefore, if \(f = 0\) and \(k\in \mathbb {N}\cup \{0\}\) with \(L_k \ne 0\) then \(f = F = 0\) is the only solution to (1.1).

2 Algorithm and computer code

Given that the proofs of the theoretical results described above are constructive, we can formulate the following algorithm to solve any equation of type (1.1).

  1. (1)

    We rewrite the equation to get a form similar to (1.5) and apply Lemma 1.1 to obtain the potential polynomial degree of one of the unknown functions, either F or f.

  2. (2)

    From Lemma 1.1, we get that if the potential degree of F was obtained, then

    $$\begin{aligned} k = \left\{ \begin{array}{ll} m -1 &{} if \, m \ge 1,\\ 0 &{} if \, m = -1,0 \\ \end{array} \right. \end{aligned}$$
    (2.1)

    whereas if the potential degree of f was obtained, then

    $$\begin{aligned} k = \left\{ \begin{array}{ll} m &{} if \, m \ge 0,\\ 0 &{} if \, m = -1.\\ \end{array} \right. \end{aligned}$$
    (2.2)
  3. (3)

    Using k obtained above, we apply Theorem 1.3 by checking its conditions.

  4. (4)

    Next, we check if Propositions 1.4, 1.5, Remarks 1.2 and 1.3 are satisfied.

  5. (5)

    Finally, we combine the results obtained in steps 3 and 4 to get the exact polynomial solutions of the functions that satisfy equations of class (1.1).

2.1 Description of the computer code

The Python code described below runs only on the Python Sagemath environment. It is important to note that the line from sage.all import * will work only on Python with Sagemath installed. Our code steps are as follows:

  1. (a)

    Import the following python libraries: sage.all, sys, sympy (Function and Symbol), numpy, scipy.special (comb), and time

figure a
  1. (b)

    We defined a Python function called PSFE(\(\cdot \))(Polynomial Solutions of Functional Equations), where the entire code is embedded and takes a functional equation of the form:

    $$\begin{aligned} \textstyle \sum \limits _{i=1}^n \gamma _i F(a_i x + b_i y)-\textstyle \sum \limits _{j=1}^m(\alpha _j x + \beta _j y) f(c_j x + d_j y)=0 \end{aligned}$$
    (2.3)

    where “ =0” is not part of the input. That is, the code is executed with the command:

    $$\begin{aligned} PSFE\left( \sum \limits _{i=1}^n \gamma _i F(a_i x + b_i y)-\textstyle \sum \limits _{j=1}^m(\alpha _j x + \beta _j y) f(c_j x + d_j y)\right) \end{aligned}$$

    The input has functions in terms of F or f, where f is multiplied by a variable x and/or y, and we note that any other representation will pop an error message.

  2. (c)

    The sub-Python function Seperator12(\(\cdot \)) defined in the Python function PSFE(\(\cdot \)) separates the input into an array or list separated by “,”.

  3. (d)

    We defined another Python function Left_right3(\(\cdot \)) in PSFE(\(\cdot \)) that transforms the list in (c) above into the form of equation (1.5). Recognize N and M and apply Lemma 1.1 to obtain m, then the value of k is obtained by Eqs. (2.1) or (2.2). To see the process of calculations taken by the code in applying Lemma 1.1, we recommend you to see Theorem 3.1, Example 2 and Example 3 in [14] and Theorem 2.3 - 2.6 and Example (2.1) - (2.4) in [16].

  4. (e)

    Note that (c) and (d) above are encapsulated in the function Sablik_Lemma(\(\cdot \)) contained in PSFE(\(\cdot \)). Next, we rearrange the functional equation again in the form of equation (1.1), obtain the values of nm and the parameters \(\gamma _i, \alpha _j, \beta _j \in \mathbb {R}, a_i,b_i, c_j,d_j \in \mathbb {Q}, i \in \{1,\dots , n \}, j \in \{1,\dots , m \}\). For different values of k, use Theorem 1.3 to obtain the desired monomials alongside verifying if any of Propositions 1.4, 1.5, Remarks 1.2 and 1.3 apply. The monomials are summed in their generic form to give a polynomial. These processes are contained in the Python function: Theorem_1_3_Proposition_1_4_1_5_Remark_1_2_1_3(\(\cdot , \cdot \)).

  5. (f)

    The processes mentioned in (c), (d) and (e) combines to form PSFE (\(\cdot \)).

figure b

You can download the python source code from the below GitHub URL:

https://github.com/CPOkeke/CPOkeke-Polynomial-Solutions-of-Functional-Equations

or please send your request to the e-mail address of the first author:

chisom.okeke@us.edu.pl

It is important to note that our Python codes were developed in Python version 3.8, Sagemath 9.2, and comply with the requirements therein. Python and Sagemath are open-source programming software and a little adjustment may be required in the future to get the codes running in future versions of the aforementioned software.

2.2 Results of the computer code

Functional equations are mostly named after the mathematicians who discovered them. Sometimes, the functional equations are given names based on the property involved in the given functional equation. Our Python codes only accept inputs written in terms of variables x and/or y and functions F and/or f that belong to the functional equation class (1.1). The following are examples of well-known functional equations of class (1.1) solved with the computer code. Suppose that \((F,f):\mathbb {R}\rightarrow \mathbb {R}, \)

Example 2.1

Fechner–Gselmann functional equation(cf. Theorem 3.1 in [7],

Proposition 3.2 in [14],  and  Example 2 in [15]).

$$\begin{aligned} F(x+y) - F(x) - F(y) = xf(y) + yf(x) \end{aligned}$$

for all \(x,y \in \mathbb {R}.\)

INPUT:

\(PSFE(F(x+y)-F(x)-F(y)-x*f(y)-y*f(x))\)

OUTPUT:

By Sablik Lemma f has degree at most 2

\(f(x) = B_1(x) + a_3x^2 \)

\(F(x) = A_1(x) + xB_1(x) + \frac{1}{3}a_3x^3\)

where \(a_3\) is a real number.

\(A_1(x), B_1(x)\) are arbitrary additive functions. − 0.05 s -

Example 2.2

B. Koclȩga-Kulpa, T. Szostok, S. Wa̧sowicz in [12], considered the following functional equation, which stems from a well-known quadrature rule used in numerical analysis.

  1. a)

    (See Theorem 1 in [12] and Theorem 2.3 in [16].)

    $$\begin{aligned} 8\left[ F(y) -F(x)\right] = (y-x)\left[ f(x) + 3f\left( \tfrac{x+2y}{3}\right) + 3f\left( \tfrac{2x+y}{3} )\right) +f(y)\right] \end{aligned}$$

    for all \(x,y \in \mathbb {R}.\)

INPUT:

\(PSFE(8*(F(y)-F(x)) - (y-x)*(f(x) + 3*f((x+2*y)*Rational(1/3)) + 3*f((2*x+y)*Rational(1/3)) +f(y)))\)

OUTPUT:

By Sablik Lemma f has degree at most 5

\(f(x) = a_1 + a_2x + a_3x^2 + a_4x^3\)

\(F(x) = a_0 + a_1x + \frac{1}{2}a_2x^2 + \frac{1}{3}a_3x^3 + \frac{1}{4}a_4x^4\)

where \(a_0,a_1,a_2,a_3,a_4\) are real numbers.

− 0.13 s -

  1. b)

    (See Theorem 2 in [12] and Theorem 2.4 in [16].)

    $$\begin{aligned} F(y) - F(x) = (y-x)\left[ \frac{1}{6}f(x) + \frac{2}{3}f\left( \frac{x+y}{2}\right) + \frac{1}{6}f(y)\right] \end{aligned}$$

    for all \(x,y \in \mathbb {R}.\)

INPUT:

\(PSFE(F(y) - F(x)- (y-x)*( Rational(1/6)*f(x) + Rational(2/3)*f((x+y)*Rational(1/2)) + Rational(1/6)*f(y)))\)

OUTPUT:

By Sablik Lemma f has degree at most 3

\(f(x) = a_1 + a_2x + a_3x^2 + a_4x^3\)

\(F(x) = a_0 + a_1x + \frac{1}{2}a_2x^2 + \frac{1}{3}a_3x^3 + \frac{1}{4}a_4x^4\)

where \(a_0,a_1,a_2,a_3,a_4\) are real numbers.

− 0.09 s -

Example 2.3

In [13] B. Koclȩga-Kulpa, T. Szostok, S. Wa̧sowicz, considered the polynomial functions connected with the Hermite-Hadamard inequality in the class of continuous functions. (cf. Theorem 4 in [13] and Theorem 2.6 in [16]).

$$\begin{aligned} F(y) - F(x) = (y-x)\left[ \tfrac{1}{4}f(x) + \tfrac{3}{4}f\left( \tfrac{1}{3}x + \tfrac{2}{3}y\right) \right] \end{aligned}$$

for all \(x,y \in \mathbb {R}.\)

INPUT:

\(PSFE(F(y) -F(x) - (y-x)*(Rational(1/4)*f(x) + Rational(3/4)*f(Rational(1/3)*x +Rational(2/3)*y)))\)

OUTPUT:

By Sablik Lemma f has degree at most 2

\(f(x) = a_1 + a_2x + a_3x^2\)

\(F(x) = a_0 + a_1x + \frac{1}{2}a_2x^2 + \frac{1}{3}a_3x^3 \)

where \(a_0,a_1,a_2,a_3\) are real numbers.

− 0.05 s -

Example 2.4

J. Aczél [1], J. Aczél and M. Kuczma [2] considered variations of the Lagrange mean value theorem, which has many applications in mathematical analysis, computational mathematics, and other fields.

  1. a)

    (See J. Aczél’s result in [1] and Example 2.2 in [16].)

    $$\begin{aligned} \tfrac{F(y) - F(x)}{y - x} = f(x + y) \end{aligned}$$

    for all \(x,y \in \mathbb {R}.\)

INPUT:

\(PSFE(F(y)-F(x)-((y-x)*f(x+y)))\)

OUTPUT:

By Sablik Lemma F has degree at most 2

\(f(x) = a_1 + a_2x \)

\(F(x) = a_0 + a_1x + a_2x^2 \)

where \(a_0,a_1,a_2\) are real numbers.

− 0.02 s -

  1. b)

    (See Theorem 5 in [1] and Example 2.3 in [16].)

    $$\begin{aligned} \tfrac{F(x) - F(y)}{x -y} = f\left( \tfrac{x +y}{2}\right) \end{aligned}$$

    for all \(x,y \in \mathbb {R}.\)

INPUT:

\(PSFE(F(x)-F(y)-((x-y)*f((x+y)*Rational(1/2))))\)

OUTPUT:

By Sablik Lemma F has degree at most 2

\(f(x) = a_1 + a_2x \)

\(F(x) = a_0 + a_1x + \frac{1}{2}a_2x^2 \)

where \(a_0,a_1,a_2\) are real numbers.

− 0.03 s -

Example 2.5

C. Alsina, M. Sablik, and J. Sikorska in [3] considered a functional equation arising from descriptive geometry, which is still a rigorous way to deal with graphical constructions (cf. Example 2.4 in [16]).

$$\begin{aligned} 2F(y) - 2F(x) = (y -x)\left[ f\left( \tfrac{x+y}{2}\right) + \tfrac{f(x) + f(y)}{2}\right] \end{aligned}$$

for all \(x,y \in \mathbb {R}.\)

INPUT:

\(PSFE( 2*(F(y) -F(x)) - (y-x)*(f((x+y)*Rational(1/2)) + ((f(x) + f(y))*Rational(1/2))))\)

OUTPUT:

By Sablik Lemma f has degree at most 3

\(f(x) = a_1 + a_2x \)

\(F(x) = a_0 + a_1x + \frac{1}{2}a_2x^2 \)

where \(a_0,a_1,a_2\) are real numbers.

− 0.09 s -

Example 2.6

(cf. Example 2 in [14])

$$\begin{aligned} F(x) - 4F\left( \frac{x+y}{2}\right) +F(y) = xf(y) + yf(x) \end{aligned}$$

for all \(x,y \in \mathbb {R}.\)

INPUT:

\(PSFE(F(x) - 4*F((x+y)*Rational(1/2)) + F(y) -x*f(y) - y*f(x))\)

OUTPUT:

By Sablik Lemma f has degree at most 2

\(f(x) = B_1(x) + a_1 \)

\(F(x) = -a_1x - xB_1(x) \)

where \(a_1\) is a real number.

\(B_1(x)\) is an arbitrary additive function. − 0.05 s -

Example 2.7

(cf. Example 3 in [14])

$$\begin{aligned} F(x) - 8F\left( \frac{x+y}{2}\right) +F(y) = xf(y) + yf(x) \end{aligned}$$

for all \(x,y \in \mathbb {R}.\)

INPUT: \(PSFE(F(x) - 8*F((x+y)*Rational(1/2)) + F(y) -x*f(y) - y*f(x))\)

OUTPUT:

By Sablik Lemma f has degree at most 2

\(f(x) = a_1 + a_3x^2\)

\(F(x) = -\frac{1}{3}a_1x - \frac{1}{3}a_3x^3 \)

where \(a_1,a_3\) are real numbers.

− 0.06 s -

Example 2.8

Additive Cauchy functional equation

$$\begin{aligned} F(x+y) = F(x) + F(y) \end{aligned}$$

for all \(x,y \in \mathbb {R}.\)

INPUT:

\(PSFE(F(x+y)-F(x)-F(y))\)

OUTPUT:

By Sablik Lemma F has degree at most 1

\(f(x) = 0 \)

\(F(x) = A_1(x) \)

\(A_1(x)\) is an arbitrary additive function. - 0.01 s -

Example 2.9

Jensen functional equation

$$\begin{aligned} F\left( \frac{x+y}{2}\right) = \frac{1}{2}\left[ F(x) + F(y)\right] \end{aligned}$$

for all \(x,y \in \mathbb {R}.\)

INPUT:

\(PSFE(F((x+y)*Rational(1/2))- Rational(1/2)*(F(x)+ F(y)))\)

OUTPUT:

By Sablik Lemma F has degree at most 1

\(f(x) = 0 \)

\(F(x) = a_0 + A_1(x) \)

where \(a_0\) is a real number.

\(A_1(x)\) is an arbitrary additive function.

− 0.01 s -

Example 2.10

Drygas functional equation

$$\begin{aligned} F(x+y) + F(x-y) = 2F(x) + F(y) + F(-y) \end{aligned}$$

for all \(x,y \in \mathbb {R}.\)

INPUT:

\(PSFE(F(x+y) + F(x-y) -2*F(x) -F(y) - F(-y))\)

OUTPUT:

By Sablik Lemma F has degree at most 3

\(f(x) = 0 \)

\(F(x) = A_1(x) \)

\(A_1(x)\) is an arbitrary additive function.

− 0.01 s -

Example 2.11

(cf. Example 3 in [15])

$$\begin{aligned} F(x+y) - F(x) - F(y) = xf(3y) + yf(3x) \end{aligned}$$

for all \(x,y \in \mathbb {R}.\)

INPUT:

\(PSFE(F(x+y)-F(x)-F(y)-x*f(3*y) - y*f(3*x))\)

OUTPUT:

By Sablik Lemma f has degree at most 3

\(f(x) = B_1(x) + a_3x^2 \)

\(F(x) = A_1(x) + 3xB_1(x) + 3a_3x^3\)

where \(a_3\) is a real number.

\(A_1(x),B_1(x)\) are arbitrary additive functions.

− 0.05 s -

Example 2.12

(cf. Example 4 in [15])

$$\begin{aligned} F(x+y) - F(x) - F(y) = xf(y) \end{aligned}$$

for all \(x,y \in \mathbb {R}.\)

INPUT:

\(PSFE(F(x+y)-F(x)-F(y)-x*f(y))\)

OUTPUT:

By Sablik Lemma F has degree at most 2

\(f(x) = a_2x \)

\(F(x) = A_1(x) + \frac{1}{2}a_2x^2\)

where \(a_2\) is a real number.

\(A_1(x)\) is an arbitrary additive function.

− 0.02 s -

Example 2.13

(cf. Example 5 in [15])

$$\begin{aligned} F(x+y) - F(x) - F(y) = 3xf(2y) - 4yf(3x) \end{aligned}$$

for all \(x,y \in \mathbb {R}.\)

INPUT:

\(PSFE(F(x+y) -F(x)-F(y) -3*x*f(2*y) + 4*y*f(3*x))\)

OUTPUT:

By Sablik Lemma f has degree at most 3

\(f(x) = a_2x \)

\(F(x) = A_1(x) -3a_2x^2\)

where \(a_2\) is a real number.

\(A_1(x)\) is an arbitrary additive function.

− 0.06 s -

Example 2.14

(cf. Example 6 in [15])

$$\begin{aligned} F(x+y) - F(x) - F(y) = xf(3y) + yf(3x) +xf(y) + yf(x) + xf(2y) + yf(2x) \end{aligned}$$

for all \(x,y \in \mathbb {R}.\)

INPUT:

\(PSFE(F(x+y) -F(x)-F(y) -x*f(3*y) - y*f(3*x)-x*f(y)-y*f(x)-y*f(2*x)-x*f(2*y))\)

OUTPUT:

By Sablik Lemma f has degree at most 6

\(f(x) = B_1(x) + a_3x^2 \)

\(F(x) = A_1(x) + 6xB_1(x) + \frac{14}{3}a_3x^3\)

where \(a_3\) is a real number.

\(A_1(x), B_1(x)\) are arbitrary additive functions.

− 0.09 s -

Example 2.15

Consider the square-norm-equation in [8] and [6]

$$\begin{aligned} F(x+y) + F(x-y) = 2F(x) + 2F(y) \end{aligned}$$

for all \(x,y \in \mathbb {R}.\)

INPUT:

\(PSFE(F(x+y) + F(x-y) - 2*F(x) -2*F(y))\)

OUTPUT:

By Sablik Lemma F has degree at most 2

\(f(x) = 0 \)

\(F(x) = A_2^*(x)\)

\(A_2^*(x)\) is an arbitrary additive function.

− 0.01 s -

Example 2.16

Consider the polynomial equation for \(n =5 \) in [8]

$$\begin{aligned}{} & {} F(x+6y) - 6F(x+5y) + 15F(x+4y) - 20F(x+3y) + 15F(x+2y) \\{} & {} \quad - 6F(x+y) + F(x) =0 \end{aligned}$$

for all \(x,y \in \mathbb {R}.\)

INPUT:

\(PSFE(F(x+6*y) - 6*F(x+5*y) + 15*F(x+4*y) - 20*F(x+3*y) + 15*F(x+2*y) - 6*F(x+y) + F(x))\)

OUTPUT:

By Sablik Lemma F has degree at most 5

\(f(x) = 0 \)

\(F(x) = a_0 + A_1(x) + A_2^*(x) + A_3^*(x) + A_4^*(x) + A_5^*(x)\)

where \(a_0\) is a real number.

\(A_1(x),A_2^*(x),A_3^*(x),A_4^*(x),A_5^*(x)\) are arbitrary additive functions.

− 0.02 s -

Example 2.17

In [17], P.K Sahoo arrived at the functional equation stemming from the trapezoidal rule.

$$\begin{aligned} F(y) - F(x) = \frac{y-x}{6}\left[ f(x) +2f\left( \frac{2x+y}{3}\right) + 2f\left( \frac{x+2y}{3}\right) +f(y)\right] \end{aligned}$$

for all \(x,y \in \mathbb {R},\) where F is an antiderivative of f.

INPUT:

\(PSFE(F(y) - F(x) - (y-x)*Rational(1/6)*(f(x) + 2*f((2*x + y)*Rational(1/3)) + 2*f((x + 2*y)*Rational(1/3)) + f(y)))\)

OUTPUT:

By Sablik Lemma f has degree at most 5

\(f(x) = a_1 + a_2x \)

\(F(x) = a_0 + a_1x + \frac{1}{2}a_2x^2\)

where \(a_0,a_1,a_2\) are real numbers.

− 0.02 s -

Example 2.18

$$\begin{aligned} F(y) - F(x) = (y-x)\left[ \frac{1}{9}f(x) + \frac{16+\sqrt{6}}{36}f\left( \frac{x+y}{2}\right) \right] \end{aligned}$$

for all \(x,y \in \mathbb {R}.\)

INPUT:

\(PSFE(F(y) - F(x) - (y-x)*((1/9)*f(x) + ((16+sqrt(6))/36)*(f(Rational(1/2)\)\(*x + Rational(1/2)*y)))))\)

OUTPUT:

By Sablik Lemma f has degree at most 2

\(f(x) = a_1 \)

\(F(x) = a_0 + (\frac{\sqrt{6}}{36} + \frac{5}{9})a_1x\)

where \(a_0,a_1\) are real numbers.

− 0.11 s -

Example 2.19

$$\begin{aligned} \frac{16- \sqrt{6}}{36}(F(y) - F(x)) = (y-x)\left[ f\left( \frac{x+2y}{3}\right) + \frac{16+\sqrt{6}}{36}f\left( \frac{7x+y}{8}\right) \right] \end{aligned}$$

for all \(x,y \in \mathbb {R}.\)

INPUT:

\(PSFE(((16-sqrt(6))/36)*(F(y) - F(x)) - (y-x)*((f((Rational(1/3)*x + Rational(2/3)*y))) +\ ((16+sqrt(6))/36)*(f(Rational(7/8)*x + Rational(1/8)*y))))\)

OUTPUT:

By Sablik Lemma F has degree at most 4

\(f(x) = a_1 \)

\(F(x) = a_0 + (\frac{34 \sqrt{6}}{125} + \frac{419}{125})a_1x\)

where \(a_0,a_1\) are real numbers.

− 3.35 s -

Example 2.20

$$\begin{aligned} \sqrt{2}(F(y) - F(x)) = (y-x)\left[ \sqrt{5} f\left( \frac{5x+7y}{12}\right) + \sqrt{3} f\left( x+y\right) \right] \end{aligned}$$

for all \(x,y \in \mathbb {R}.\)

INPUT:

\(PSFE((sqrt(2))*(F(y) - F(x)) - (y-x)*(sqrt(5) *(f((Rational(5/12)*x + Rational(7/12)*y))) +\ ((sqrt(3)))*(f(x + y))))\)

OUTPUT:

By Sablik Lemma F has degree at most 4

\(f(x) = a_1 \)

\(F(x) = a_0 + (\frac{\sqrt{6}}{2} + \frac{\sqrt{1}0}{2})a_1x\)

where \(a_0,a_1\) are real numbers.

− 1.55 s -

Example 2.21

$$\begin{aligned} \frac{4- \sqrt{6}}{10}(F(y) - F(x)) = (y-x)\left[ \frac{2}{9}f\left( x\right) + \frac{4+\sqrt{6}}{10}f\left( 5x +7y\right) \right] \end{aligned}$$

for all \(x,y \in \mathbb {R}.\)

INPUT:

\(PSFE(((4-sqrt(6))/10)*(F(y) - F(x)) - (y-x)*((2/9)*f(x) + ((4+sqrt(6))/10)*(f(5*x + 7*y))))\)

OUTPUT:

By Sablik Lemma f has degree at most 2

\(f(x) = a_1 \)

\(F(x) = a_0 + (\frac{46 \sqrt{6}}{45} + \frac{139}{45})a_1x\)

where \(a_0,a_1\) are real numbers.

− 3.31 s -

Example 2.22

$$\begin{aligned} \frac{3+ \sqrt{3}}{6}(F(y) - F(x)) = (y-x)\left[ \frac{3+ \sqrt{3}}{6}f\left( \frac{x+y}{2}\right) +\frac{3- \sqrt{3}}{6}f\left( \frac{x+3y}{4}\right) \right] \end{aligned}$$

for all \(x,y \in \mathbb {R}.\)

INPUT:

\(PSFE(((3+sqrt(3))/6)*(F(y) - F(x)) - (y-x)*((((3+sqrt(3))/6)*(f(Rational(1/2)*x + Rational(1/2)*y))\ + ((3-sqrt(3))/6)*(f(Rational(1/4)*x + Rational(3/4)*y)))))\)

OUTPUT:

By Sablik Lemma F has degree at most 4

\(f(x) = a_1 \)

\(F(x) = a_0 + (3- \sqrt{3})a_1x\)

where \(a_0,a_1\) are real numbers.

− 4.26 s -

Example 2.23

$$\begin{aligned}{} & {} \frac{5- \sqrt{1}5}{10}(F(y) - F(x)) \\{} & {} \quad = (y-x)\left[ \frac{5- \sqrt{1}5}{10}f\left( 8x+12y\right) +\frac{5+ \sqrt{1}5}{10}f\left( 20x+11y\right) \right] \end{aligned}$$

for all \(x,y \in \mathbb {R}.\)

INPUT:

\(PSFE(((5-sqrt(15))/10)*(F(y) - F(x))- (y-x)*(((5-sqrt(15))/10)*(f(8*x + 12*y))+ ((5+sqrt(15))/10)*(f(20*x + 11*y))))\)

OUTPUT:

By Sablik Lemma F has degree at most 4

\(f(x) = a_1 \)

\(F(x) = a_0 + (\sqrt{1}5 +5)a_1x\)

where \(a_0,a_1\) are real numbers.

− 3.88 s -

3 Conclusions and future research

A computer code developed in a Python programming language has been presented for obtaining the polynomial solutions of the functional equation of type (1.1). The method’s success can be attributed to the theoretical results obtained in [16]. We note that the functional equation of type (1.1) consists of at most two unknown functions [(in particular, at most one unknown function on either side of (1.1)], say F or f, where f is multiplied by a variable x and/or y. Therefore, we aim to extend the approach to consider a Pexider form of (1.1), that is, an equation with more than two unknown functions. Namely, an equation of the form

$$\begin{aligned} \textstyle \sum \limits _{i=1}^n \sum \limits _{p=1}^N \gamma _{ip} F_p(a_{ip} x + b_{ip} y)=\textstyle \sum \limits _{j=1}^m\sum \limits _{q=1}^M(\alpha _{jq} x + \beta _{jq} y) f_q(c_{jq} x + d_{jq} y), \end{aligned}$$
(3.1)

\((F_p,f_q):\mathbb {R}\rightarrow \mathbb {R},\) for every \(x,y\in \mathbb {R}\), \(\gamma _{ip},\alpha _{jq},\beta _{jq} \in \mathbb {R}, a_{ip},b_{ip},c_{jq},d_{jq} \in \mathbb {R}, i \in \{1,\cdots , n \}, j \in \{1,\cdots , m\},n,m,N,M \in \mathbb {N}\) and its special forms. Below are examples of special forms of (3.1)

  1. (1)

    Additive Cauchy Pexider functional equation

    $$\begin{aligned} F_1(x+y) = F_2(x) + F_3(y) \end{aligned}$$

    for all \(x,y \in \mathbb {R}.\)

  2. (2)

    A generalization of the square-norm-equation in [8]

    $$\begin{aligned} F_1(x+y) + F_2(x-y) = F_3(x) + F_4(y) \end{aligned}$$

    for all \(x,y \in \mathbb {R}.\)

  3. (3)

    The general class of linear functional equations considered in [8] and [6]

    $$\begin{aligned} \textstyle \sum \limits _{i=1}^n\sum \limits _{p=1}^N F_p(a_{ip} x + b_{ip} y) = 0 \end{aligned}$$

    for all \(x,y \in \mathbb {R}\), and \( a_{ip},b_{ip} \in \mathbb {Q}.\)

  4. (4)

    P. K. Sahoo and T. Riedel, in [18, see Chapter 3], considered the functional equations

    $$\begin{aligned} F_1(x) - F_1(y) = (x-y)\left[ f_1(x+y) + f_2(x) + f_2(y)\right] \\ xf_1(y) - yf_1(x) = (x-y)\left[ f_2(x+y) + f_3(x) + f_3(y)\right] \end{aligned}$$

    for all \(x,y \in \mathbb {R}.\)

  5. (5)

    Equation (1.1)

    $$\begin{aligned} \textstyle \sum \limits _{i=1}^n \gamma _{i1} F_1(a_{i1} x + b_{i1} y)=\textstyle \sum \limits _{j=1}^m(\alpha _{j1} x + \beta _{j1} y) f_1(c_{j1} x + d_{j1} y) \end{aligned}$$

    for all \(x,y \in \mathbb {R}\), \(\gamma _{i1},\alpha _{j1},\beta _{j1} \in \mathbb {R},\) and \( a_{i1},b_{i1},c_{j1},d_{j1} \in \mathbb {Q}.\)

Next, we will consider non-polynomial solutions of the functional equation (3.1), and finally, we will study solutions of its inequalities. An example of such a functional inequality was considered in [7], namely,

$$\begin{aligned} F_1(x+y) - F_1(x) - F_1(y) \ge xf_1(y) + yf_1(x) \end{aligned}$$

for all \(x,y \in \mathbb {R}.\)