Discrete & Continuous Models
#& Applied Computational Science 2021, 29 (4) 337-346
ISSN 2658-7149 (online), 2658-4670 (print) http://journals-rudn-ru/miph
Research article
UDC 519.62
PACS 02.30.Hq, 02.60.Cb, 01.65.+g DOI: 10.22363/2658-4670-2021-29-4-337-346
Calculation of integrals in MathPartner
Gennadi I. Malaschonok1, Alexandr V. Seliverstov2
1 National University of Kyiv-Mohyla Academy 2, Grigory Skovoroda St., Kyiv, 04070, Ukraine 2 Institute for Information Transmission Problems of the Russian Academy of Sciences (Kharkevich Institute) 19-1, Bolshoy Karetny per., Moscow, 127051, Russian Federation
(received: July 21, 2021; accepted: September 22, 2021)
We present the possibilities provided by the MathPartner service of calculating definite and indefinite integrals. MathPartner contains software implementation of the Risch algorithm and provides users with the ability to compute antiderivatives for elementary functions. Certain integrals, including improper integrals, can be calculated using numerical algorithms. In this case, every user has the ability to indicate the required accuracy with which he needs to know the numerical value of the integral. We highlight special functions allowing us to calculate complete elliptic integrals. These include functions for calculating the arithmetic-geometric mean and the geometric-harmonic mean, which allow us to calculate the complete elliptic integrals of the first kind. The set also includes the modified arithmetic-geometric mean, proposed by Semjon Adlaj, which allows us to calculate the complete elliptic integrals of the second kind as well as the circumference of an ellipse. The Lagutinski algorithm is of particular interest. For given differentiation in the field of bivariate rational functions, one can decide whether there exists a rational integral. The algorithm is based on calculating the Lagutinski determinant. This year we are celebrating 150th anniversary of Mikhail Lagutinski.
Key words and phrases: computer algebra system, MathPartner, integral, arithmetic-geometric mean, modified arithmetic-geometric mean, Lagutinski determinant
1. Introduction
The development of computer algebra systems and cloud computing makes it possible to solve many computational problems. Vladimir Petrovich Gerdt was at the forefront of the development of computer algebra. As a professional physicist, he developed new algorithms for solving problems in mathematical physics and implemented them in many well-known systems of computer algebra. He has worked on systems such as REDUCE, Mathematica, Maple, and Singular.
© Malaschonok G.I., Seliverstov A.V., 2021
This work is licensed under a Creative Commons Attribution 4.0 International License http://creativecommons.org/licenses/by/4.0/
Today, many useful programs and cloud services are available. A new generation of computer algebra systems is actively developing. They are cloud-based systems freely available on the Internet. The MathPartner service is a nice example of this [1]—[4]. Free access to the MathPartner service is possible at http://mathpar.ukma.edu.ua/ as well as http://mathpar.com/.
In this review, we consider only a small area of MathPartner application, namely the calculation of definite and indefinite integrals. Symbolic computations and estimates of the computational complexity are of the greatest interest [5]—[9]. However, in some cases, symbolic computations need to be supplemented with numerical methods. In particular, this is true when calculating special functions [10], [11]. For example, elliptic integrals are used to calculate the period of the simple pendulum [12] as well as some properties of porous materials [13], [14].
Robert Henry Risch proposed a method to integrate elementary functions [15], [16]. The method was later improved by Manuel Bronstein [17]. In 2010—2019, an algorithm based on the Liouville— Risch—Davenport—Trager—Bronstein theory was developed at the Laboratory of Algebraic Computations of Derzhavin Tambov State University. A series of papers on symbolic integration algorithms was published by Svetlana Mikhailovna Tararova [18] and Vyacheslav Alekseevich Korabelnikov [19], [20]. The procedures were developed using object-oriented programming in Java. Their description is given in cited publications. Since the symbolic integration theory has not yet been completed, this algorithm can be considered as a good basis for further theoretical and practical development in this important area.
Historically, the first major symbolic integration project was the IBM Scratchpad project led by Richard Dimick Jenks. The development of this project as a commercial one was later stopped by the company. However, he played an important role in the development of the theory of symbolic integration and attracting interest in it.
Many general computer algebra systems today support symbolic integration of elementary functions. However, they all have a common drawback that is the incompleteness of solving the problem of symbolic integration. Another drawback is the lack of a detailed description of the procedural implementation and the technical possibility of further development of the package of procedures. The most famous example is the cloud-based SAGE system, which provides access to old open source packages that have long been discontinued. On the other hand, commercial systems do not give users access to their packages of procedures, and they do not have specialists who can complete the theory of calculating the antiderivative for the composition of simple elementary functions.
Experiments with integration problems from mathematical analysis textbooks show that many problems can be solved using any of the systems such as Mathematica, Maple, and MathPartner. Nevertheless, for each of them, one can find functions that have an antiderivative, but it is not calculated by this system. The MathPartner symbolic integration package is one of the newest packages in this area. It is developed in Java and is the most promising for further development.
In a series of important works, Mikhail Nikolaevich Lagutinski (1871—1915) developed a method for determining integrals of polynomial ordinary differen-
tial equations in finite terms. He also developed the theory of integrability in finite terms of such systems of equations [21]-[23]. Lagutinski was an outstanding mathematician. He had worked at Kharkiv and died during the First World War. In this article, we also consider the Lagutinski method.
Note that he published his papers as Lagoutinsky using the French spelling [24], [25]. The authors are grateful to Mikhail Malykh for comments and historical notes about M. N. Lagutinski.
To calculate the indefinite integral of an elementary function f(x) one can run the command int(f)dx, where x is declared in the environment SPACE. Five number sets Q, R, R64, C, and C64 can be used. Over the field Q, pure symbolic computations are done. For example, let us calculate
f2x sin(xl )dx: SPACE = Q[x]; f = 2*x*\sin(x~2); \int(f) d x;
The output is equal to (-1) cos(x2).
A definite integral f(x) dx can be calculated by means of the command
Nint ( f, a, b, e, N), where £ means the approximation to £ decimals and N denotes the number of points in the Gaussian formula (optional). These parameters can be omitted.
For example, let us calculate 42 decimal places of the integral sin x dx:
SPACE = R[x]; MachineEpsilonR = 42; FLOATPOS = 42; \Nint(\sin(x), 0, \pi);
The output is equal to 2.000000000000000000000000000000000000000000. Next, let us approximate n:
SPACE = R[x]; MachineEpsilonR = 43; FLOATPOS = 42; 2*\Nint(\sqrt(1-x~2), -1,1);
The output is equal to 3.141592653589793238462643383279502884197169. All 42 decimal places are accurate.
2. Integrals of some functions 2.1. Indefinite integrals
Next, let us calculate f(3x2 + 2)2 dx:
SPACE = Q[x]; \int((3x~2+2)~2) d x;
The output is equal to (9/5)x5 + 4x3 + 4x.
2.2. Definite integrals (the numerical algorithm)
'0
Let us consider improper integrals of the first kind I f(t) dt, where a or b
J a
can be equal to ±ix). The integral can be calculated by means of the command Nint(/, a, b, [q1 ,---,qm ],e,N), where [q1 ,---,qm ] denotes the set of extreme points of the function f inside the interval of integration (a, b), the answer is the approximation to £ decimals, and N denotes the number of points in the Gaussian formula (optional). In fact, three parameters [q1,---,qm], e, and N can be omitted. If the extreme points are not indicated, then the correctness of the output is ensured when the integrand is monotonic on the interval of integration.
/+CX)
exp {—(x — h)2} dx\
— C
SPACE = R64[x];
f = \exp\{-(x-5)~2\};
\Nint(f, -\infty, \infty);
The output is equal to 1.77.
/TO
exp{—x} dx\
SPACE = R[x];
MachineEpsilonR = 45; FLOATPOS = 45;
\Nint(\exp(-x), 0, \infty);
The output is equal to 1.000000000000000000000000000000000000000000000, where all 45 decimal places are accurate.
2.3. The complete elliptic integrals
For some improper integrals, more efficient calculation methods are known. Let us consider complete elliptic integrals [10], [12]. For positive numbers a > 0 and b > 0, the complete elliptic integral of the first kind can be calculated by means of the arithmetic-geometric mean
I(a b) = r/2 dy = *
) J0 /a2 cos2 p + b2 sin2 <p 2AGM(a,bY
where AGM(a,6) denotes the arithmetic-geometric mean of a and b. It is equal to the limit of both sequences an and bn, where a0 = a, b0 = b,
an+1 = ~^(an + bn), and bn+1 = VX. The proof is based on the equality
I(a, b) = I ((a + b)/2,Vab). Of course, if a = b, then I(a, a) = n/2a.
On the other hand, the geometric-harmonic mean GHM(a,6) is equal to the limit of both sequences an and bn, where a0 = a, b0 = b, an+1 = /a^b~,
and bn+1 = 2a'nb" . Note that AGM(a,6)GHM(a,t) = ab.
Q,n + bn
Both AGM(a,6) and GHM(a,6) can be calculated in the MathPartner service. For example, let us run the commands, where FLOATPOS denotes the number of decimal places:
SPACE = R64[]; FLOATPOS = 3; a= \AGM(1, 5); g= \GHM(1, 5); \print(a, g);
The output is a = 2.604 and g = 1.920.
The complete elliptic integral of the second kind can be calculated by means of MAGM(). It is also implemented in the MathPartner service. The modified arithmetic-geometric mean MAGM(a, 6) is equal to the limit of the sequence an, where a0 = a, b0 = 6, c0 = 0, an+1 = an + bn/2,
1 = cn + y(an cn)(Pn cn), and cn+1 = cn y(an cn)(Pn cn),
r'2 n>-2-19 • 2 J ^ MAGM(a2,62)
J0 V-2 cos2 ^ + sin AGMM) .
„ , r r „ , MAGM(a2,62) ,
So, the circumference of an ellipse is equal to 2^-——;———, where a
H M AGM(a,6) ,
and b denote the semi-major and semi-minor axes.
2.4. Other special functions The gamma function is defined via a convergent improper integral
/to
xz-1 exp{—x} dx,
0
where Rez > 0. For any positive integer n, T(n) = (n — 1)!. To calculate its value one can run the command Gamma(z).
The beta function, also called the Euler integral of the first kind, is also defined via another integral
B(x,y)= i — t)^-1 di,
0
where both inequalities hold Re x > 0 and Re y > 0. It is closely related to the gamma function because B(x, y) = r(x)T(y)/r(x + y).
To calculate its value one can run the command Beta(x,y). For example, let us verify the equality 5(2,3) = 1/12:
SPACE = R64[]; FLOATPOS = 4; \Beta(2, 3);
The output is equal to 0.0833.
7 ) = 777-"TTT. For suit-
k J A;!(n — k)!
/to
/(t)e-si dt.
To calculate the Laplace transform one can run laplaceTransform(). The inverse Laplace transform can be calculated by inverseLaplaceTransform(). Let us consider an example:
SPACE = R64[t];
L = \laplaceTransform(\exp(3t));
The output is L = —.
y t — 3.0
Next, let us calculate the inverse transform:
SPACE = R64[t];
F = \inverseLaplaceTransform(1/(t - 3)); The output is F = e3t.
3. The Lagutinski determinant
The Lagutinski method allows us to search for rational integrals of a given differential ring [21], [24], [25]. Therefore, it can be used to integrate ordinary differential equations in symbolic form [7], [23].
Let us consider the differential ring Q[x,y] of bivariate polynomials over
d d
the field Q, where the differentiation is given by D = p(x,y)-—+ q(x,y)—.
(J
Let us consider an infinite matrix whose entries are monomials. The first row consists of all bivariate monomials with graduated lexicographical ordering m1, m2, .... The second row consists of the first derivatives Dm1, Dm2, .... The third row consists of the second derivatives D2m1, D2m2, ..., and so on.
In particular, both monomials m2 and m3 are linear. For N = -(d+1)(d+2),
the monomial mN is the last monomial of degree d.
The Lagutinski determinant of order n with respect to the differentiation D is a leading principal minor of order n in this matrix. Of course, the first order Lagutinski determinant is equal to 1 . To calculate the Lagutinski determinant of order n with respect to the differentiation D one can run the command det L(n, [p,x,q,y]).
The significance of this determinant is explained by the following result that was previously obtained by Lagutinski [24], [25], but presented here in a modern formulation, cf. [7], [23]. A non-constant rational function f G Q(x,y) is called an integral when Df vanishes identically.
Theorem 1 (Lagutinski). Given a differentiation D and a positive integer d > 0. The Lagutinski determinant of order N = -(d+ 1)(d + 2) vanishes
if and only if there exists a rational integral whose numerator and denominator are of degree at most d.
d d
For example, if the differentiation is given by D = —--^ then
ox oy
D(x — y) = 0. In accordance with Theorem 1, the third order Lagutinski determinant vanishes:
SPACE = Q[x, y]; p = 1; q = 1; \detL(3, [p, x, q, y]);
The output is equal to zero.
d d
Next, if the differentiation is given by D = x---V^r, then £>(xy) = 0.
In accordance with Theorem 1, the sixth order Lagutinski determinant vanishes. Moreover, the fifth order Lagutinski determinant vanishes too because the fifth monomial coincides with the integral: SPACE = Q[x, y]; p = x; q = -y; \detL(5, [p, x, q, y]);
The output is equal to zero. But the third order Lagutinski determinant
is equal to —2xy. Thus, there does not exist any integral whose numerator
and denominator are linear. Contrariwise, if the differentiation is given
d d fx — y\ by D = x——+ y—, then D (-) =0. In accordance with Theorem 1,
ax ay \x + yj
the third order Lagutinski determinant vanishes: SPACE = Q[x, y]; p = x; q = y; \detL(3, [p, x, q, y]);
The output is equal to zero.
4. Conclusion
The MathPartner service has become better and allows us to solve new problems in geometry and physics. MathPartner supports both symbolic and numerical integration of elementary functions. Moreover, some special functions can be calculated using fast algorithms.
References
[1] G. I. Malaschonok, "Application of the MathPartner service in education," Computer Tools in Education, no. 3, pp. 29-37, 2017, in Russian.
[2] G. I. Malaschonok, "MathPartner computer algebra," Programming and Computer Software, vol. 43, pp. 112-118, 2017. DOI: 10. 1134/ S0361768817020086.
[3] G. I. Malaschonok and I. A. Borisov, "About MathPartner web service," Tambov University Reports. Series: Natural and Technical Sciences, vol. 19, no. 2, pp. 512-516, 2014, in Russian.
[4] G. I. Malaschonok and M. A. Rybakov, "Solving systems of linear differential equations and calculation of dynamic characteristics of control systems in a web service MathPartner," Tambov University Reports. Series: Natural and Technical Sciences, vol. 19, no. 2, pp. 517529, 2014, in Russian.
[5] A. M. Kotochigov and A. I. Suchkov, "A method for reducing iteration in algorithms for building minimal additive chains," Computer Tools in Education, no. 1, pp. 5-18, 2020, in Russian. doi: 10.32603/20712340-2020-1-5-18.
[6] M. D. Malykh, A. L. Sevastianov, and L. A. Sevastianov, "About symbolic integration in the course of mathematical analysis," Computer Tools in Education, no. 4, pp. 94-106, 2019, in Russian. DOI: 10.32603/ 2071-2340-2019-4-94-106.
[7] M. D. Malykh, L. A. Sevastianov, and Yu Ying, "On algebraic integrals of a differential equation," Discrete and continuous models and applied computational science, vol. 27, no. 2, pp. 105-123, 2019. DOI: 10.22363/ 2658-4670-2019-27-2-105-123.
[8] M. D. Malykh, L. A. Sevastianov, and Yu Ying, "On symbolic integration of algebraic functions," Journal of Symbolic Computation, vol. 104, pp. 563-579, 2021. DOI: 10.1016/j.jsc.2020.09.002.
[9] A. V. Seliverstov, "Heuristic algorithms for recognition of some cubic hypersurfaces," Programming and Computer Software, vol. 47, pp. 5055, 2021. DOI: 10.1134/S0361768821010096.
[10] J. M. Borwein and P. B. Borwein, "The arithmetic-geometric mean and fast computation of elementary functions," SIAM Review, vol. 26, no. 3, pp. 351-366, 1984. DOI: 10.1137/1026073.
[11] K. Y. Malyshev, "Calculation of special functions arising in the problem of diffraction by a dielectric ball," Discrete and Continuous Models and Applied Computational Science, vol. 29, no. 2, pp. 146-157, 2021. DOI: 10.22363/2658-4670-2021-29-2-146-157.
[12] S. Adlaj, "An eloquent formula for the perimeter of an ellipse," Notices of the American Mathematical Society, vol. 59, no. 8, pp. 1094-1099, 2012. DOI: 10.1090/noti879.
[13] N. J. Mariani, G. D. Mazza, O. M. Martinez, and G. F. Barreto, "Evaluation of radial voidage profiles in packed beds of low-aspect ratios," The Canadian Journal of Chemical Engineering, vol. 78, no. 6, pp. 1133-1137, 2000. DOI: 10.1002/cjce.5450780614.
[14] B.-X. Xu, Y. Gao, and M.-Z. Wang, "Particle packing and the mean theory," Physics Letters A, vol. 377, no. 3-4, pp. 145-147, 2013. DOI: 10.1016/j.physleta.2012.11.022.
[15] R. H. Risch, "The problem of integration in finite terms," Transactions of the American Mathematical Society, vol. 139, pp. 167-189, 1969. DOI: 10.2307/1995313.
[16] R. H. Risch, "The solution of the problem of integration in finite terms," Bulletin of the American Mathematical Society, vol. 76, no. 3, pp. 605608, 1970. DOI: 10.1090/S0002-9904-1970-12454-5.
[17] M. Bronstein, "The transcendental Risch differential equation," Journal of Symbolic Computation, vol. 9, pp. 49-60, 1990. DOI: 10.1016/S0747-7171(08)80006-5.
[18] S. M. Tararova, "To the problem of constructing an algorithm for symbolic integration," Tambov University Reports. Series: Natural and Technical Sciences, vol. 17, no. 2, pp. 607-616, 2012, in Russian.
[19] V. A. Korabelnikov, "Symbolic integration algorithms in CAS MathPartner," Tambov University Reports. Series: Natural and Technical Sciences, vol. 24, no. 125, pp. 75-89, 2019, in Russian. DOI: 10.20310/18100198-2019-24-125-75-89.
[20] V. A. Korabelnikov, "Procedural interpretation of symbolic integration algorithms in MathPartner system," Tambov University Reports. Series: Natural and Technical Sciences, vol. 24, no. 126, pp. 166-178, 2019, in Russian. DOI: 10.20310/1810-0198-2019-24-126-166-178.
[21] V. A. Dobrovol'skii, N. V. Lokot', and J.-M. Strelcyn, "Mikhail Nikolae-vich Lagutinskii (1871-1915): Un Mathématicien Méconnu," Historia Mathematica, vol. 25, no. 3, pp. 245-264, 1998. DOI: 10. 1006/hmat. 1998.2194.
[22] V. A. Dobrovol'skii, N. V. Lokot', and J.-M. Strelcyn, "Mikhail Nikolae-vich Lagutinskii (1871-1915)," Istoriko-Matematicheskie Issledovaniya, vol. 6, pp. 111-127, 2001, in Russian.
[23] M. D. Malykh, "On application of M. N. Lagutinski method to integration of differential equations in symbolic form. Part 1," RUDN Journal of Mathematics, Information Sciences and Physics, vol. 25, no. 2, pp. 103112, 2017, in Russian. DOI: 10.22363/2312-9735-2017-25-2-103-112.
[24] M. N. Lagoutinsky, "Application des opérations polaires à l'intégration des équations différ. ordinaires sous forme finie," Communications de la Société mathématique de Kharkow. 2-ée série, vol. 12, pp. 111-243, 1911, in Russian.
[25] M. N. Lagoutinsky, "Sur certains polynômes, liés à l'intégration algébrique des équations différentielles ordinaires algébriques," Communications de la Société mathématique de Kharkow. 2-ée série, vol. 13, no. 4-5, pp. 200-224, 1912, in Russian.
For citation:
G. I. Malaschonok, A. V. Seliverstov, Calculation of integrals in MathPartner, Discrete and Continuous Models and Applied Computational Science 29 (4) (2021) 337-346. DOI: 10.22363/2658-4670-2021-29-4-337-346.
Information about the authors:
Malaschonok, Gennadi I. — Doctor of Physical and Mathematical Sciences, Professor, Department of Informatics, National University of Kyiv-Mohyla Academy (NaUKMA) (e-mail: [email protected], phone: +380444256064, ORCID: https://orcid.org/0000-0002-9698-6374, ResearcherlD: F-8856-2015, Scopus Author ID: 14054474400) Seliverstov, Alexandr V. — Candidate of Physical and Mathematical Sciences, Leading researcher, Institute for Information Transmission Problems of the Russian Academy of Sciences (e-mail: [email protected], phone: +74956943338, ORCID: https://orcid.org/0000-0003-4746-6396, ResearcherID: W-1003-2018, Scopus Author ID: 10439983500)
УДК 519.62
РАСЯ 02.30.Hq, 02.60.Cb, 01.65 + DOI: 10.22363/2658-4670-2021-29-4-337-346
Вычисление интегралов в MathPartner
Г. И. Малашонок1, А. В. Селиверстов2
1 Национальный университет «Киево-Могилянская академия» ул. Григория Сковороды, д. 2, Киев, 04655, Украина 2 Институт проблем передачи информации им. А. А. Харкевича РАН Большой Каретный пер., д. 19-1, Москва, 127051, Россия
В статье рассмотрены возможности сервиса Ма^РаЛпег по вычислению определённых и неопределённых интегралов. МаШРаЛпег содержит программную реализацию алгоритма Риша и предоставляет пользователям возможность вычислять первообразные для элементарных функций. Некоторые интегралы, в том числе несобственные, можно вычислить с помощью численных алгоритмов. В этом случае каждый пользователь может указать необходимую точность, с которой ему необходимо знать числовое значение интеграла. Отметим специальные функции, которые позволяют вычислять полные эллиптические интегралы. К ним относятся функции для вычисления арифметико-геометрического среднего и геометрическо-гармонического среднего, которые позволяют вычислять полные эллиптические интегралы первого рода. Набор также включает модифицированное арифметико-геометрическое среднее, которое предложил Семён Адлай, что позволяет вычислять полные эллиптические интегралы второго рода и длину (периметр) эллипса. Особый интерес представляет алгоритм Лагутин-ского. Для данного дифференцирования в поле рациональных функций от двух переменных можно решить, существует ли рациональный интеграл. Алгоритм основан на вычислении определителя Лагутинского. В этом году мы отмечаем 150-летие со дня рождения Михаила Лагутинского.
Ключевые слова: система компьютерной алгебры, МаЛРаЛпег, интеграл, арифметико-геометрическое среднее, модифицированное арифметико-геометрическое среднее, определитель Лагутинского