Sei sulla pagina 1di 3

Realice la expansión de la función f(x) = (a-x)^6 y prográmela en Rstudio y grafique hasta encontrar el

error acumulado.

f= function(x) (a-x)^6

ef = function(x) a^6-6*a^5*x+15*a^4*x^2-20*a^3*x^3+15*a^2*x^4-6*a*x^5+x^6

options(scipen = 999)

x= seq(0.995, 1.005, by=0.0001)

y1 = f(x)

y2 = ef(x)

(y1-y2)

x=seq(0.995, 1.005, by=0.0001)

a= x[1]; b=x[length (x)]

curve((a-x)^6, a, b, col="blue"); abline(h=0,v=0, lty=3)

curve(a^6-6*a^5*x+15*a^4*x^2-20*a^3*x^3+15*a^2*x^4-6*a*x^5+x^6, a, b, col="green", add=T)


Invente dos funciones, realice el desarrollo de Rstudio y los resultados, al igual, que el gráfico.

1- (1+x)^5

f=function(x) (1+x)^5

ef=function(x) (x^5)+(5*x^4)+(10*x^3)+(10*x^2)+(5*x)+1

options(scipen = 999)

x= seq(0.995, 1.005, by=0.0001)

y1 = f(x)

y2 = ef(x)

(y1-y2)

x=seq(0.995, 1.005, by=0.0001)

a= x[1]; b=x[length (x)]

curve((1+x)^5, a, b, col="yellow"); abline(h=0,v=0, lty=3)

curve(x^5+5*x^4+10*x^3+10*x^2+5*x+1, a, b, col="red", add=T)


2- (a-x)^5
f=function(x) (a-x)^5
ef=function(x) (a^5)-(5*a^4*x)+(10*a^3*x^2)-(10*a^2*x^3)+(5*a*x^4)-x^5
options(scipen = 999)
x= seq(0.995, 1.005, by=0.0001)
y1 = f(x)
y2 = ef(x)
(y1-y2)

x=seq(0.995, 1.005, by=0.0001)


a= x[1]; b=x[length (x)]
curve((a-x)^5, a, b, col="yellow"); abline(h=0,v=0, lty=3)
curve(a^5-5*a^4*x+10*a^3*x^2-10*a^2*x^3+5*a*x^4-x^5, a, b, col="red", add=T)

Potrebbero piacerti anche