# Numerical Solutions to the Variational Problems by [PERSON]'s Path-Finding Algorithm
## 2 Variational Problems as the Shortest Path Finding  
The basic question of the variational problem involves finding a function \(y(x)\) that minimizes an integral I of a functional F,  
\[I=\int_{x_{a}}^{x_{b}}F(x,y,\,y^{\prime})dx, \tag{1}\]  
where \(y^{\prime}=dy/dx\). The function \(y(x)\) can be interpreted as a path on the two-dimensional xy-plane, joining the points (\(x_{a}\),\(y(x_{a})\)) and (\(x_{b}\),\(y(x_{b})\)). Conventionally, we can use the technique of calculus of variations to show that the optimum path that minimizes the integral I is the solution of the Euler-Lagrange differential equation [1]. \[\frac{\partial\mathrm{F}}{\partial\mathrm{y}}-\frac{\mathrm{d}}{\mathrm{dx}} \bigg{(}\frac{\partial\mathrm{F}}{\partial\mathrm{y}^{\prime}}\bigg{)}=0, \tag{2}\]  
The problem can be generalized to three or more dimensions. For a three-dimensional problem, the functional F can be expressed as F(x,y,z,y,z,z), where z\({}^{\prime}=\mathrm{d}z/\mathrm{dx}\). The Euler-Lagrange equations are generalized to be a set of differential equations,  
\[\frac{\partial\mathrm{F}}{\partial\mathrm{y}}-\frac{\mathrm{d}}{\mathrm{dx}} \bigg{(}\frac{\partial\mathrm{F}}{\partial\mathrm{y}^{\prime}}\bigg{)}=0,\, \frac{\partial\mathrm{F}}{\partial\mathrm{z}}-\frac{\mathrm{d}}{\mathrm{dx}} \bigg{(}\frac{\partial\mathrm{F}}{\partial\mathrm{z}^{\prime}}\bigg{)}=0. \tag{3}\]  
Similar to the two-dimensional case, the solutions y(x) and z(x) of Equation (3) can be interpreted as the optimal path in three dimensions joining the points (x\({}_{\mathrm{a}}\),y(x\({}_{\mathrm{a}}\)),z(x\({}_{\mathrm{a}}\))) and (x\({}_{\mathrm{b}}\),y(x\({}_{\mathrm{b}}\)),z(x\({}_{\mathrm{b}}\))). There are various techniques to solve the Euler-Lagrange Equations (2) or (3), depending on the exact form of the functional F [1]. In some cases, solving the equations can be hard. For some problems, deriving equations can be hard in the first place [15; 16; 17; 18; 19; 20; 21; 22]. As mentioned in the previous section, we raise the following question: Is it possible to find the optimal path directly from the definition of the problem in Equation (1), avoiding the complications of solving Equations (2) or (3)? In graph theory, there is a class of problems called shortest path finding, which aims to find the shortest path joining two vertices in a weighted graph. The definition of the shortest path here is the path with the smallest accumulated weight among all possible paths. To clearly see the problem statement, let us consider a simple example. Figure 1 shows a simple graph with six vertices. Each edge connected by two adjacent vertices is assigned a weight. The problem involves finding the shortest path from vertex a to b. We can see that the green path is the shortest path with the minimum accumulated weights of \(9+2+9=20\). For this simple graph, the shortest path can be easily obtained by hand. In practice, the graph can be complicated, with large numbers of vertices and edges. Sophisticated algorithms have been developed to solve this kind of problem [23; 24]. It is interesting that the goals of variational problems and shortest path finding are almost identical. If we discretize the domain of a variational problem into a spatial network and properly define the weight of each edge using the integrand in Equation (1), it is possible to find the solution of a variational problem using a path-finding algorithm from the graph theory. The first crucial step is the space discretization. Since the path-finding algorithms are discrete in nature, the original continuous domain of a variational problem has to be discretized to a spatial network of a finite number of vertices connected by edges. To achieve the accurate numerical approximation of the optimum path, the Euclidian distance between adjacent vertices must be small to approximate the original continuous domain. However, it is more important that a vertex must be connected by a large number of surrounding edges.