CellPrint[TextCell[Quiet[cdf =Manipulate[Column[{ "Al aproximar "<>integre<>" obtenemos: "(*<>"≈"TraditionalForm@formulas[[u]]*), Dynamic@SuFunc}],
Style[proposito,Bold,10],Spacer[{100,3}],
 (*Inicio contadores *)
{{ff, (Sqrt[x]),"f(x) = "},ControlType->InputField},
{{puntoA,2,"a = "},ControlType->InputField},
{{puntoB,10,"b = "},ControlType->InputField},
{{maxdiv,10,"Máx. # de Div. = "},ControlType->InputField},
{{tol, 0.01,"Tolerancia = "},ControlType->InputField},
{{detalles,0,"Detalles de subdivisión"},{0->"No",1->"Sí"},ControlType->RadioButton},
Button["Calcular", Dynamic@ SuFunc]
(* Fin contadores *)
,Alignment->Center,Deployed->True,AppearanceElements->"ResetButton",LocalizeVariables->True,ContinuousAction->False,FrameLabel->{{None,None},{Column[{,Row[{Style["Autores: Juan Félix Ávila Herrera y Enrique Vílchez Quesada",Bold,10,RGBColor[0,0,0.5]]}],Row[{Style["Escuela de Informática | Universidad Nacional de Costa Rica",Bold,10,RGBColor[0.5,0.1,0]]}]},Center],Style["Integración adaptativa", Bold,14, RGBColor[0,0.33,0.33]]}},
Initialization:>(
ClearAll["Global`*"];
resultado =0;
integre = ToString[TraditionalForm@Defer[(∫_a^b)f[x]\[DifferentialD]x]];
escriba[lista_]:=Style[Row@lista,Black];
 
 
proposito ="Propósito: Usar integración adaptativa para aproximar "<>integre;
SuFunc := Module[{aux, resp, pt, coef, A, int, error, ok, CalcAprox, totdiv},
resp[x_] := If[x==Round[x], x,ToString[Sign[x]AccountingForm[Abs@N@x]]];
 f[t_] := ff/.x->t;
totdiv =1; 
A[x_, y_] := ((y-x)/6)(f[x]+4f[((x+y)/2)]+f[y]);
int[x_, y_] := A[x, ((x+y)/2)]+A[((x+y)/2), y];
error[x_, y_] := Abs[ (1/15)(A[x, y]-int[x,y])];
ok := True; 
 lista=""; 
CalcAprox[u_, v_, t_] := Module[{aprox}, 
aprox = int[u, v];

(* lista = {" Al trabajar con [",u, v, "], obtenemos: ", resp@aprox, " con error = ", resp@error[u, v], ", Tol =", resp@t,". Cumple? ", If[error[u, v]<N@t, "Sí.", "No."]  };*)
If[detalles ==1, lista =  lista<>"\n"<> ToString@ StringForm["Con [`1`, `2`] da `3`. Cumple Tol.? `4`",N[u, 3],N[v, 3], resp@aprox, If[error[u, v]<N@t, "Sí.", "No."]]];

 
 
aprox =If[ (error[u, v]<t) ∨ (totdiv >maxdiv),   aprox, 
 If[totdiv==1,    
If[detalles==1, lista = ToString@lista<>"\nSubdividimos:"]; ];
 
totdiv ++;
aprox = CalcAprox[u, ((u+v)/2), t/2]+ CalcAprox[ ((u+v)/2),v,  t/2]
];
resultado = aprox;
 If[detalles==1, lista, aprox]
   
];
{a, b}= N@{puntoA, puntoB};
aux =CalcAprox[a, b, tol];
(*If[detalles==1, {aux, resultado} , aux]*)
aux
];
Dynamic@SuFunc
)]],"Text"]]