One way to write volume charge densities without using piecewise functions is to use step \((\Theta)\) or \(\delta\) functions. If you need to review this, see the following link in the math-physics book:
https://books.physics.oregonstate.edu/GMM/step.html

Consider a spherical shell with charge density \(\rho (\vec{r})=\alpha3e^{(k r)^3}\) between the inner radius \(a\) and the outer radius \(b\). The charge density is zero everywhere else. Use step functions to write this charge density as a single function valid everywhere in space.

Groups are asked to analyze the following standard problem:

Two identical lumps of clay of (rest) mass m collide head on, with each
moving at 3/5 the speed of light. What is the mass of the resulting lump of
clay?