Example 1: ((cos x)/(Sqrt[x]))

NIntegrate[Cos[x]/Sqrt[x], {x, 0. , 1. }]

First term

Clear[q];
q[x_] = (Cos[x] - 1)/Sqrt[x];
q[0. ] = 0. ;

Plot[q[x], {x, 0, 1}]

a = 0. ;
b = 1. ;
approx = 
      Table[
n = 
          2^m; 
h = (b - a)/n; 
h/
            3*(q[a] + 4  Sum[q[a + k*h], {k, 1, n - 1, 2}] + 
              2  Sum[q[a + k*h], {k, 2, n - 2, 2}] + q[b]), {m, 0, 
          10}]

exact = NIntegrate[q[x], {x, 0, 1}]

(exact - approx)/exact

Plot[q''''[x], {x, 0, 1}]

q''''[10. ^-4]

Next term

Clear[q];
q[x_] = (Cos[x] - 1 + x^2/2)/
          Sqrt[x];
q[0. ] = 0. ;

Plot[q[x], {x, 0, 1}, PlotRange -> All]

NIntegrate[q[x], {x, 0, 1}]

a = 0. ;
b = 1. ;
Table[
n = 
        2^m; 
h = (b - a)/n; 
h/
          3*(q[a] + 4  Sum[q[a + k*h], {k, 1, n - 1, 2}] + 
            2  Sum[q[a + k*h], {k, 2, n - 2, 2}] + q[b]), {m, 0, 
        10}]

Next term

Clear[q];
q[x_] = (Cos[x] - 1 + x^2/2 - x^4/4!)/
          Sqrt[x];
q[0. ] = 0. ;

Plot[q[x], {x, 0, 1}, PlotRange -> All]

NIntegrate[q[x], {x, 0, 1}]

a = 0. ;
b = 1. ;
approx = 
      Table[
n = 
          2^m; 
h = (b - a)/n; 
h/
            3*(q[a] + 4  Sum[q[a + k*h], {k, 1, n - 1, 2}] + 
              2  Sum[q[a + k*h], {k, 2, n - 2, 2}] + q[b]), {m, 0, 
          10}]

exact = NIntegrate[q[x], {x, 0, 1}]

(exact - approx)/exact

Plot[q''''[x], {x, 0, 1}]

Example 2: ((e^x)/(Sqrt[x]))

NIntegrate[Exp[x]/Sqrt[x], {x, 0. , 1. }]

First term

Clear[q];
q[x_] = (Exp[x] - 1)/Sqrt[x];
q[0. ] = 0. ;

Plot[q[x], {x, 0, 1}, PlotRange -> All]

NIntegrate[q[x], {x, 0, 1}]

a = 0. ;
b = 1. ;
approx = 
      Table[
n = 2^m; 
h = (b - a)/n; 
        h/3*(q[a] + 4  Sum[q[a + k*h], {k, 1, n - 1, 2}] + 
              2  Sum[q[a + k*h], {k, 2, n - 2, 2}] + q[b]), {m, 0, 
          10}]

exact = NIntegrate[q[x], {x, 0, 1}]

(exact - approx)/exact

Next term

Clear[q];
q[x_] = (Exp[x] - 1 - x)/Sqrt[x];
q[0. ] = 0. ;

Plot[q[x], {x, 0, 1}, PlotRange -> All]

NIntegrate[q[x], {x, 0, 1}]

a = 0. ;
b = 1. ;
Table[
n = 
        2^m; 
h = (b - a)/n; 
h/
          3*(q[a] + 4  Sum[q[a + k*h], {k, 1, n - 1, 2}] + 
            2  Sum[q[a + k*h], {k, 2, n - 2, 2}] + q[b]), {m, 0, 
        10}]

Next term

Clear[q];
q[x_] = (Exp[x] - 1 - x - x^2/2)/
          Sqrt[x];
q[0. ] = 0. ;

Plot[q[x], {x, 0, 1}, PlotRange -> All]

exact = NIntegrate[q[x], {x, 0, 1}]

a = 0. ;
b = 1. ;
approx = 
      Table[
n = 
          2^m; 
h = (b - a)/n; 
h/
            3*(q[a] + 4  Sum[q[a + k*h], {k, 1, n - 1, 2}] + 
              2  Sum[q[a + k*h], {k, 2, n - 2, 2}] + f[b]), {m, 0, 
          10}]

(approx - exact)/exact

Plot[q''''[x], {x, 0, 1}]

Next term

Clear[q];
q[x_] = (Exp[x] - 1 - x - x^2/2 - x^3/3! - x^4/4!)/
          Sqrt[x];
q[0. ] = 0. ;

Plot[q[x], {x, 0, 1}, PlotRange -> All]

a = 0. ;
b = 1. ;
approx = 
      Table[
n = 
          2^m; 
h = (b - a)/n; 
h/
            3*(q[a] + 4  Sum[q[a + k*h], {k, 1, n - 1, 2}] + 
              2  Sum[q[a + k*h], {k, 2, n - 2, 2}] + q[b]), {m, 0, 
          10}]

exact = NIntegrate[q[x], {x, 0, 1}]

(approx - exact)/exact