In ConTeXt, it is possible to draw the root using Metapost. In the code below, I basically define a new radical alternative called hyperloop
, which places the body and the radical of the square root as the appropriate place and then draws the lines. The output is not an exact match of what you had drawn by hand, but is close. Of course, you can tweak the definition of math_radical_hyperloop
to change the shape, as desired.
First, the metapost code to draw the root:
\startMPextensions
vardef math_radical_hyperplane(expr w,h,d,o,r) =
(-h/3-max(r-o,o),h/3-o) --
(-h/3-o,h/3-o) --
(-o,-d-o) --
(o,h+o) --
(w+o,h+o) --
(w+o,h-h/8+o)
enddef ;
\stopMPextensions
Next, we define a uniqueMP graphic that draws the root:
\startMPextensions
vardef math_radical_hyperplane(expr w,h,d,o,r) =
(-h/3-max(r-o,o),h/3-o) --
(-h/3-o,h/3-o) --
(-o,-d-o) --
(o,h+o) --
(w+o,h+o) --
(w+o,h-h/8+o)
enddef ;
\stopMPextensions
and finally we define a math radical alternative:
\newbox\radicalbox
\unprotected\setvalue{\??mathradicalalternative hyperplane}#1%
{\begingroup
\setbox\nextbox\mathstylehbox{#1}%
\setbox\radicalbox\mathstylehbox{\scriptscriptstyle\currentmathradicaldegree\hss}%
%
\scratchoffset \mathradicalparameter\c!mpoffset
\scratchtopoffset \dimexpr\scratchoffset+\dp\nextbox\relax
\scratchbottomoffset\dimexpr\ht\nextbox/3\relax
\scratchleftoffset \wd\radicalbox
% we use the \overlay variables as these are passes anyway and
% it's more efficient than using parameters
\d_overlay_width \wd\nextbox
\d_overlay_height \ht\nextbox
\d_overlay_depth \dp\nextbox
\d_overlay_offset \scratchoffset
\d_overlay_linewidth\linewidth
\edef\overlaylinecolor{\mathradicalparameter\c!color}%
%
\edef\p_mp{\mathradicalparameter\c!mp}%
%
\setbox\scratchbox\hpack\bgroup
\uniqueMPgraphic
{\p_mp}%
{radical=\scratchleftoffset}%
\egroup
\scratchdimen \wd\scratchbox
\hpack to \scratchdimen{\hss\box\nextbox\hskip\scratchoffset}%
\hskip-\scratchdimen
\lower\dimexpr\scratchtopoffset\box\scratchbox%
\ifx\currentmathradicaldegree\empty \else
\wd\radicalbox\scratchdimen
\hskip-\scratchdimen
\raise\dimexpr\scratchbottomoffset\box\radicalbox
\fi
\endgroup}
This can be used as follows:
\definemathradical[sqrt][alternative=hyperplane, mp=math:radical:hyperplane,
color=red]
\starttext
$
\sqrt{X}
\sqrt[3]{X}
\sqrt[2^n]{X}
$
\stoptext
which gives

Here is the complete code:
\startMPextensions
vardef math_radical_hyperplane(expr w,h,d,o,r) =
(-h/3-max(r-o,o),h/3-o) --
(-h/3-o,h/3-o) --
(-o,-d-o) --
(o,h+o) --
(w+o,h+o) --
(w+o,h-h/8+o)
enddef ;
\stopMPextensions
\setupmpvariables[math:radical:hyperplane][radical=0pt]
\startuniquempgraphic{math:radical:hyperplane}{radical}
draw
math_radical_hyperplane(overlaywidth,overlayheight,overlaydepth,overlayoffset,\mpvar{radical})
withpen pencircle xscaled (2overlaylinewidth) yscaled (3overlaylinewidth/4) rotated 30
% dashed evenly
withcolor overlaylinecolor ;
\stopuniquempgraphic
\newbox\radicalbox
\unprotected\setvalue{\??mathradicalalternative hyperplane}#1%
{\begingroup
\setbox\nextbox\mathstylehbox{#1}%
\setbox\radicalbox\mathstylehbox{\scriptscriptstyle\currentmathradicaldegree\hss}%
%
\scratchoffset \mathradicalparameter\c!mpoffset
\scratchtopoffset \dimexpr\scratchoffset+\dp\nextbox\relax
\scratchbottomoffset\dimexpr\ht\nextbox/3\relax
\scratchleftoffset \wd\radicalbox
% we use the \overlay variables as these are passes anyway and
% it's more efficient than using parameters
\d_overlay_width \wd\nextbox
\d_overlay_height \ht\nextbox
\d_overlay_depth \dp\nextbox
\d_overlay_offset \scratchoffset
\d_overlay_linewidth\linewidth
\edef\overlaylinecolor{\mathradicalparameter\c!color}%
%
\edef\p_mp{\mathradicalparameter\c!mp}%
%
\setbox\scratchbox\hpack\bgroup
\uniqueMPgraphic
{\p_mp}%
{radical=\scratchleftoffset}%
\egroup
\scratchdimen \wd\scratchbox
\hpack to \scratchdimen{\hss\box\nextbox\hskip\scratchoffset}%
\hskip-\scratchdimen
\lower\dimexpr\scratchtopoffset\box\scratchbox%
\ifx\currentmathradicaldegree\empty \else
\wd\radicalbox\scratchdimen
\hskip-\scratchdimen
\raise\dimexpr\scratchbottomoffset\box\radicalbox
\fi
\endgroup}
\definemathradical[sqrt][alternative=hyperplane, mp=math:radical:hyperplane,
color=red]
\starttext
\startTEXpage[offset=3mm]
$
\sqrt{X}
\sqrt[3]{X}
\sqrt[2^n]{X}
$
\stopTEXpage
\stoptext