Recently, path planning algorithms have been one of the primary and important functions of unmanned aerial vehicles (UAVs). Path planning algorithms in UAVs focused on path length, average path length, computation time, and standard deviation from the mean path length. In spite of this, it faced many difficulties and problems, such as many obstacles, path segmentation, and the increasing number of obstacles and paths in urban environments. This work proposes polynomial functions for path planning and obstacle avoidance. Since it enables us to plan the path in static internal environments, it enables us to plan the path quickly and with less computing time because it does not require high memory and does not require pre-compute of the path. Instead, the route is plotted in real time, Where the appropriate equation is entered into the program, so that the vehicle follows the curve of the entered equation. An accurate data set and metrics were used to measure the efficiency of the proposed method. The experimental results showed a clear improvement in the work of the polynomial function on A*, PSO and genetic algorithms, as this improvement appears very clearly when compared to the computing time, which was reduced by 15% in the method of polynomial functions where the path calculation took only parts of The second, as well as the path length was halved in the polynomial method as the results showed, which reduces the time of battery and memory consumption, the cost of calculating the path and the time to reach the goal.