This is more of a comment, but posted as an answer since it is fairly long.

Note that `*`

is enough to compute dot product of vectors, no need
for `.dot_product`

or the function `f`

that you defined for short.

Below is an attempt to somewhat simplify the code in the question,
to make it easier on the eye.

- use
`a`

, `b`

, `c`

instead of `a_1`

, `b_1`

, `c_1`

- use
`va`

, `vb`

, `vc`

instead of `a`

, `b`

, `c`

- use
`vu`

instead of `Circum`

and `v`

instead of `Circum2d`

- use
`vh`

instead of `H_1`

and just `(vh*vh)`

for `H_d`

- use an auxiliary function
`m`

to help define `p`

- name
`w`

the end result in the question

If I got things right, the computation can then be rewritten as:

```
sage: a, b, c, z = SR.var('a b c z')
sage: va = vector([a, sqrt(1 - a^2 - z^2), z])
sage: vb = vector([b, sqrt(1 - b^2 - z^2), z])
sage: vc = vector([c, sqrt(1 - c^2 - z^2), z])
sage: vu = vector([0, 0, z])
sage: vh = va + vb + vc - 3*vu
sage: vd = vh - sqrt(1 - (vh*vh)) * vector([0, 0, 1])
sage: def m(x, y):
....: return ((x*x)*(y*y) - (x*y)*(y*y))/(2*(x*x)*(y*y) - 2*(x*y)*(x*y))
sage: def p(x, y):
....: return m(x, y)*x + m(y, x)*y
sage: def v(r, s, t):
....: return p((r - t), (s - t)) + t
sage: G = 1/4*(va + vb + vc + vd)
sage: H = vu + v(va, vb, vd) + v(va, vc, vd) + v(vb, vc, vd)
sage: w = (H*G)/sqrt((H*H)*(G*G))
```

and if I understand correctly, the question is how to simplify `w`

, right?

(In the question, the method `.simplify_rational`

is applied only to the
denominator but I guess the intention was to simplify the whole thing.)

Note that the string representation of `w`

is quite long: with ~ 50k characters.

```
sage: s = str(w)
sage: len(s)
49587
```

(Note that with the original `a_1`

, `b_1`

, `c_1`

we would get 55539).

Now, how to go about that?

One could use `.simplify_full`

instead of just `.simplify_rational`

,
or try `.simplify_exp`

which might work better with square roots.

One could try to simplify at each step, instead of only at the end;
that is, apply simplifications in the functions `m`

, `p`

, `v`

, and
then in `G`

and `H`

before computing `w`

.

One could compute the square of `w`

rather than `w`

itself,
getting rid of the `sqrt`

in the denominator:

```
sage: ww = (H*G)*(H*G)/(H*H)*(G*G)
```

or even

```
sage: hg = (H*G).simplify_full()
sage: hh = (H*H).simplify_full()
sage: gg = (G*G).simplify_full()
sage: wwnum = (hg^2).simplify_full()
sage: wwden = (hh*gg).simplify_full()
sage: ww = (wwnum/wwden).simplify_full()
```

For a test, I have something around 500 digits long when not simplified, and that takes less than 1 minute to simplify

If you want us to give a try, you need to provide your code.

This is the code:

Something is wrong with the line