how to find center/radius of a sphere Say you have an irregular tetrahedron, but you know the (x,y,z) coordinates of the four vertices; is there a simple formula for finding a sphere whose center exists within the tetrahedron formed by the four points and on whose surface the four points lie?

Given four points, a, b, c, and d, you can find the center by setting the following determinant to zero and solving it:
$$
\begin{vmatrix}
(x^2  + y^2  + z^2)  &  x &  y & z  & 1 \\
(ax^2 + ay^2 + az^2) & ax & ay & az & 1 \\
(bx^2 + by^2 + bz^2) & bx & by & bz & 1 \\
(cx^2 + cy^2 + cz^2) & cx & cy & cz & 1 \\
(dx^2 + dy^2 + dz^2) & dx & dy & dz & 1 \\
\end{vmatrix}
= 0
$$
The math is gnarly, but the following C++ code implements the solution:
class Point {
  public:
    double x;
    double y;
    double z;
    Point() { x = 0; y = 0; z = 0; }
    Point(double x_, double y_, double z_) { x = x_; y = y_; z = z_; }
};
    
class Sphere {
  public:
    Point center;
    double radius;
    Sphere(Point center_, double radius_) {
        center = Point(center_.x, center_.y, center_.z);
        radius = radius_;
    }
};
    
Sphere
sphereFromFourPoints(Point a, Point b, Point c, Point d)
{
#define U(a,b,c,d,e,f,g,h) (a.z - b.z)*(c.x*d.y - d.x*c.y) - (e.z - f.z)*(g.x*h.y - h.x*g.y)
#define D(x,y,a,b,c) (a.x*(b.y-c.y) + b.x*(c.y-a.y) + c.x*(a.y-b.y))
#define E(x,y) ((ra*D(x,y,b,c,d) - rb*D(x,y,c,d,a) + rc*D(x,y,d,a,b) - rd*D(x,y,a,b,c)) / uvw)
    double u = U(a,b,c,d,b,c,d,a);
    double v = U(c,d,a,b,d,a,b,c);
    double w = U(a,c,d,b,b,d,a,c);
    double uvw = 2 * (u + v + w);
    if (uvw == 0.0) {
        // Oops.  The points are coplanar.
    }
    auto sq = [] (Point p) { return p.x*p.x + p.y*p.y + p.z*p.z; };
    double ra = sq(a);
    double rb = sq(b);
    double rc = sq(c);
    double rd = sq(d);
    double x0 = E(y,z);
    double y0 = E(z,x);
    double z0 = E(x,y);
    double radius = sqrt(sq(Point(a.x - x0, a.y - y0, a.z - z0)));
    return Sphere(Point(x0, y0, z0), radius);
}

