Cayley surface;
3rd form from http://www.mathcurve.com/surfaces/cayley/cayley.shtml
(%i1)
cayley: (x^2 + y^2 + z^2) + 2 * x * y * z - 1 = 0;
Ray intersection:
(%i2)
eqn:expand(cayley), x = o[0] + t * d[0], y = o[1] + t * d[1], z = o[2] + t * d[2];
(%i3)
expand(coeff(lhs(eqn), t, 3));
(%i4)
expand(coeff(lhs(eqn), t, 2));
(%i5)
expand(coeff(lhs(eqn), t, 1));
(%i6)
expand(coeff(lhs(eqn), t, 0));
Gradient (normal vector):
(%i7)
diff(lhs(cayley), x, 1);
(%i8)
diff(lhs(cayley), y, 1);
(%i9)
diff(lhs(cayley), z, 1);