1 Introduction

Systems consisting of several interacting bodies can move in the environment by changing their configuration while the points of contact of bodies with the environment remain unchanged. This distinguishes such systems from traditional mobile systems, for example, wheeled or walking ones. The principle of motion of systems with a variable configuration is that under the action of internal forces of interaction between bodies, their velocities change and, accordingly, the resistance forces of the medium change. These resistance forces are external to the system and affect the motion of the system as a whole. Therefore, by controlling the internal forces of the interaction between bodies, it is possible to control the motion of the system as a whole. The examples of locomotion systems, that move due to the change of their configurations, are capsule systems, snake-like multilink systems, worm-like systems of several interacting bodies. Such systems with variable configuration can model the motion of snakes, eels, frogs, worms. The issues of biomechanics of worm-like and serpentine motions of living beings are covered in the books [1, 2]. Systems with variable configuration also model robotic systems, corresponding mathematical models are considered in the monographs [3, 4].

The rectilinear motion of a system of several interacting bodies was studied in [5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]. The control was determined either by specifying the forces of interaction between the bodies of the system, or by specifying the law of change in the relative positions of bodies, the bodies were modeled by point masses. Motion in a viscous medium or on a plane with dry friction was considered. The motions of the system were studied, in which its configuration changes periodically. The problems of optimal control and optimization of the motion of the system were solved in order to maximize its average speed of motion or minimize friction losses.

The simplest locomotion system moving due the change of its configuration consists of two interacting bodies. The case where each of these two bodies interacts with the media was studied in [5,6,7,8,9,10, 24,25,26,27]. The papers [5,6,7,8,9] studied the rectilinear motion of such a system along a horizontal rough plane in the presence of dry friction forces. In [5], friction was considered isotropic, and the distance between the bodies varied according to a given periodic law. A condition was found for this law, in which the system moves along a straight line over time. In [6], the force of interaction between bodies was defined by a piecewise constant periodic function of time. It was assumed that the friction is isotropic, and the distance between the bodies varies within specified limits. The parameters of the system and the control law that maximize the average speed of the system were found. In the paper [7], it was assumed that the friction between one body and a plane is isotropic, while the friction between another body and a plane is anisotropic. It was assumed that the relative velocity of the bodies is a piecewise constant function of time, and the distance between the bodies varies within specified limits. The system parameters were optimized in order to maximize the average speed of the system and minimize friction losses. In the paper [8], the problem of optimal control of a system of two bodies was solved in order to move it along a straight line for a given distance in the shortest time. In particular, the problem was solved under an additional condition prohibiting the reverse motion of bodies. Under this condition, a minimum of friction losses in the system is also achieved. The paper [10] considered the rectilinear motion of a system of two bodies in media with dry or viscous frictions. It was assumed that the friction force is much less than the force of interaction between the bodies. For a system described by averaged equations of motion, a necessary and sufficient condition for the system to move along a straight line was obtained in the case where the resistance of the medium is described by a power law. In the case of dry friction, it is established that the system can advance along a straight line if and only if the sum of the lengths of the time intervals on which the distance between the bodies increases is not equal to the sum of the lengths of the time intervals on which the distance between the bodies decreases. Papers [24, 25] considered the motion of two interacting magnetizable bodies subjected to an alternating magnetic field in a viscous media. The motion of two interacting bodies along a line of maximum slope on an inclined rough plane was investigated in [26] under the assumption that the friction coefficient is small. Two-dimensional motion of two interacting bodies on an inclined rough plane was studied in [27]. It was proved, that the system can be brought to an arbitrarily small vicinity of any given position.

Locomotion systems consisting of two interacting bodies, where one of the bodies does not interact with a medium (capsule systems) are widely studied [28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57]. Such systems has potential applications in pipeline inspection, drug delivery, capsule endoscopy [50,51,52,53,54,55,56,57]. Capsule systems moving rectilinearly along a rough plane due to a rotation of an internal mass were considered in [28,29,30]. Papers [31, 32] considered the motion of a capsule system controlled by a motion of an internal inverted pendulum. In papers [46, 47], a capsule system moved along a horizontal line on a rough plane, while an internal mass moved along an inclined line. Most of the papers on capsule systems considered the case where an internal mass moved along a line parallel to a line of motion of the capsule [33,34,35,36,37,38,39,40,41,42,43,44,45, 48,49,50,51,52,53,54,55,56,57]. Various capsule designs and different excitations of an internal mass were studied. In papers [48,49,50,51,52,53,54,55,56,57], an inner mass of a capsule interacted with the capsule and was subjected to an external force. Dynamics of a capsule system was investigated in the cases where it moved in viscous media [41,42,43,44,45] or along a surface with dry friction [37,38,39,40], various optimization problems were solved [33, 41, 42, 48, 53]. The stability of the motion was studied for viscous [11, 45] and dry [12] friction.

Systems consisting of three or more interacting bodies were studied in [13,14,15,16,17,18,19]. It was shown that with linear resistance, such systems (as well as systems consisting of two bodies) cannot move along a straight line, namely, when the distance between the bodies of the system is bounded, the center of mass of the system remains in a bounded area [13]. For the power law of medium resistance and for dry friction, the motion of a system of several bodies along a straight line was studied in [14]. It was assumed that the resistance forces of the medium are small in comparison with the forces of interaction acting between bodies, and the configuration of the system changes in waves, so that the relative motion of each pair of neighboring bodies repeats the relative motion of the nearest pair of bodies with a constant delay. For the averaged system of equations of motion, conditions are obtained that allow the system to start motion from a state of rest and to carry out a motion in which the velocity of the center of mass tends to a constant value. In the case where the system consists of three bodies and the distance between the bodies varies according to some piecewise linear law, the motion of the system is studied in detail. In [15], the motion of a system of three bodies along a straight line in a medium with quadratic resistance was investigated. The case was studied in which one of the bodies of the system does not change the direction of its motion, and the other two move cyclically forward and backward, and the resistance of the medium for these bodies is anisotropic. Dynamics of three-body system, where distances between the bodies change according to a prescribed law, along a line with dry anisotropic friction was studied in [58]. Rectilinear motion of a system of several capsules connected by passive springs and controlled by motions of internal bodies was investigated in [59], both viscous and dry friction resistances were considered. The motion of the system of several interacting bodies upward an inclined line with dry isotropic friction was investigated in [60], conditions allowing such a motion were obtained. In [16], the stability of motion of a system consisting of several interacting bodies with periodically changing configuration was studied for the case of viscous resistance.

A system consisting of several identical interacting bodies is studied in the current paper as well as in [17, 18]. In [17], the motion of several identical bodies along a straight line with dry friction was considered. The problem of optimal control of the system was solved in order to maximize its shift in a fixed time. It was assumed that all bodies have zero velocities and the same positions at the beginning and at the end of the motion. There were no restrictions on the forces of interaction between bodies. The non-uniqueness of the optimal solution was shown and an optimal solution was constructed in which the distance between any two bodies does not exceed a given value over the entire interval of motion.

The rectilinear motion of several identical interacting bodies in media with piecewise linear and piecewise quadratic resistance was investigated in [18]. This paper is the closest to the current research. In [18], it was assumed that the momentum of the system is not zero at the initial moment of time. A motion was constructed that allows the system to be shifted along a straight line by a given distance, provided that the velocity of each of the bodies at the beginning and at the end of the motion is the same. The forces of interaction between bodies were assumed to be unbounded. In the proposed algorithm, the intervals of free motion of bodies alternated with moments of time in which the momentum of the system was instantly redistributed between the bodies. At each interval of free motion of bodies, one of the bodies moved backward, and all the others moved forward with the equal velocity. The paper did not consider the problem to arrange the motion of the system in the case where the system is at rest at the initial moment of time.

In the current paper, we consider the rectilinear motion of a system of several identical interacting bodies in a medium with quadratic friction. This system is a model of a robotic locomotion system that moves in a viscous medium due to changes in its configuration. The locomotion systems with variable configuration do not have wheels, screws or tracks and may be applied for transport or inspection purposes in vulnerable or aggressive media, in cramped spaces, cracks or crevices. A locomotion system consisting of several bodies that move rectilinearly due to changes in its configuration in a resistive media can be constructed with the use of prismatic joints connecting the neighboring bodies and can be controlled by actuators. An example of such design is a prototype of a system consisting of three bodies constructed in [19] with the use of energy chains and two DC motors. The novelty of our research, is that, in comparison with [18], we solve the problem of moving the system to a given distance between two states of rest. Moreover, we propose new algorithm for the motion of the system, such that the velocity of the center of mass of the system is constant and the velocity of each of the bodies is piecewise constant throughout the entire motion. This algorithm of motion is optimized in order to maximize the velocity of the center of mass under the constraint on the velocity of each of the bodies.

Fig. 1
figure 1

Example of mechanical system, \(N=3\)

2 Problem statement

The rectilinear motion of a system of N, \(N\ge 3\), identical interacting bodies \(A_i\), \(i=1,\dots ,N\), in a medium with quadratic friction is considered, see Fig. 1. Interaction forces act between each pair of adjacent bodies \(A_i\), \(A_{i+1}\). The bodies are modeled as point masses. The influence of these forces leads to a change in the velocities of the bodies, so that the resistance forces of the medium acting on the bodies change. These forces are external to the system. Thus, by controlling the forces of interaction between bodies, which are internal to the system, it is possible to control the motion of the system as a whole. We will construct such control forces of interaction allowing to shift the system by the prescribed distance so that its configuration and the velocities of all bodies are the same at the beginning and at the end of the motion. Such a motion can be continued periodically allowing to move the system arbitrarily far.

Denote the force acting from the body \(A_{i+1}\) on the body \(A_{i}\) by \(F_i\), \(i=1,\dots ,N-1\). It is assumed that the magnitudes of the interaction forces \(F_i\) are not bounded. The mass of each of the bodies \(A_i\), \(i=1,\dots ,N\), is equal to m. Denote by \(x_i\) the coordinates of the bodies \(A_i\) on the line of their motion, and by \(v_i\) the velocities of these bodies. The equations of motion of the system of bodies along the straight horizontal line have the form

$$\begin{aligned}{} & {} \dot{x}_i=v_i,\quad i=1,\dots ,N, \end{aligned}$$
(1)
$$\begin{aligned}{} & {} \begin{array}{lll} m\dot{v}_1=&{}F_1+ &{}R(v_1), \\ m\dot{v}_i=&{}F_i-F_{i-1}+&{}R(v_i),\quad i=2,\dots ,N-1, \\ m\dot{v}_N=&{}-F_{N-1}+ &{}R(v_N), \end{array} \end{aligned}$$
(2)

where the forces of quadratic resistance of the medium \(R(v_i)\) are determined by the relation

$$\begin{aligned} R(v_i)=-cv_i\vert v_i\vert ,\quad i=1,\dots ,N. \end{aligned}$$
(3)

We assume that at the initial time instant \(t=0\) all the bodies are at the origin. That is, the following equalities are valid:

$$\begin{aligned} x_i(0)=0,\quad v_i(0)=v_i^0, \quad i=1,\dots ,N. \end{aligned}$$
(4)

The assumption that the coordinates of all bodies are equal to zero at the initial time instant does not limit the generality. If \(x_i(0) \ne 0\), then by replacing the variable \(\tilde{x}_i = x_i - x_i(0)\), with respect to which the equations of motion (1), (2) are invariant, the equality \(\tilde{x}_i (0) = 0\) is achieved.

We study the motions in which the system moves over a given distance L, provided that the configuration of the system and the velocities of each of the bodies is the same at the beginning and at the end of the motion:

$$\begin{aligned} x_i(T)= & {} L,\quad i=1,\dots ,N, \end{aligned}$$
(5)
$$\begin{aligned} v_i(T)= & {} v_i(0), \quad i=1,\dots ,N, \end{aligned}$$
(6)

where T is the time of the motion, which is not set in advance, and \(L>0\). Let us formulate the following problem.

Problem 1

Find the motion of the system of bodies defined by the relations (14) and satisfying the conditions (5), (6).

Denote by x and v the coordinate and the velocity of the center of mass of the system:

$$\begin{aligned} x=\frac{1}{N}\sum _{i=1}^N x_i, \quad v=\frac{1}{N}\sum _{i=1}^N v_i. \end{aligned}$$
(7)

The motion of the center of mass obeys the relations

$$\begin{aligned} \dot{x}=v, \quad Nm\dot{v} = \sum _{i=1}^N R(v_i). \end{aligned}$$
(8)

We assume that the interaction forces \(F_i\) are not bounded, allowing instantaneous changes in the velocities of the bodies of the system. Let in the neighborhood \((\tilde{t} -\sigma ,\tilde{t}+\sigma )\) of some time instant \(\tilde{t}\) these forces are given as follows: \(F_i(t)=b_i\delta (t-\tilde{t})+f_i(t)\), where \(\delta (t)\) is the Dirac delta function, \(f_i(t)\) are bounded on \([\tilde{t}-\sigma ,\tilde{t}+\sigma ]\) and are continuous on the segments \([\tilde{t}-\sigma ,\hat{t})\) and \((\tilde{t},\tilde{t}+\sigma ]\). Integrating the equations of motion (2) on the segment \((\tilde{t}-\sigma ,\tilde{t}+\sigma )\) with \(\sigma \) tending to zero, and taking into account the boundness of \(f_i(t)\) and \(R(v_i(t))\), we get

$$\begin{aligned} \begin{array}{lll} v_1(\tilde{t}+0) - v_1(\tilde{t}-0) = \displaystyle \frac{b_1}{m}, \\ v_i(\tilde{t}+0) - v_i(\tilde{t}-0) = \displaystyle \frac{b_i-b_{i-1}}{m},\\ v_N(\tilde{t}+0) - v_N(\tilde{t}-0) = -\displaystyle \frac{b_{N-1}}{m}, \end{array} \end{aligned}$$
(9)

where \(i=2,\dots ,N-1\). Summing up these equalities, we obtain that the velocity of the center of mass is continuous at the time instant \(\tilde{t}\):

$$\begin{aligned} v(\tilde{t}+0)=v(\tilde{t}-0). \end{aligned}$$
(10)

By choosing the coefficients \(b_i\) according to the equalities (9), it is possible to arbitrarily change the velocities of the bodies of the system at time \(\tilde{t}\), provided that the velocity of the center of mass (7) is continuous in \(\tilde{t}\), that is, the condition (10) is met. Thus, using the unlimited in magnitude forces, it is possible to instantly redistribute the momentum of the system between bodies without changing the velocity of the center of mass. Further in the paper, we are using this possibility to control the system.

3 Motion with a constant velocity of the center of mass

Suppose that the velocity of the center of mass of the system is positive at some time instant \(t_0\), \(v(t_0)=v_*>0\). In this case, we construct such a motion of the system in which the velocity of the center of mass is constant throughout the entire time of motion, \(v(t)\equiv v_*\), \(t\ge t_0\), and the velocity of each of the bodies is piecewise constant. Let the velocities of bodies on the interval \([t_0,t_1)\) are set by relations

$$\begin{aligned} v_i(t)\equiv a_i, \quad i=1,\dots ,N, \quad t\in [t_0,t_1), \end{aligned}$$
(11)

so that, the following equality is fulfilled:

$$\begin{aligned} \frac{1}{N}\sum _{i=1}^N a_i=v_*. \end{aligned}$$
(12)

We are going to indicate what conditions the values \(a_i\) must satisfy and how to choose the forces of interaction between bodies in order to realize a motion with constant velocities (11) on the interval \([t_0,t_1)\). At a constant velocity of the center of mass, by virtue of (8), on the interval \([t_0,t_1)\) the sum of the resistance forces of the medium acting on the bodies is zero:

$$\begin{aligned} \sum _{i=1}^N R(v_i(t))\equiv 0. \end{aligned}$$

Therefore, taking into account (3) and (11), the values \(a_i\) must satisfy the relation

$$\begin{aligned} \sum _{i=1}^N a_i|a_i |= 0. \end{aligned}$$
(13)

At that, the motion with constant velocities (11) is realized when the forces of interaction are defined as follows:

$$\begin{aligned} F_i=-\sum _{j=1}^i R(v_j)=\sum _{j=1}^i c a_j|a_j|, \end{aligned}$$
(14)

where \(i=1,\dots ,N-1\).

The velocities \(a_i\) satisfying the equalities (12) and (13) can be chosen in various ways for \(N\ge 3\). For example, we can assume that one of the bodies moves backward, and all the others move forward with equal velocities, so that,

$$\begin{aligned} a_1= & {} -\frac{N}{\sqrt{N-1}-1}v_*,\\ a_i= & {} \frac{N}{\sqrt{N-1}(\sqrt{N-1}-1)}v_*, \quad i=2,\dots ,N. \end{aligned}$$

Note that the equalities (12) and (13) under the condition \(v_*>0\) are incompatible for \(N=1\) or \(N=2\).

Let us define the motion of the system in which the velocities of all bodies are constant on time intervals \((t_k,t_{k+1})\), \(k=0,\dots ,N-1\), and change cyclically, that is, the velocity of the body \(A_i\) at each subsequent time interval is equal to the velocity of the body \(A_{i+1}\) on the previous interval. At that, the velocity of the center of mass is the same for all intervals. At the points \(t_k\), \(k=1,\dots ,N-1\), the velocities of the bodies of the system change instantly.

The motion of bodies on the interval \([t_0,t_1)\) is defined by the formula (11). The velocities of the bodies of the system over the interval \((t_1,t_2)\) are set as follows:

$$\begin{aligned} \begin{array}{lll} v_i(t)\equiv a_{i+1}, &{} i=1,\dots ,N-1, &{}t\in (t_1,t_2),\\ v_{N}(t)\equiv a_{1}, &{}t\in (t_1,t_2).&{} \end{array} \end{aligned}$$
(15)

Sets of values of velocities of bodies on intervals \((t_0,t_1)\) and \((t_1,t_2)\) coincide, while the velocity of the body \(A_i\) on the interval \((t_1,t_2)\) is equal to the velocity of the body \(A_{i+1}\) on the interval \((t_0,t_1)\), \(i=1,\dots ,N-1\), and the velocity of the body \(A_N\) on the interval \((t_1,t_2)\) is equal to the velocity of the body \(A_1\) on the interval \((t_0,t_1)\). The values of the velocities of the bodies given by the relations (15) satisfy (12) and (13), therefore, such a motion of the system on the interval \((t_1,t_2)\) is also a motion with a constant velocity of the center of mass \(v_*\). It is realized by defining internal forces in accordance with (14) up to the renumbering of bodies. The velocities of the bodies of the system at time \(t_1\) instantly change from \(v_i(t_1-0)=a_i\) to \(v_i(t_1+0)=a_{i+1}\) due to the redistribution of momentum. Such a redistribution is possible because at time instant \({\tilde{t}} = t_1\) equality (10) is fulfilled.

Fig. 2
figure 2

The motion of the system consisting of \(N=3\) bodies with a constant velocity of the center of mass. Velocities of the bodies \(v_1(t)\), \(v_2(t)\), and \(v_3(t)\) are shown in figures a, b, and c. Velocities are piecewise constant and change cyclically on \([0\text {s},10\text {s}]\), here, \(t_0\) = 0 s, \(t_1\) = 10/3 s, \(t_2\) = 20/3 s, \(t_N=t_3\) = 10 s. The motion defined at \([t_0,t_N]\) is repeated so that the total time of motion is 20 s

Similarly, the velocities of the bodies of the system are set on all intervals \((t_k,t_{k+1})\), \(k=0,\dots N-1\) by

$$\begin{aligned} \begin{array}{lll} v_i(t)\equiv a_{i+k}, &{} i=1,\dots ,N-k, &{} t\in (t_k,t_{k+1}),\\ v_{i}(t)\equiv a_{i-N+k}, &{} i\in [N-k+1,N], &{} t\in (t_k,t_{k+1}). \end{array} \end{aligned}$$
(16)

The sets of values of the velocities of bodies on all intervals \((t_k,t_{k+1})\), \(k=0,\dots N-1\) are the same. The center of mass of the system moves at the constant velocity \(v_*\) on all these intervals. The motion is realized by selecting the internal forces specified according to (14) up to the corresponding renumbering of bodies. The velocities of the bodies of the system at time points \(t_k\), \(k=1,\dots N-1\), instantly change from \(v_i(t_k-0)\) to \(v_i(t_k+0)\) due to the redistribution of the momentum. At the moment of time \(t_N\), due to the redistribution of momentum, the velocities of all bodies instantly change so that the velocity of the body \(A_i\) becomes equal to \(a_i\), \(i=1,\dots N\). Thus, on the time interval \([t_0,t_N]\), the motion of the system with the constant velocity of the center of mass \(v_*\) and piecewise constant velocities of bodies is constructed. It is such that

$$\begin{aligned} v_i(t_N)=v_i(0),\quad i=1,\dots N. \end{aligned}$$
(17)

Let us calculate the shift \(l_i=x_i(t_N)-x_i(t_0)\) of each of the bodies \(A_i\) over the time interval \([t_0,t_N]\). Denote the durations of the intervals \([t_{k-1},t_{k}]\) as \(\tau _k\):

$$\begin{aligned} \tau _k=t_k-t_{k-1},\quad k=1,\dots ,N. \end{aligned}$$

Since the velocities of bodies on the interval \([t_0,t_N]\) are given by the relations (16), we have

$$\begin{aligned} l_i=\sum _{k=1}^{N-i+1} a_{i+k-1} \tau _k + \sum _{k=N-i+2}^{N}a_{k-N+i-1}\tau _k. \end{aligned}$$
(18)

We construct a motion in which the displacements of all bodies over the interval \([t_0,t_N]\) are the same. For that, let us put the durations of all intervals \([t_{k-1},t_{k}]\) equal to the same value,

$$\begin{aligned} \tau _k=\tau ,\quad k=1,\dots ,N, \end{aligned}$$

where

$$\begin{aligned} \tau =(t_N-t_0)/N. \end{aligned}$$
(19)

In this case, the time instants \(t_k\) are calculated as

$$\begin{aligned} t_k=t_0+\tau k,\quad k=0,\dots ,N, \end{aligned}$$
(20)

and the shifts \(l_i\) of all bodies over the interval \([t_0,t_N]\) are the same:

$$\begin{aligned} l_i=l=\sum _{k=1}^{N} a_{k} \tau ,\quad i=1,\dots ,N. \end{aligned}$$
(21)

Taking into account (12) and (19), the formula (21) takes the form

$$\begin{aligned} l=v_*(t_N-t_0). \end{aligned}$$
(22)

Thus, on the time interval \([t_0,t_N]\), the motion of the system with the constant velocity of the center of mass \(v_*\) and piecewise constant velocities of bodies is constructed. The shift of each of the bodies of the system over this interval is equal to l. The velocities of each of the bodies at the initial and at the terminal moments of time are the same. Note that such a motion can be periodically continued over the interval \([t_0,\infty )\) so that the velocities \(v_i(t)\) will be periodic functions with a period equal to \(t_N-t_0\).

Fig. 3
figure 3

Coordinates of the bodies in the motion with a constant velocity of the center of mass. The system consists of \(N=3\) bodies. Coordinates of the bodies \(x_1(t)\), \(x_2(t)\), and \(x_3(t)\) are shown by blue lines, the coordinate of the center of mass x(t) is shown by the red line. The velocities of the bodies are shown in Fig. 2

Figures 2, 3 show the motion of the system with the piecewise constant velocities of each body and with the constant velocity of the center of mass. The number of bodies N is equal to 3, the mass of each body is 1 kg, c = 0.1 kg/m, \(t_0\) = 0 s, the value of \(t_N\) is 10 s, the time of motion is equal to 20 s. The initial positions of the bodies are: \(x_1(0)=0\) m, \(x_2(0)=3\) m, \(x_3(0)=15\) m, the initial velocities are: \(v_1(0)=-\sqrt{5}\) m/s, \(v_2(0)=1\) m/s, \(x_3(0)=2\) m/s. The velocities of the bodies \(v_1(t)\), \(v_2(t)\), and \(v_3(t)\) are represented in the Fig. 2a–c correspondingly. Figure 3 shows the coordinates of the bodies (blue lines) and the position of the center of mass of the system (the red line).

4 Solution of problem 1

4.1 Solution for the case \(v(0)>0\)

Using the results from the previous section, we obtain a solution to Problem 1 in the case where the velocity of the center of mass of the system at the initial moment of time is positive, \(v(0)>0\). Let us put

$$\begin{aligned} t_0=0, \quad t_N=\frac{L}{v(0)}. \end{aligned}$$
(23)

The motion defined by (16), (19), (20), (23) is the solution of Problem 1 on the interval [0, T], where \(T=t_N\). The conditions (5) and (6) are met for such a motion due to the relations (22) and (17). In the constructed motion, the velocities of all bodies are piecewise constant, and the velocity of the center of mass is constant and equal to \(v_*=v(0)\).

4.2 Solution for the case \(v(0)=0\)

Now we find a solution to Problem 1 in the case where the velocity of the center of mass is zero, \(v(0)=0\). In particular, this condition is satisfied if all bodies are stationary at the initial moment of time. Due to the instantaneous redistribution of momentum, any problem with \(v(0)=0\) can be reduced to the problem where all bodies are initially at rest. Thus, without loss of generality, we assume that all bodies are at rest at the beginning of the motion: \(v_i(0)=0\), \(i=1,\dots ,N\). We construct the solution to Problem 1 for \(L>0\). The motion that is the solution to Problem 1 consists of three stages. At the first stage, the bodies are instantly given initial velocities, and then they move for a while without interacting with each other. At the second stage, the velocity of the center of mass of the system is constant, and each of the bodies moves with a piecewise constant velocity. At the beginning of the third stage, the velocities of the bodies change instantly, then the bodies move without interacting with each other, and at the end they stop instantly.

At the first stage, at the initial moment of time \(t=0\), we redistribute the zero momentum of the system as follows:

$$\begin{aligned} \begin{array}{l} v_1(0)=-(N-1)p,\\ v_i(0)=p,\quad i=2,\dots ,N, \end{array} \end{aligned}$$
(24)

where \(p>0\). Next, let each of the bodies move freely for a certain time interval, without interacting with the other bodies and experiencing only the resistance of the medium. At that, the following equations are fulfilled:

$$\begin{aligned} \begin{array}{l} m\displaystyle \frac{\textrm{d}}{\textrm{d}t}v_1=c v_1^2, \\ ~\\ m\displaystyle \frac{\textrm{d}}{\textrm{d}t} v_i=-cv_i^2, \quad i=2,\dots ,N. \end{array} \end{aligned}$$
(25)

The solutions to equations (25) with initial conditions (24) are the functions

$$\begin{aligned} \begin{array}{l} v_1(t)=-\displaystyle \frac{1}{\displaystyle \frac{c}{m}t+\displaystyle \frac{1}{(N-1)p}},\\ ~\\ v_2(t)=\displaystyle \frac{1}{\displaystyle \frac{c}{m}t+\displaystyle \frac{1}{p}}, ~\\ \\ v_i(t)=v_2(t),\quad i=3,\dots ,N. \end{array} \end{aligned}$$
(26)

On the interval of free motion, the velocities of all bodies, except the first one, are the same. Using (26), it can be shown that the ratio of the velocity modulus of the first body to the velocity of any other body tends to 1 over time:

$$\begin{aligned} \lim _{t \rightarrow \infty }\frac{\vert v_1(t)\vert }{v_2(t)}= 1. \end{aligned}$$

At the initial moment of time, this ratio is at least 2, since \(N\ge 3\):

$$\begin{aligned} \frac{\vert v_1(0)\vert }{v_2(0)}= N-1\ge 2. \end{aligned}$$

Therefore, there is such a moment of time \(t_0\) when this ratio is equal to \(\sqrt{N-1}\),

$$\begin{aligned} \frac{\vert v_1(t_0)\vert }{v_2(t_0)}=\sqrt{N-1}. \end{aligned}$$

It follows from the formulas (26) that

$$\begin{aligned} t_0=\frac{m}{cp\sqrt{N-1}}. \end{aligned}$$
(27)

At time instant \(t_0\), the velocities of the bodies are equal to

$$\begin{aligned} \begin{array}{l} v_1(t_0)=-p\displaystyle \frac{N-1}{\sqrt{N-1}+1},\\ ~\\ v_i(t_0)=p\displaystyle \frac{\sqrt{N-1}}{\sqrt{N-1}+1},\quad i=2,\dots ,N. \end{array} \end{aligned}$$
(28)

and the coordinates of the bodies are determined as follows:

$$\begin{aligned} \begin{array}{l} x_1(t_0)=-\displaystyle \frac{m}{c}\ln (\sqrt{N-1}+1),\\ ~\\ x_i(t_0)=\displaystyle \frac{m}{c}\ln \left( \frac{1}{\sqrt{N-1}}+1\right) ,\quad i=2,\dots ,N. \end{array} \end{aligned}$$
(29)

Note that the shifts of bodies at the first stage of motion do not depend on p, that is, on the values of the velocities that we gave to the bodies at the beginning of the motion. The velocity of the center of mass of the system is positive and equal to

$$\begin{aligned} v(t_0)=p\frac{N-1}{N}\frac{\sqrt{N-1}-1}{\sqrt{N-1}+1}. \end{aligned}$$
(30)

At the moment of time \(t=t_0\), the first stage of the motion ends.

At the second stage, we are constructing the motion of the system with a constant velocity of the center of mass and with piecewise constant velocities of each of the bodies. Motion with a constant velocity of the center of mass of the system and with the values of the velocities of bodies from the set \(\mathfrak {A}=\{a_1,\dots ,a_N\}\) is described in the previous section. Let us put the values \(a_i\) equal to the velocities of the bodies \(A_i\) at the end of the first stage of motion,

$$\begin{aligned} a_i=v_i(t_0),\quad i=1,\dots ,N, \end{aligned}$$

where \(v_i(t_0)\) are defined by the formulas (28). By virtue of these formulas we have:

$$\begin{aligned} a_1=-a\sqrt{N-1},\quad a_i=a,\quad i=2,\dots ,N, \end{aligned}$$
(31)

where

$$\begin{aligned} a=p\frac{\sqrt{N-1}}{\sqrt{N-1}+1}, \end{aligned}$$

that is, all \(a_i\), \(i=2,\dots ,N\) are equal to each other. Such \(a_i\) satisfy the relation (13), so the motion of the system of bodies defined by formulas (16) is possible. In this motion, the velocity of the center of mass v(t) is constant and equal to \(v(t_0)\), where \(v(t_0)\) is defined by the equality (30). Throughout the second stage, one of the bodies, in turn, moves backwards, and all the others move forward at the same velocity. The shift of the bodies of the system at the second stage is determined by the relations (18). Taking into account (31), the relations (18) take the following form:

$$\begin{aligned} l_i=a_1 \tau _i + a\sum _{k\ne i}\tau _k,\quad i=1,\dots ,N. \end{aligned}$$
(32)

We are considering such a motion in which the first body shifts by a distance of \(l_1\), and all the others shift by the same distance \(l_i\),

$$\begin{aligned} l_i=l,\quad i=2,\dots ,N. \end{aligned}$$
(33)

Solving the system (32) with respect to \(\tau _i\) under the condition (33), we get

$$\begin{aligned} \tau _1= & {} \frac{l_1(\sqrt{N-1}-(N-2))+l(N-1)}{\sqrt{N-1}(N-2)a}, \end{aligned}$$
(34)
$$\begin{aligned} \tau _i= & {} \tau = \frac{l_1+l\sqrt{N-1}}{\sqrt{N-1}(N-2)a},\quad i=2\dots ,N.\quad \quad \end{aligned}$$
(35)

Since \(\tau _1\) and \(\tau \) are the durations of time intervals, the displacements of the bodies \(l_1\), l must be such that the following condition is met:

$$\begin{aligned} \tau _1\ge 0,\quad \tau \ge 0. \end{aligned}$$
(36)

The values of \(l_1\) and l will be indicated later, after describing the motion during the third stage. The second stage of the motion ends at the moment of time

$$\begin{aligned} t_N=t_0+\tau _1+(N-1)\tau . \end{aligned}$$
Fig. 4
figure 4

Velocities \(v_i(t)\) of the bodies in the motion that solves Problem 1 in the case where the system is at rest at the initial time instant, \(v_i(0)=0\). The system consists of \(N=3\) bodies. At the first stage of motion, the velocity of the center of mass v(t) increases. At the second stage, v(t) is constant, while \(v_i(t)\) are piecewise constant. At the third stage, v(t) decreases until the whole system is at rest, \(v_i(T)=0\)

At the beginning of the third stage, we instantly redistribute the momentum of the system, giving the bodies the velocities

$$\begin{aligned} v_1(t_N+)= & {} (N-1)a,\\ v_i(t_N+)= & {} -\frac{a}{\sqrt{N-1}},\quad i=2,\dots ,N. \end{aligned}$$

During the time interval \([t_N,T]\), the bodies move without interacting with each other. At time \(t_N\), the ratio of the velocity modules of the bodies is equal to

$$\begin{aligned} \left|\frac{v_1(t_N+0)}{v_i(t_N+0)}\right|=(N-1)\sqrt{N-1},\quad i=2,\dots ,N. \end{aligned}$$

As shown earlier, this ratio tends to 1. Let us choose as T a moment in time such that

$$\begin{aligned} \left|\frac{v_1(T-0)}{v_i(T-0)}\right|=N-1,\quad i=2,\dots ,N. \end{aligned}$$

At that, \(v_1(T)=-(N-1)v_i(T)\), \(i=1,\dots ,N\). At time T, the momentum of the system is zero, so by redistributing it between bodies, you can instantly stop all bodies so that

$$\begin{aligned} v_i(T)=0,\quad i=1,\dots ,N. \end{aligned}$$

Thus, the motion is constructed that transfers the system between two states of rest, \(v_i(0)=v_i(T)=0\), \(i=1,\dots ,N\), that is, the condition (6) of Problem 1 is met. In order to move the system to the given distance L, \(x_i(T)=L\), \(i=1,\dots ,N\), that is, to satisfy the condition (5), it is necessary to select the values of the shifts of the bodies \(l_1\) and l at the second stage of motion.

Denote the shifts of the bodies \(A_i\) at the third stage by \(\Delta x_i\), \(\Delta x_i=x_i(T)-x_i(t_N)\), \(i=1,\dots ,N\). For the values \(\Delta x_i\), explicit formulas can be written out, similar to the formulas (29) for the shifts of bodies at the first stage of motion. Since all bodies except the first one move the same way at the first and third stages, we have \(x_i(t_0)=x_2(t_0)\) and \(\Delta x_i=\Delta x_2\), \(i=3,\dots ,N\). The values \(\Delta x_i\) as well as \(x_i(t_0)\) depend only on m, c, and N. The shifts of the bodies at the second stage \(l_1\) and l, which solve Problem 1, are found from the equalities

$$\begin{aligned} \begin{array}{l} x_1(t_0)+l_1+\Delta x_1=L,\\ x_2(t_0)+l+\Delta x_2=L. \end{array} \end{aligned}$$
(37)

For the found values \(l_1\) and l, it is necessary to check that the corresponding durations \(\tau _1\), \(\tau \), defined by (34), (35) are non-negative (36). We prove that this is true for sufficiently large values of L. Indeed, in this case the inequalities \(l_1>0\), \(l>0\) are valid, that results in \(\tau >0\) by virtue of (35). Let us rewrite the numerator of the right part of the formula (34) as

$$\begin{aligned} l_1(\sqrt{N-1}+1)+(l-l_1)(N-1). \end{aligned}$$

This expression is positive, since the first term is positive and arbitrarily large for large L, and the second is bonded in virtue of the formulas (37). This proves the inequality \(\tau _1>0\) for a sufficiently large value of L. Therefore, there is such \(L^*\) that Problem 1 has a solution for all \(L\ge L^*\). For this case, the algorithm for constructing the solution to this problem has been presented.

Suppose now that \(L<L^*\). In this case, first solve Problem 1 for the value \(\widetilde{L}=2L^*\). At the end of this motion, all bodies are at rest and are at the point with the coordinate \(x=2L^*\). Then we solve Problem 1 for the value \(\widehat{L}=L-2L^*\), that is, we shift the system by the distance \(\vert L-2L^*\vert \) in the negative direction of the x axis. It is possible because \(\vert L-2L^*\vert >L^*\).

Thus, the solution of Problem 1 is constructed in the case where \(v(0)=0\).

Fig. 5
figure 5

Coordinates of the bodies \(x_i(t)\) (blue lines) solving Problem 1 in the case where \(v(0)=0\), \(N=3\). The position of the center of mass x(t) is shown by the red line. The velocities of the bodies are shown in Fig. 4

Fugures 4, 5 illustrate the solution of Problem 1 in the case \(N=3\), m = 1 kg, c = 0.1 kg/m, L = 5 m. At the initial moment of time, \(v_i(0)\) = 0 m/s, \(x_1(0)\) = 0 m, \(x_2(0)\) = 3 m, \(x_3(0)\) = 25 m. Here, the value of p (see formula 24) is chosen to be equal to 10 m/s.

Note that in the case where \(v(0)=0\), the time of motion T can be arbitrarily small. Indeed, when the value of p increases infinitely, the time \(t_0\) of motion at the first stage (27) tends to zero as well as the time of motion at the third stage; and the velocity of the center of mass v at the second stage of motion defined by (30) tends to infinity. This result is obtained here for the quadratic resistance, in contrary to the case of dry friction, in which the time optimal control problem for the considered system was solved [17].

5 Optimization of motion with a constant velocity of the center of mass

The motion with the constant velocity of the center of mass of the system proposed in Sect. 3 is an important part of the solution of Problem 1. Let us consider the problem of optimizing such a motion.

Consider the motion with piecewise constant velocities of the bodies of the system, given by the formulas (16) and (20), under the condition of the equality (13). In this motion, the velocity of the center of mass \(v_*\) is constant and is determined by the relation (12). We impose a limit on the velocity of each of the bodies:

$$\begin{aligned} \vert a_i \vert \le V, \quad i=1,\dots ,N. \end{aligned}$$
(38)

We look for such a motion of the system at which the velocity of the center of mass \(v_*\) is maximal:

$$\begin{aligned} v_* =\frac{1}{N}\sum _{i=1}^N a_i\rightarrow \max . \end{aligned}$$
(39)

Thus, in order to maximize the velocity of the center of mass of the system, it is necessary to maximize the functional (39) under the conditions (13) and (38).

Problem 2

Find the set of velocities \(\mathfrak {A}=\{a_1,\dots ,a_n\}\) satisfying the conditions (13), (38) and maximizing the functional (39).

Lemma 1

If the set of velocities \(\mathfrak {A}=\{a_1,\dots ,a_N\}\) is optimal, that is, it solves Problem 2, then there are no zero velocities in it, and all positive velocities are the same.

Proof

Let the velocities of bodies with numbers from the set \(I^+\) be non-negative, \(a_i\ge 0\), \(i\in I^+\), the amount of such bodies is equal to \(N^+=\vert I^+\vert \). The velocities of the other bodies are negative, \(a_i< 0\), \(i\in I^-=\{1,\dots ,N\}\backslash I^+\). Suppose that not all values \(a_i\), \(i\in I^+\) are the same. We specify a new set of velocities in which all non-negative velocities are the same and positive:

$$\begin{aligned} \tilde{a}_i= & {} \sqrt{\frac{\sum \limits _{i\in I^+} a_i^2}{N^+}},\quad i\in I^+,\\ \tilde{a}_i= & {} a_i,\quad i\in I^-. \end{aligned}$$

Such velocities \(\tilde{a}_i\) still satisfy the conditions (13), (38), and the value of the functional (39) increases with new values of velocities, \(\tilde{a}_i\), \(v_*(a_1,\dots ,a_N)<v_*(\tilde{a}_1,\dots ,\tilde{a}_N)\). Actually,

$$\begin{aligned}{} & {} v_*(\tilde{a}_1,\dots ,\tilde{a}_N)-v_*(a_1,\dots ,a_N)=\\{} & {} \quad =\frac{\sqrt{N^+}}{N}\sqrt{{\sum \limits _{i\in I^+} a_i^2}}-\frac{1}{N}\sum \limits _{i\in I^+} a_i>0. \end{aligned}$$

The latter inequality is equivalent to the inequality

$$\begin{aligned} \left( \sum \limits _{i\in I^+} a_i\right) ^2<{N^+}{{\sum \limits _{i\in I^+} a_i^2}}, \end{aligned}$$

which is a special case of the Cauchy-Bunyakovsky-Schwarz inequality. This inequality is strict, since not all \(a_i\), \(i\in I^+\) are the same by assumption. Thus, it is shown that there are no zero velocities in the optimal set of velocities, and all positive velocities are the same. The lemma is proved. \(\square \)

Lemma 2

If the set of velocities \(\mathfrak {A}=\{a_1,\dots ,a_N\}\) is optimal, that is, solves Problem 2, then all negative velocities in it are equal to \(-V\).

Proof

We assume that the optimal set of velocities \(\mathfrak {A}\) has a negative velocity \(a_k\), \(a_k\in \mathfrak {A}\), such that \(a_k\in (-V,0)\). At least one of the bodies \(A_j\) must have a positive velocity, otherwise the equality (13) is violated. Thus we have

$$\begin{aligned} a_j>0, \quad -V<a_k<0. \end{aligned}$$

We define a new set of velocities \(\widetilde{\mathfrak {A}}=\{\tilde{a}_1,\dots ,\tilde{a}_N\}\). In the set \(\widetilde{\mathfrak {A}}\), the velocities of the bodies \(A_j\), \(A_k\) are changed to \(\tilde{a}_j\), \(\tilde{a}_k\), such that \(\tilde{a}_j>0\), \(\tilde{a}_k = -V\) or \(\tilde{a}_k \ge 0\). The velocities of the other bodies do not change, \(\tilde{a}_i=a_i\), \(i\ne j,k\). Then the condition \(v_*(\widetilde{\mathfrak {A}})>v_*(\mathfrak {A})\) is equivalent to

$$\begin{aligned} \tilde{a}_j+\tilde{a}_k>a_j+a_k. \end{aligned}$$
(40)

Since the velocities of all bodies except the velocities of the bodies \(A_j\) and \(A_k\) do not change and the condition (13) is met for the set \(\mathfrak {A}\), this condition is met for the set \(\widetilde{\mathfrak {A}}\) if and only if

$$\begin{aligned} \tilde{a}_j^2 - \tilde{a}_k^2 = a_j^2 - a_k^2. \end{aligned}$$
(41)

The constraint (38) takes the following form:

$$\begin{aligned} \vert \tilde{a}_j\vert \le V, \quad \vert \tilde{a}_k\vert \le V. \end{aligned}$$
(42)

If \(a_j>\vert a_k\vert \), we put

$$\begin{aligned} \tilde{a}_j=\sqrt{a_j^2-a_k^2}, \quad \tilde{a}_k=0. \end{aligned}$$

If \(a_j<\vert a_k\vert \), we put

$$\begin{aligned} \tilde{a}_j=\sqrt{V^2+a_j^2-a_k^2}, \quad \tilde{a}_k=-V. \end{aligned}$$

In both cases, the conditions (41) and (42) are met for the values \(\tilde{a}_j\), \(\tilde{a}_k\). The condition (40) is also satisfied that guarantees that the functional (39) increases for \(\widetilde{\mathfrak {A}}\). This means that the original set is non-optimal. In the case where \(a_j=\vert a_k\vert \), in the new set \(\widetilde{\mathfrak {A}}\) we put \(\tilde{a}_j=\tilde{a}_k=0\) without changing \(a_i\), \(i\ne j,k\). At that, the value of the functional (39) does not change. According to Lemma 1, the set \(\widetilde{\mathfrak {A}}\) is non-optimal, therefore, the original set \(\mathfrak {A}\) is also non-optimal.

Thus, in all cases, the original set of velocities \(\mathfrak {A}\) is non-optimal. The obtained contradiction proves the lemma.

\(\square \)

Combining the results of Lemmas 1 and 2, we obtain the following statement.

Proposition 1

In the optimal set of velocities \(\mathfrak {A}=\{a_1,\dots ,a_N\}\), all negative velocities are equal to \(-V\), there are no zero velocities, and all positive velocities are the same.

Using this statement, we indicate the optimal set of velocities \(\mathfrak {A}\). Let the bodies \(A_i\), \(i\in I^+\) have equal positive velocities, \(a_i=a\), \(i\in I^+\), their number is equal to \(N^+\), \(N^+= \vert I^+\vert \). The remaining \(N-N^+\) bodies have negative velocities equal to \(-V\). Let us determine the optimal number of \(N^+\) bodies moving with positive velocity. The condition that the sum of external forces is equal to zero (13) takes the form

$$\begin{aligned} (N-N^+)V^2=N^+a^2. \end{aligned}$$
(43)

The condition (38) is written as

$$\begin{aligned} a\le V. \end{aligned}$$
(44)

The expression for the velocity of the center of mass takes the form

$$\begin{aligned} v_*=-\frac{N-N^+}{N}V+\frac{N^+}{N}a. \end{aligned}$$
(45)

Let us obtain the value of a from the equality (43):

$$\begin{aligned} a=\sqrt{\frac{N-N^+}{N^+}}V. \end{aligned}$$
(46)

When substituting it into the formula (45), we get

$$\begin{aligned} v_*(N^+)=-\frac{N-N^+}{N}V+\frac{\sqrt{N^+(N-N^+)}}{N}V. \end{aligned}$$
(47)

The condition (44) is equivalent to the inequality \(N^+\ge \frac{N}{2}\). Note that the equality \(N^+ = \frac{N}{2}\) is impossible, because otherwise the numbers of bodies moving forward and backward coincide and \(a=V\) resulting in \(v_\star =0\), which contradicts the assumption \(v_\star > 0\). Thus, we have

$$\begin{aligned} \frac{N}{2}<N^+<N. \end{aligned}$$
(48)

The problem of maximizing \(v_*\) is reduced to finding the maximum by \(N^+\):

$$\begin{aligned} N^++\sqrt{N^+(N-N^+)}\rightarrow \max \end{aligned}$$
(49)

for integers \(N^+\) from the interval (N/2, N). Consider the function

$$\begin{aligned} f(x)=x+\sqrt{x(N-x)} \end{aligned}$$
(50)

for real x from the interval (N/2, N). The function f(x) increases on the interval \((\frac{N}{2},\frac{N}{2}+\frac{N}{2\sqrt{2}})\), reaches a maximum at the point \(\frac{N}{2}+\frac{N}{2\sqrt{2}}\), and decreases on the interval \((\frac{N}{2}+\frac{N}{2\sqrt{2}},N)\). Therefore, the solution to the problem (49) is one of two values: \(N^+_{opt}=N^+_1\) or \(N^+_{opt}=N^+_2\), where

$$\begin{aligned} N^+_1=\left[ \frac{N}{2}+\frac{N}{2\sqrt{2}}\right] ,\quad N^+_2=\left[ \frac{N}{2}+\frac{N}{2\sqrt{2}}\right] +1. \end{aligned}$$

Here, the sign \([\cdot ]\) denotes the integer part of a number. Note that \(N^+_1>N/2\) for all \(N\ge 3\). For \(N=3,\dots ,6\) we have \(N^+_2=N\), \(N^+_1=N-1\). The inequality (48) for such \(N^+_2\) is violated, therefore, \(N^+_{opt}=N^+_1\), that is

$$\begin{aligned} N^+_{opt}(N)=N-1,\quad N=3,\dots ,6. \end{aligned}$$
(51)

Thus, if the number of bodies in the system is less or equal to 6, then at optimal motion only one of the bodies moves backward with the maximum allowed velocity \(-V\), and all the others move forward with velocities equal to \(V/\sqrt{N-1}\), while the velocity of the center of mass is equal to

$$\begin{aligned} v_*=\frac{\sqrt{N-1}-1}{N}V. \end{aligned}$$

For \(N>6\), the inequality (48) is met for both \(N^+_1\) and \(N^+_2\). Therefore, one of the values \(N^+_1\) or \(N^+_2\) corresponding to a larger value of (49), should be chosen as \(N^+_{opt}\), that is,

$$\begin{aligned} N^+_{opt}(N)=\text {argmin} (f(N^+_1),f(N^+_2)),\quad N>6. \end{aligned}$$
(52)

Substituting the maximum point \(\frac{N}{2}+\frac{N}{2\sqrt{2}}\) of the function (50) into the expression for the average velocity (47), we get the following estimate of the velocity of the center of mass:

$$\begin{aligned} v_*<v_*^{\sup }=\left( \frac{1}{\sqrt{2}}-\frac{1}{2}\right) V. \end{aligned}$$

As N increases, the value of \(v_*(N^+_{opt})\) tends to \(v_*^{\sup }\):

$$\begin{aligned} \lim \limits _{N\rightarrow \infty } v_*(N^+_{opt}(N))= v_*^{\sup }. \end{aligned}$$

Note that for \(N=6\), the difference between the value of the velocity of the center of mass \(v_*\) for an optimal number of \(N^+\) bodies moving to the right and the value of \(v_*^{\sup }\) is less than 1%,

$$\begin{aligned} \frac{v_*^{\sup }-v_*(N^+_{opt}(6))}{v_*^{\sup }}<10^{-2}. \end{aligned}$$

As previously was obtained for \(N=3,\dots ,6\), it can be shown that for \(N=7,8,9\) we have \(N^+_{opt}(N)=N-1\), that is, only one body moves backward in the optimal motion. If \(N=10\), we have \(N^+_{opt}(N)\in \{N-1,N-2\}\), that is, motions with both one and two backward-moving bodies are optimal. In the case where \(N\ge 11\), at least two bodies move backward with velocities \(-V\) in optimal motion. The ratio of the number of bodies moving forward to the number of bodies moving backward tends to \(\frac{1}{2}+\frac{1}{2\sqrt{2}}\) with an increase in the number of bodies N.

Summarizing the results of the current section, one can describe the optimal motion of the system by the following statement.

Proposition 2

In a motion of the system of bodies maximizing the velocity of the center of mass, \(N^+=N^+_{opt}\) of bodies moves forward, where \(N^+_{opt}\) is determined by the formulas (51), (52). The velocities of all such the bodies are the same and are defined by the formula (46). The remaining \(N-N^+\) bodies move backwards with the velocity \(-V\). In the optimal motion, the velocity of the center of mass of the system is given by the formula (47).

Fig. 6
figure 6

Coordinates of the bodies \(x_i(t)\) (blue lines) in the optimal a and in the non-optimal b motion. The system consists of \(N=5\) bodies. The position of the center of mass x(t) is shown by red lines. The slope of the line x(t) is about two times bigger in the optimal motion a compared to the non-optimal one b

Let us illustrate the proposition by considering the system consisting of \(N=5\) bodies. Parameters of the problem are the following: m = 1 kg, c = 0.1 kg/m, T = 30 s, \(t_N\) = 10 s, V = 2 m/s. At the initial moment of time, \(x_1(0)\) = 0 m, \(x_2(0)\) = 2 m, \(x_3(0)=10\) m, \(x_4(0)=20\) m, \(x_5(0)=30\) m. We compare two motions. In the first motion, only one body moves backward at each moment of time, i.e., \(a_1=-V\), \(a_i=V/2 \), \(i=2,\dots ,5\), and \(v_i(0)=a_i\). In the second motion, two bodies move backward at each moment of time, i.e., \(a_1=-V\), \(a_2=-V\), \(a_i=\sqrt{2/3}V \), \(i=3,4,5\), and \(v_i(0)=a_i\). Both these motions satisfy the requirements of Proposition 1. Figure 6 shows the results of the simulation of these two motions. The shift of the center of mass of the system is more than 6 m bigger in the first motion compared to the second one. Thus, these simulation results are in agreement with Proposition 2, which asserts that the first considered motion is the optimal one. To perform this simulation (as well as to obtain the results presented in Figs. 2, 3, 4 and 5), the Python script is developed. It firstly sets the controlling forces defined by (14) and by the motion algorithm used and then simulates the motion of the system according to the equations of motion (1), (2). The Gnuplot utility is used to create Figs. 26.

6 Conclusion and discussion

The current paper examines the dynamics of a system of identical interacting bodies on a straight line. The controlling forces are the forces of interaction between neighboring bodies. There are no restrictions on these forces, so that an instantaneous change in the values of the velocities of the bodies of the system is possible. The resistance force of the medium to the motion of each body is described by a quadratic function of velocity. The problem of shifting the system to a given distance is solved under the conditions that the velocities of each of the bodies at the beginning and at the end of the motion are the same, and the relative positions of the bodies are also the same at these time instants.

A new result is obtained in the case where the momentum of the system is zero at the initial moment of time (for example, the system is at rest). A motion consisting of three stages is constructed. At the first stage (acceleration), the initial moment of time when the impulse interaction between the bodies occurs is followed by the time interval of free motion of the bodies; at the end of this stage, the velocity of the center of mass becomes positive. At the second stage, the center of mass of the system moves with constant velocity, and the bodies move with piecewise constant velocities. At the third stage, the system is slowed down to a state of rest. It is shown that this motion consisting of three stages can be performed in an arbitrary short time.

In the case where the momentum of the system is not zero at the initial moment of time, a new algorithm of motion is proposed in which the velocity of the center of mass is constant during the entire motion, the velocity of each of the bodies is piecewise constant, and the values of the velocities of the bodies change cyclically. For such a motion with a constant velocity of the center of mass and piecewise constant velocities of bodies, the optimization problem is solved. The velocity of the center of mass is maximized under the condition that the velocities of the bodies of the system are bounded. It is shown that in optimal motion at each time instant, part of the bodies moves backward at the maximum possible velocity, the rest ones move forward at the equal velocities. An upper estimate of the maximum velocity of the center of mass of the system is found for all values of the number of bodies that make up the system.

The motions proposed in the paper can be continued periodically, so they can be used to construct a control for a robotic locomotion system of several bodies moving in a viscous medium by changing its configuration.

In the current problem statement, only rectilinear motions of the system are possible, while for applications it is also important to implement planar and spatial motions. Some proposed earlier locomotion systems that can move on a plane or in space are multi-link systems, systems having rotors, systems consisting of a hull and moving internal bodies. Our plan is to investigate planar and spatial motions of a system of identical bodies some of which interact and are pairwise connected by prismatic joints. That is, we want to study systems similar to the one considered in the current paper, but with more complex (not serial) scheme of connections between bodies, e.g., a triangular or a pyramid with bodies at vertexes. We plan to find construction of such a system and its gaits that allow to move the system translationally, rotate it, and bring it to a prescribed position. One of the possible designs is as follows. In the case of planar motion, nine bodies are placed at the vertexes, middles of sides and at the center of a square. Each of the bodies is connected with all neighboring bodies by prismatic joints. This system can move translationally parallel to one side of the square, if we consider the system as three separate triples of bodies. Each of the triples moves according to the algorithm proposed in the current paper. After the full stop, the system can move translationally along the perpendicular direction. In the similar way, spatial motion of a system of 27 bodies can be organized. In our future studies, we plan to propose simpler designs of such systems, study and optimize their motions.