I'm trying to inductively define toratope notation using implicit equations.

As well all know, to find the equation for ((III)(II)), we take the equations for (III) and (II) and sort of "Pythagoras them together".

(III): sqrt(x^2 + y^2 + z^2) - r_1 = 0

(II): sqrt(x^2 + y^2) - r_2 = 0

((III)(II)): sqrt((sqrt(x^2 + y^2 + z^2) - r_1)^2 + (sqrt(w^2 + t^2) - r_2)^2) - r_3 = 0.

I thought this would work for everything. But the problem I've just run into is that if you follow this rule naively for intervals, it doesn't work. Take the basic torus ((II)I).

(II): sqrt(x^2 + y^2) - r_2 = 0

I: sqrt(x^2) -r_2 = |x| - r_2 = 0

If we combine this we get

((II)I): sqrt((sqrt(x^2 + y^2) - r_1)^2 + (|z| - r_2)^2) - r_3 = 0,

which is actually a pair of torii. It only degenerates to a torus when we let r_2 = 0. What we actually want is

((II)I): sqrt((sqrt(x^2 + y^2) - r_1)^2 + z^2) - r_3 = 0.

So we have a special case to put in the definition. Can anyone think of an elegant way to deal with this?