How are solids described mathematically? All shapes can be described by mathematical equations for example the unit sphere can be described as $x^2+y^2+z^2=1$, but not all shapes are that simple in nature.
Most solids in nature very complicated making it hard to find the equation that describes them, I would imagine that perhaps numerical methods would be used for this.
However I was wondering, how would one study the motion of a  complicated shaped solid, like for example a cog, perhaps we could define a distribution that gives the value of $1$ where the solid is present and $0$ where it's not, but this seems (to me) as difficult as finding the equation of the shape.
My question is, if one wanted to use Lagrangian mechanics to model a weird shaped solid in motion what is a helpful way to describe the solid mathematically?
Can you give some example?
 A: As you well said that's a difficult problem. Personally, when dealing with weird geometry I would use numerical methods. And I would not use Lagrangian mechanics for things like deformations or rotations. Is not because you can't do it, is that in the computer is easier to use other methods such as molecular dynamics or finite elements. Nevertheless, you actually can try to find an analítical expression for those strange geometries by using the Fourier series. There are more options than the Fourier series but my example will be with Fourier. To describe a 3-dimensional surface you need a base of 3 orthogonal functions.
Here's one example, let's say that you have the numerical data or the coordinates of the border ($\delta D$) of your solid (D). You can define a function with that data z=f(x,y). In the case of your sphere, that function would be $z=\pm\sqrt{1-x^2-y^2}$. Then, in this case, you can get away whit a base of 2 components,
$$
f(x,y)=\sum_{n,m}^{\infty}A_{n}\sin(\frac{n\pi}{a}x)J_0(\frac{\alpha_{0,m}}{b}y)
$$
Then using the orthogonality of the base functions you can calculate the coefficients.
$$
 A_{m,n}=\frac{4\int_0^b\int_0^ayf(x,y)\sin{\left(\frac{n\pi}{a}x\right)}J_0\left(\frac{\alpha_{0,m}}{b}y\right)dxdy}{ab^2J_1^2(\alpha_{0,m})}
$$
$J_0$ is the Bessel function of order 0 and $\alpha_{m,n}$ is the nth cero of the Bessel function of order m.
You have to remember that the limits of your integral and the base functions should be picked accordingly with your problem. Also, I would do that integral numerically. But after obtaining the coefficients you can have an analytical expression of your strange geometry.
I choose the Bessel function and the sine because I had it already in a latex document of a protect I have but you can choose whatever base you like, as long it is appropriate.
3Blue1Brown has some very cool videos about the Fourier series and in the videos, you can si how he describes very difficult curves. Here is a link to one of those videos but there are more videos.
https://www.youtube.com/watch?v=r6sGWTCMz2k&t=120s.
At the beginning, I said that you need 3 base functions because if you want to add to your solid more properties, for example, the density on each point or if your surface changes in time you have to add an other coordinate.
