Prehensile tails are mobile limbs with the ability to grasp objects and provide support and stability to organisms such as primates, chameleons, and seahorses. Robotics researchers have studied prehensile tails for applications in three dimensional body rotation movements and adding balance to quadrupeds and real-world elderly citizens. However, determining the joint configurations for robotic tails is a challenging computational problem involving mechanics, geometry, and tuning. I present a simple algorithm with assumptions to compute the parameters for a prehensile tail positioning with a specified joint mass, number, and length, which balances out a counterweight of any given height and mass.
Introduction
Introduction
Role of Prehensile Tails
Role of Prehensile Tails
Prehensile tails are defined as tails that have evolved to take an active role more like an independent leg, very similar to arms or legs. They are found in several classes of animals, where each could take a different role. While early dinosaur tails were not prehensile, they began to take an active role in theropods. Palaeontologists proposed that they use their tails as dynamic stabilizers which enhanced speed. The same study also examined how the Agama lizards swing their tails when jumping to reduce rotational movement (Libby et al., 2012). In chameleons, scientists have discovered through analyzing bone evolution and angles of 28 species that in both their prehensile and non-prehensile tails, tails are used for flexibility and stiffening front torsos for balancing (Molnar & Watanabe, 2023). On the other hand, scientists have discovered that seahorses, such as the Hippocampus kuda, curl their tails downward in order to exert forces and grip other objects (Hale, 1996).
Monkeys, a species of animals most similar to humans, are an example of prehensile tail use. When examining kinematic data of species Ateles and Lagothrix, researchers found that the tails of Ateles have larger attachment sites for muscles, less side-to-side sway, and stronger locomotion (Schmitt et al., 2005). For other monkeys, such as the Potos flavus and Alouatta macconnelli, specialization once again plays a role. The P. flavus uses its tail for postural behaviors and grabbing large objects, while A. macconnelli uses its tail for grabbing small objects, mass bearing, and stability. In a non-monkey species, the Kinkajou Sapajus apella uses its tail for both posture and stability (Naas et al., 2025).
Henceforth, from these species examined, it’s known that in the natural world, prehensile tails are any tails used for grasping objects, stability, and locomotion.
Robotic Applications of Prehensile Tails
Robotic Applications of Prehensile Tails
This unique adaptation of a prehensile tail is distinctly missing in humans due to their evolved bipedal nature. In cases of poor footing, balancing becomes a challenge. In such cases, not having a tail is a disadvantage. To address this problem, prehensile tails have been studied extensively in robotics. To make smaller, jumping robots stable, researchers used the knowledge acquired from studying the Agama lizards and theropods to develop a proportional derivative (PD) controller that naturally adjusts to midair perturbations in tandem with modeling a Velociraptor mongoliensis’ tail behavior (Libby et al., 2012). By running simulations, researchers have studied the effects of tails on inducing rotational forces on 3D objects. Specifically, by removing all environmental forces and then moving a single-jointed tail, they found that the whole object moved as a result (Fu et al., 2024).
To directly address the balance issue listed above, researchers in Japan developed Arque, a robotic tail with pneumatic-based motion for joints, which automatically balances a leaning mass through positioning joints in an equilibrium state (Junichi Nabeshima et al., 2019).
Objectives
Objectives
From the above context, it can be concluded that robotic tails currently are meant to stabilize and balance. However, each has vastly different parameters, lengths, specifications, and masses. In general, some of the most complex and cutting-edge robotics research surrounding this topic comes from Arque and analysis of simian/primate tails. To assist in this process and development, I researched and created an algorithm using computation, physics, and biomechanics that aims to answer the question: Can a model be developed with any mass, length, and joint parameters where a prehensile tail still balances a mass?
Methodology
Methodology
Model V1 - Self-Balancing Tail with Variable Length
Model V1 - Self-Balancing Tail with Variable Length
I started by developing a very simple model. Before changing the angle of the tail or adding more joints, I defined how balance works. In physics, balance is achieved by having a net torque of zero in the system. In this case, the system is defined as the following: a center of mass for the tail offset by a distance and a center of mass for the head offset by a distance and height. The tail’s center of mass is the midpoint because it is a normal object while the head is a point mass. For all calculations, SI units were used.
From this setup, I had to derive an equation with these six main variables:
◼
m
head
◼
d
head
◼
h
head
◼
m
tail
◼
d
tail
◼
h
tail
Defining these variables in Wolfram Language:
In[]:=
mHead=1;dHead=1;hHead=5;mTail=1;hTail=1;
The reason why isn’t defined will be elaborated on later.
d
tail
For the sake of simplicity, I reduce the diagram to the pivot points representing the joints of the tail and their respective center of masses.
These points were defined by the variables from the dimensions of the first diagram:
◼
p
1
d
head
h
head
◼
p
2
h
head
◼
p
3
h
tail
◼
p
4
d
tail
2
h
tail
◼
p
5
d
tail
h
tail
◼
p
6
In the above diagram, the monkey is standing perfectly upright. However, this will not always be the case. Thus, I added a 7th variable, , which looks like this:
θ
lean
Defining the origin () and the leaning angle:
p
6
In[]:=
thetaLean=15;p6={0,0};
Using trigonometry, we can compute the coordinates when the monkey is leaning. Beginning with , we can compute its position by drawing a right triangle from the origin to . This is visualized below:
p
2
p
6
p
2
Notice that the hypotenuse is and one of the angles is . This means that since and are known, can be defined as the following:
h
head
θ
lean
θ
lean
h
head
p
2
p
2
h
head
θ
lean
h
head
θ
lean
Using the above formula to calculate for :
p
2
Calculating the midpoint in Wolfram Language using the built-in Midpoint function:
With all of the points now defined, I began calculating for the torque. Torque is defined as the turning effort that causes an object to rotate. The equation for torque is known as:
τ = F ⋅ r ⋅ sin(ϕ)
where F is the force, r is the lever arm distance, and ϕ is the angle between the force and lever arm. Assuming F is the gravitational force, namely
F = m ⋅ g ,
I defined a torque exerted at the point mass (x,y) with mass m, distance r, and angle ϕ from the origin O as the following:
τ = m ⋅ g ⋅ r ⋅ sin(ϕ)
However, there can be a right triangle drawn from the point mass to the origin with the x and y coordinates as legs and r as the hypotenuse as the below diagram shows:
Because the gravitational constant g is present on both sides, we can simplify the torque to the following helper function in Wolfram Language:
Defining a function for all the prior computations listed above:
Model V2 - Self-Balancing Tail with Variable Rotation
Model V2 - Self-Balancing Tail with Variable Rotation
NMinimize first begins with defining the squared sum of the torques to minimize:
I then defined constraints to prevent multiple solutions:
I then extracted the numerical value:
With this, I modified the function from V1 to visualize the V2 model. Note, however, that, because there is only one joint (a perfectly flat tail), there are going to be some physically impossible combinations of givens.
Defining a function for all the prior computations listed above:
Using the Manipulate function to allow real-time input and simulation visualization for the model:
Model V3 - Multi-Jointed Self-Balancing Tail
Model V3 - Multi-Jointed Self-Balancing Tail
The diagram below shows an example including these new points for a tail with 3 segments:
For simplicity’s sake, I always used the same constant for the length of each tail segment, even though that is not the case in nature.
This is visualized in the following diagram with the same setup as V2:
This formula can be implemented in the Wolfram Language using Table:
With the points solved for, I algorithmically calculated the center of masses. Each center of mass is simply the midpoint between the endpoints of a joint. Thus, I used the following formula knowing that there is n+1 total number of points:
Using Wolfram’s built-in Midpoint function to compute the center of masses, which depend on thetaVars and pVars:
With the center of masses defined, I set up the torque equilibrium equation from the past two models. In contrast to real tails, where mass varies per joint, in this model, for simplicity’s sake, mass is constant between joints:
I needed to slightly tweak my torque equation from the previous two models because the tail now has multiple joints. The torque on the tail now is a summation of the torque of every individual joint of the tail. This can be represented by the following:
Implementing the summation in Wolfram Language by creating a list for each torque, and then summing them up using the Total function:
This leads to another minimization problem similar to the one studied in the model V2:
Defining the objective as the sum of the torques, and then minimizing the squared error:
Assigning thetaAdjVars to be actual values instead of symbolic ones:
Taking into account the prior helper functions, as well as the formulas listed earlier, I visualized the multi-jointed tail simulation with a Manipulate:
Conclusion
Conclusion
The development process of this model and algorithm demonstrate the progression from studying a biological phenomenon (prehensile tails), calculating how they would work mathematically, and then implementing them in an interactive simulation. The model’s iterative versions in the form of a V1, V2, and V3 showcase an evolution of complexity, creating a greater foundation for the eventual algorithm. In the end, the model holds strong applications in robotics and understanding how organisms naturally balance themselves with tails. Researchers can now specify design constraints and the model will output estimated results for them to test and iterate on.
In general, the model and algorithm are new and innovative first steps to approaching the modelling of robotic tail problems in 2-dimensional spaces; however, in order to be fully functional and useful in real-world, true 3-D spatial awareness, as well as better angle constraints must be added to prevent impractical solutions.
Future Directions
Future Directions
Additional work on the parameters and math can be done to address the current model’s shortcomings listed above. Any future investigations could answer the research questions of how the algorithm can be optimized, how it can be implemented in 3-D spaces, and how more realistic and “natural” curves can be implemented.
Adopting closer procedures to past studies may also help resolve uncertainty in the model. For instance, the math could more closely follow the equations set up by Fu et al. (2024), which involve differential equations and calculus, compared mine which uses mostly trigonometry.
Likewise in terms of alternate models, feedback controllers and something similar to an inverse pendulum mechanism could be explored to model the tail. PD control was utilized by Libby et al. (2012), and alternatives such as PD LQR are often used by inverse pendulum mechanisms in Wolfram. Libby et al. (2012) also built a physical model of the robot they were modeling. The Arque tail by Junichi Nabeshima et al. (2019) is a physical model too. Thus, building a physical model of a tail using my algorithm would explore its potential successes, shortcomings, and interactions in 3-D spaces.
Finally, adapting my model beyond static balance, which is based on center of masses and torque, to model more complex behaviors, such as hanging, balancing, swinging, or grasping, would provide a more comprehensive idea of a prehensile tail’s biomechanics. The algorithm might need to be tweaked to account for 3-dimensional space by using polar co-ordinates and the associated computational complexity arising from parameter tuning. By expanding to different aspects of prehensile tails, the model will become more general purpose and accurate to a monkey.
Overall, through addressing performance issues directly through new ideas and approaches from other researchers, more realistic and applicable models may be created.
References
References
1. Fu, X., Zhang, B., Weber, C. J., Cooper, K. L., Vasudevan, R., & Moore, T. Y. (2024). Jointed tails enhance control of three-dimensional body rotation. ArXiv, arXiv:2406.09700v1. https://pmc.ncbi.nlm.nih.gov/articles/PMC11213154/
2. Hale, M. E. (1996). Functional morphology of ventral tail bending and prehensile abilities of the seahorse,Hippocampus kuda. Journal of Morphology, 227(1), 51–65. https://doi.org/10.1002/(sici)1097-4687(199601)227:1<51::aid-jmor4>3.0.co;2-s
3. Junichi Nabeshima, MHD Yamen Saraiji, & Kouta Minamizawa. (2019). Arque: artificial biomimicry-inspired tail for extending innate body functions. https://doi.org/10.1145/3306214.3338573
4. Libby, T., Moore, T. Y., Chang-Siu, E., Li, D., Cohen, D. J., Jusufi, A., & Full, R. J. (2012). Tail-assisted pitch control in lizards, robots and dinosaurs. Nature, 481(7380), 181–184. https://doi.org/10.1038/nature10710
5. Molnar, J., & Watanabe, A. (2023). Morphological and functional regionalization of trunk vertebrae as an adaptation for arboreal locomotion in chameleons. Royal Society Open Science, 10(3). https://doi.org/10.1098/rsos.221509
6. Naas, A. G., Mensah, J. B., Forget, P. M., Guilbert, É., & Herrel, A. (2025). Tails in Action: Comparative Use of the Prehensile Tail and Substrate in Alouatta macconnelli, Sapajus apella, and Potos flavus. American Journal of Primatology, 87(3). https://doi.org/10.1002/ajp.70025
7. Schmitt, D., Rose, M. D., Turnquist, J. E., & Lemelin, P. (2005). Role of the Prehensile Tail During Ateline Locomotion: Experimental and Osteological Evidence. American Journal of Physical Anthropology, 126(4), 435–446. https://doi.org/10.1002/ajpa.20075
Acknowledgements
Acknowledgements
I would like to extend my sincerest gratitude to program directors Rory Foulger, Eryn Gillam, Megan Davis, and Cyrus Taylor, and to the staff at Wolfram Research, for providing me with this incredible opportunity. I also want to take the opportunity to thank the founder and CEO of Wolfram Research, Dr. Stephen Wolfram, for his invaluable help in developing my project idea and managing the research. Special thanks to my mentor, Mr. Angel Rojas, who immensely helped me with understanding Wolfram Language, refactoring of code and writing and brainstorming mathematical ideas. The guidance I received from the Teaching Assistants(TA’s) of the 2026 Wolfram High School Summer Research Program was invaluable, notably Arnay Garyhan for his help with my final model, Aanya Gupta for her help with editing flow and formatting, and Eric Archerman for his help with mathematical derivations. This project would not be complete without their assistance, and to these individuals, I would like to extend my sincerest thanks.
I would be amiss if I failed to recognize my family, notably my parents for their motivation, guidance and encouragement to pursue my research interests, my grandfather for his thoughtful advice, and my sister for her constant source of encouragement.
CITE THIS NOTEBOOK
CITE THIS NOTEBOOK
An algorithm for the placement of a self-balancing prehensile tail on a leaning mass
by Samvarth Raj
Wolfram Community, STAFF PICKS, July 9, 2026
https://community.wolfram.com/groups/-/m/t/3753679
by Samvarth Raj
Wolfram Community, STAFF PICKS, July 9, 2026
https://community.wolfram.com/groups/-/m/t/3753679