f<-function(s){log(s^2*sin(s)+cos(s))}
curve(f,0,2.9)
n=500000
b=(2.9-0)/n # base dos retângulos
x=seq(0,2.9,by=b)
soma=0
for ( i in 2:length(x)){soma=soma+f(x[i])*b
if ( soma >=1){parada=i;break}
}
parada
print(soma,digits=22)
print("Solucao de g(t)=1 e t=");print(x[parada],digits=22)
print("Erro aproximado em t e");b
To embed this project on your website, copy the following code and paste it into your website's HTML: