# Exercici 9.14

## Apartat a)

kill(all)$
fpprintprec:6$

f(x):=log(x+1);
wxplot2d([f(x)], [x,0,1], [ylabel, ""] , [legend, ""] , [style, [lines, 2]] ,
 [gnuplot_preamble, "set grid; set zeroaxis;"])$

## Apartat b)

### Càlcul analític

g(x):=(f(x))^2$
'g(x)=g(x);
'integrate(g(x) , x)  = integrate(g(x) , x);

'integrate(g(x), x, 0, 1) = integrate(g(x) , x, 0 , 1);
'integrate(g(x), x, 0, 1) = integrate(g(x) , x, 0 , 1), numer;

Volum1=%pi*integrate(g(x) , x, 0 , 1), numer;

### Càlcul aproximat per trapezis

s[n]:=g(0 + n*0.2);

makelist(s[n], n, 0, 5);

I1=I1: (1/2)*(s[0] + s[5]) + sum(s[n], n, 1, 4);

h=h:0.2$
I_trap=I_trap: h * I1;

Volum_trap=%pi *I_trap, numer;

### Càlcul aproximat per Romberg

Volum_romberg=%pi*romberg(g(x) , x, 0, 1), numer;

## Apartat c)

### Càlcul analític

diff(f(x), x);

sqrt(1 + (1/(x+1))^2) ;

radcan(%);

define (F(x) , %) ;

'integrate(F(x) , x) = integrate(F(x) , x);

'integrate(F(x) , x, 0, 1) = integrate(F(x) , x, 0, 1), numer;

### Càlcul per trapezis

s2[n]:=F(0 + n*0.2);

makelist(s2[n], n, 0, 5);

L1=L1: (1/2)*(s2[0] + s2[5]) + sum(s2[n], n, 1, 4);

L2=L2: h*L1, numer;

### Càlcul per Romberg

romberg(F(x), x, 0, 1);