Approximating arc with non-rational, cubic Bezier

I couldn’t find the solution for this online, so I solved this myself and wanted to share.

Given a (circular) arc between 0° and 180°, what non-rational, cubic Bezier curve can approximate this arc while maintaining G2 continuity at both ends?

The following image shows the start of the work to obtain it. The first equation is a simplified form of eq. 2.13 in
The remaining work is constructing a quadratic equation for t and solving. The curve can then be constructed by using t as the distance from the end points of the curve to the two interior control points.



cos_ = math.cos((math.pi/2.0)-arc_angle)
tan_ = math.tan(arc_angle/2.0)
sqrt_ = (1.0 + 6.0*tan_/cos_)**0.5
t = radius * cos_ * (sqrt_ - 1.0) / 3.0

The following table includes alternative ways to construct the non-rational, cubic Bezier. The Stack Overflow solution is found at
geometry - How to create circle with Bézier curves? - Stack Overflow

Arc:				 CentralAngle: 90.00			           Radius: 1.000000

RC's Arc.ToNurbsCurve (non-rat'l):	DevFromArc: 0.002727  StartRadius: 0.868325  EndRadius: 0.868325
Rebuild (preserveTans=False):		DevFromArc: 0.002727  StartRadius: 0.868325  EndRadius: 0.868325
Rebuild (preserveTans=True):		DevFromArc: 0.009540  StartRadius: 0.919482  EndRadius: 0.919482
Solution on Stack Overflow:		    DevFromArc: 0.000272  StartRadius: 1.021917  EndRadius: 1.021917
Solution by SPB:			        DevFromArc: 0.001963  StartRadius: 1.000000  EndRadius: 1.000000