Area Beneath Curve

Area Beneath Curve - Area=function(n) { x = runif(n,0,1)...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#Calculate the Area beneath a Curve from x=0 to x=1 #curve = f(x)=x Area=function(n) { x = runif(n,0,1) curve = x; return(mean(curve)) } Area(100) #curve = f(x)=exp(-x) from x=1 to x=5 Area=function(n) { x = runif(n,0,1) curve = exp(-(4*x+1))*4; return(mean(curve)) } Area(100) #curve = f(x)=exp(-x) from x=0 to x=infinity
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Area=function(n) { x = runif(n,0,1) curve = 1/x^2*exp(-(1/x-1)); return(mean(curve)) } Area(100) #2D #curve = f(x,y)=exp(x+y) Area=function(n) { x = runif(n,0,1) y = runif(n,0,1) curve = exp(x+y); return(mean(curve)) } Area(100)...
View Full Document

Page1 / 2

Area Beneath Curve - Area=function(n) { x = runif(n,0,1)...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online