    # Algorithm for computing semi-Fourier sequences of expressions involving exponentiations and integrations

We provide an algorithm for computing semi-Fourier sequences for expressions constructed from arithmetic operations, exponentiations and integrations. The semi-Fourier sequence is a relaxed version of Fourier sequence for polynomials (expressions made of additions and multiplications).

## Authors

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Introduction

The main contribution of this paper is an algorithm for computing semi-Fourier sequences for expressions constructed from arithmetic operations, exponentiations and integrations. The semi-Fourier sequence is a relaxed version of Fourier sequence for polynomials (expressions made of additions and multiplications). Below we elaborate on the above statements.

Fourier sequence of polynomials is a finite sequence of successive differentiation. As an example, consider

 e=x3+3x2+5x+7

Then the Fourier sequence of is given by

 g1=e=x3+3x2+5x+7g2=g′1=3x2+6x+5g3=g′2=6x+6g4=g′3=6

It has an obvious but important property: the successive differentiation eventually leads to a constant. It also has another nice property due to Budan-Fourier [1, 2]: Let denote the number of sign changes in the sequence (with zeros ignored). Then the number of roots of in , counted with multiplicities, is equal to , where is a nonnegative integer.

One naturally wonders whether one can do the same for non-polynomials. Consider

 e=exp(x)+exp(x2)

Let us compute the successive differentiation as we did above. We obtain

 g1=e=exp(x)+exp(x2)g2=g′1=exp(x)+2xexp(x2)g3=g′2=exp(x)+2exp(x2)+4x2exp(x2)⋮

Note that the successive differentiation will not lead to a constant. Thus Fourier sequence for does not exist.

In [5, 6], Strzeboński (one of the co-authors of this paper) relaxed the notion of Fourier sequence to “semi”-Fourier sequence. For the above example, a semi-Fourier sequence is given by

 g1=e⋅h1=1+exp(x2)exp(x)−1h1=exp(x)−1g2=g′1⋅h2=2x−1h2=exp(x2)−1exp(x)g3=g′2⋅h3=2h3=1

Note that before/after each differentiation one is allowed to multiply by another expression, , which is non-zero for all values of in the domain of . Of course when we require that , then it is a Fourier sequence. By allowing to be other than , one obtains a relaxed version of Fourier sequence. Since is non-zero for all real values of , the semi-Fourier sequence still preserves the Budan-Fourier’s property mentioned above (Theorem 2.4 in ).

Strzeboński also proved constructively that a semi-Fourier sequence exists for expressions constructed from arithmetic operations, exponentiations, logarithms and arctangents, by providing an algorithm for computing such a sequence.111The definition of a semi-Fourier sequence in this paper is a bit stricter than the definition used in [5, 6], however the semi-Fourier sequences constructed in [5, 6] satisfy the stricter requirements.

One again naturally wonders whether semi-Fourier sequences exist for even larger class of functions and whether one can find them algorithmically. One natural class to consider is the set (called Exp-Int) of expressions constructed from arithmetic operations, exponentiations and integrations (). It is easy to see that logarithms and arctangents belong to Exp-Int, since they are integrals of and . However there are many expressions in Exp-Int that cannot be expressed in terms of arithmetic operations, exponentiation, logarithms and arctangents, such as

 e = exp(x int(exp(−x2)))−int(exp(−x2))−3 = exp(x√π2erf(x))−√π2erf(x)−3

Many elementary and special functions can be represented as Exp-Int expressions, such as rational functions, exponential functions, logarithm, radicals (), inverse trigonometric functions (), (inverse) hyperbolic trigonometric functions (), hyperbolic sine/cosine integrals

, logistic sigmoid function (

), error function (), logarithmic integral function (), exponential integral function (), polylogarithm function (), Spence function (), Gudermannian function (), Dawson function (), Kummer function (), Incomplete beta function (), Incomplete gamma function (), Incomplete elliptic integral (), etc.

The main contribution of this paper is to prove constructively that there exists a semi-Fourier sequence for every Exp-Int expression, by providing an algorithm for computing such a sequence. For a semi-Fourier sequence computed by the algorithm for the above , see Example 2.

Of course, the main task of such an algorithm is figuring out ’s at each step, so that the sequence eventually terminates. It was quite challenging because most choices of ’s lead to infinite sequences and because, at each step, it was by no means obvious to predict which ’s would be the lucky ones. We overcame the challenge by defining a partial ordering (ranking) on expressions, and ensuring that the rank decreases.

One again wonders whether there is even larger class of functions for which semi-Fourier sequences exist. It is easy to see that semi-Fourier sequences exist for any real analytic function with finitely many roots, since one can take to be a polynomial which has the same roots as with the same multiplicities. However, in general cannot be constructed algorithmically, since we cannot compute the roots of (in fact, the original reason for introducing semi-Fourier sequences was to be able to isolate roots algorithmically). Finding a larger class of functions for which semi-Fourier sequences exist and can be found algorithmically is an open problem which we leave for future work.

There are several closely related works. As mentioned above, in [5, 6], Strzeboński, one of the authors of the present paper, introduced the notions, and algorithms for semi-Fourier sequence for exponential - logarithmic - arctan expressions and showed that the sequences have the Budan-Fourier property. This present paper gives an algorithm for larger class of expressions. By construction, it is immediate that the output sequences have the Budan-Fourier property. In [5, 6], Strzeboński also gave real root isolation algorithms. However, in the present paper, we do not do so, mainly because such real root isolation algorithm would require zero-testing which is non-trivial for Exp-Int and interesting on its own, deserving a separate paper. Hence we leave it for the future research.

In , Richardson gave an algorithm for recognizing zeros among exponential-logarithmic expressions. For this, he generates certain sequences of expressions. They are similar but not the same as a semi-Fourier sequence. Thus they do not have the Budan-Fourier property either. This present paper deals with larger family of expressions and the results have the Budan-Fourier property.

In , Kovanskii studied zeros of Pfaffian functions. It involves sequence of functions defined by certain differential equations. The sequence is not semi-Fourier in general. As the result, it does not have the Budan-Fourier property. The present paper deals with smaller family of expressions. However, it generates semi-Fourier sequence with the Budan-Fourier property.

The paper is structured as follows: In Section 2, we give a precise statement of the problem that will be tackled in this paper. In Section 3, we provide an algorithm solving the problem. In Section 4, we prove the correctness of the algorithm. In Section 5, we provide several examples.

## 2 Problem

In this section, we state the main problem precisely. For this, we need several notions.

###### Definition 1 (Exp-Int expression).

An exp-int expression is an expression constructed with the variable symbol , rational numbers, the binary operator symbols and and the unary operator symbols , , and . The set of all exp-int expressions is denoted by .

Of course, the symbols , and stand for inverse, exponential and integration (anti-derivative) respectively. As usual, for convenience, we use the following usual short-hands:

 fn=f⋯fnf−n=inv(f)nf0=1−e=−1⋅e
###### Example 1.

We list several expressions that can be rewritten as Exp-Int expressions.

In the above, we have used the following translations. Note that integrals may include arbitrary constants.

 log(x) = ∫1x n√x = e1nlog(x) arccos(x) = ∫−1√1−x2 Ei(x) = ∫exx li(x) = ∫1log(x)
###### Definition 2 (Expression differentiation).

Expression differentiation is the operation defined recursively as follows.

1. ,

2. , for ,

3. ,

4. ,

5. ,

6. ,

###### Remark 3.

We explicitly listed the above well known properties of differentiation, because we want to emphasize the obvious but crucial facts (that will be used later):

• The derivative (the result of the differentiation) of an exp-int expression is itself an exp-int expression.

• Let . If is a subexpression of , then it is a subexpression of .

###### Remark 4.

An expression can be naturally viewed as a partial function, after fixing the meaning of the distinct int subexpressions by choosing anti-derivatives.

###### Notation 5.

We write iff for every choice of anti-derivatives corresponding to the distinct int subexpressions in and and for every in the domain of , we have .

###### Definition 6 (Semi-Fourier sequence).

Let . A sequence of pairs of elements of is a semi-Fourier sequence for if

1. , for ,

2. .

Now we are ready to state the problem precisely.

###### Problem 1 (Main).

Devise an algorithm with the following specification.

[leftmargin=4em,style=nextline,itemsep=0.3em]

Input:

Output:

a semi-Fourier sequence of

###### Example 2.

[leftmargin=4em,style=nextline,itemsep=0.3em]

Input:

Output:

where

## 3 Algorithm

In this section, we describe an algorithm that solves the problem posed in the previous section.

###### Definition 7 (Equivalence).

Let . We say that and are equivalent, and write , if can be transformed into by applying the commutative ring properties of and . We write if is equivalent to a subexpression of .

###### Definition 8 (Extension tower).

An extension tower , where , is defined recursively as follows

1. ,

2. For , , , and

 E⟨f1,…,fk⟩=⎧⎪ ⎪⎨⎪ ⎪⎩{anfnk+…+a0:a0,…,an∈E⟨f1,…,fk−1⟩}ifT=inv{anfnk+…+a0:a0,…,an∈E⟨f1,…,fk−1⟩}ifT=int{fuk(anfnk+…+a0):a0,…,an∈E⟨f1,…,fk−1⟩}ifT=exp

where and if then and .

Note that if then , , and can be easily transformed into equivalent elements of . In the following when we write , , and for expressions we mean equivalent elements of .

###### Definition 9 (Rank).

The rank of an exp-integrate expression is defined recursively as follows:

1. ,

2. for ,

3. ,

4. ,

5. ,

6. ,

7. .

###### Algorithm 1 (Eisf).

Main

[leftmargin=4em,style=nextline,itemsep=0.3em]

Input:

Output:

a semi-Fourier sequence of

1. [leftmargin=!,labelwidth=1em]

2. Find a sequence of all distinct subexpressions of of the form , where , ordered by the non-decreasing value of .

3. Set .

4. Return .

###### Algorithm 2 (Et).

[leftmargin=4em,style=nextline,itemsep=0.3em]

Input:

such that

• is a sequence containing all distinct subexpressions of of the form , where , ordered by the increasing value of .

Output:

such that

• for

• for

• .

1. [leftmargin=!,labelwidth=1em]

2. If

1. For rewrite as .

2. For set .

3. Return .

3. If

1. For rewrite as , where are free of , for .

2. Compute .

3. Set .

4. For , set .

5. Return .

4. If

1. For rewrite as , where are free of , for .

2. Compute .

3. Set .

4. For , set .

5. Return .

5. If

1. For rewrite as , where and are free of , for .

2. Compute .

3. Set .

4. For , set .

5. Return .

###### Algorithm 3 (Etsf).

[leftmargin=4em,style=nextline,itemsep=0.3em]

Input:

such that .

Output:

a semi-Fourier sequence of such that , for .

1. [leftmargin=!,labelwidth=1em]

2. If does not contain any of ,

1. Set and .

2. For set and .

3. Return .

3. Let be maximal such that .

4. If , let .

1. Set .

2. Compute .

3. Return .

5. If , let .

1. Compute .

2. For , set .

3. For ,

1. Set .

2. For , set .

3. Set .

4. Set . While and decrement .

5. If , return .

6. Set .

7. Compute .

8. Return .

6. If , let .

1. Compute .

2. For , set .

3. For ,

1. Set .

2. For , set .

4. Set . While and increment .

5. If , return .

6. Set .

7. Compute .

8. Return .

###### Example 4.

We illustrate the algorithm by tracing it on the input from Example 2.

 e=exp(x int(exp(−x2)))−int(exp(−x2))−3
1. Calling with , we obtain

2. Calling with , we obtain

###### Example 5.

We illustrate the algorithm by tracing it on the input , which is taken from Step 3 of Example 4.

 f=f3−f2−3f1=exp(−x2)f2=int(f1)f3=exp(xf2)

The algorithm is recursive. Hence we trace the recursive calls.

## 4 Proof of Correctness of Algorithm

In this section, we prove that the main algorithm is correct. We need to show the termination and the partial correctness. In the following subsections, we will show them one by one.

### 4.1 Termination

Since the main algorithm consists of a fixed sequence of steps, it suffices to show that the subalgorithms  and terminate. The subalgorithm  terminates since each recursion reduces the value of the natural number until it becomes . Hence, it remains to show that the subalgorithm  terminates. For this, it is convenient to introduce an ordering over .

###### Definition 10 (Ordering).

Let be the function from to such that

Let be the binary relation over such that

 h1≺h2⟺k1

where and . ∎

It is obvious but crucial to note that does not contain infinite -descending chains. In the following we will show that when makes a recursive call, the first argument decreases with . Let be such that it contains at least one of . Let be maximal such that and let . Note

1. .

Note that where .
Hence where .
Thus .

2. .

Note that