CellPrint[TextCell[Quiet[cdf =Manipulate[SuFunc[u, ff],Style[proposito,Bold,10],Spacer[{100,3}],
 (*Inicio contadores *)
 {{u,0,"n = "},0,5,1,ControlType->RadioButtonBar},
{{ff,E^x,"f(x) = "},ControlType->InputField},
{{puntoA,2,"a = "},ControlType->InputField},
{{puntoB,3,"b = "},ControlType->InputField},
Button["Calcular",pos =u; If[u==1, u=2, u=1];u=pos;  SuFunc[Dynamic@u, ff]] ,
{{math,0,"Calcular con Mathematica "},{0,1},ControlType->Checkbox},
{{darerror,0,"Dar error Aprox. "},{0,1},ControlType->Checkbox}

(* 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["Aproximación numérica de integrales definidas usando las fórmulas abiertas de Newton-Cotes.", Bold,14, RGBColor[0,0.33,0.33]]}},
Initialization:>(
uu=u+1;
escriba[lista_]:=Style[Row@lista,Black];
Clear[a, b, f];
integre = ToString[TraditionalForm@Defer[(∫_a^b)f[x]\[DifferentialD]x]];
 
formulas={{(-a+b) f[((a+b)/2)],(1/3) (h^3) f''[ξ]},{-(1/2) (a-b) (f[(1/3) (2 a+b)]+f[(1/3) (a+2 b)]),(3/4) (h^3) f''[ξ]},{(1/3) (a-b) (f[((a+b)/2)]-2 (f[(1/4) (3 a+b)]+f[(1/4) (a+3 b)])),(14/45) (h^5) Derivative[4][f][ξ]},{-(1/24) (a-b) (f[((3 a)/5)+((2 b)/5)]+f[((2 a)/5)+((3 b)/5)]+11 (f[(1/5) (4 a+b)]+f[(1/5) (a+4 b)])),(95/144) (h^5) Derivative[4][f][ξ]},{-(1/20) (a-b) (26 f[((a+b)/2)]-14 f[(1/3) (2 a+b)]+11 f[(1/6) (5 a+b)]-14 f[(1/3) (a+2 b)]+11 f[(1/6) (a+5 b)]),(41/140) (h^7) Derivative[6][f][ξ]},{(((a-b) (453 f[((5 a)/7)+((2 b)/7)]-562 f[((4 a)/7)+((3 b)/7)]-562 f[((3 a)/7)+((4 b)/7)]+453 f[((2 a)/7)+((5 b)/7)]-611 f[(1/7) (6 a+b)]-611 f[(1/7) (a+6 b)]))/1440),((5257 (h^7) Derivative[6][f][ξ])/8640)}};

Clear[f];

(*($PreRead=(#/. s_String/;StringMatchQ[s,NumberString]&&Precision@ToExpression@s==MachinePrecision:>s<>"`12."&));*)
proposito ="Propósito: Usando las fórmulas abiertas de Newton-Cotes aproximar " <>integre;(*TraditionalForm@Defer[(∫_a^b)f[x]\[DifferentialD]x] ;*)

SuFunc[k_, ff_]:=Module[{aux, resp, pt, coef, error, max, val},
uu=u+1;
resp[x_] := If[val =x; val==Round[val], x,escriba@{x," ≈ ",ToString[Sign[x] AccountingForm[Abs@N@x]]}];
(*resp[x_] := N@x;*)

hache = ((puntoB-puntoA)/(uu+2));
Clear[f, g];
g[t_] = ff/.x->t;
aux =N@formulas[[uu]][[1]]/.{a-> puntoA,b-> puntoB, h->hache, f->g   };
If[darerror==1, error =formulas[[uu]][[2]]/.{a-> puntoA,b-> puntoB, h->hache, f->g };
error=Simplify[error];];

max =N@Quiet[ Maximize[Abs[error], puntoA≤ξ≤ puntoB, ξ]];
 
(*aux = ToString@ TraditionalForm[ (∫_a^b)f[x]\[DifferentialD]x ]<>"≈ "<>*)
aux =  {"Fórmula usada:\n" , 
  integre ,
  "≈", TraditionalForm@formulas[[uu]][[1]],"\n",integre ,  "≈" ,  
   ToString[Sign[aux] AccountingForm[Abs@aux]] } ;
If[math==1, aux = Join[aux, { 
   "\nUsando Mathematica: " ,  integre ,  " = " ,  resp[(∫_puntoA^puntoB)g[x]\[DifferentialD]x]}  ]];
If[darerror==1, aux = Join[aux, {"\nNota. Error usando Aprox =",TraditionalForm[error], "\n|Error Aprox.| ≤" , TraditionalForm@max[[1]]}]];
escriba@aux
 
];
SuFunc[1]
)]],"Text"]]