{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Area Beneath Curve

# Area Beneath Curve - Area=function(n x = runif(n,0,1 curve...

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

#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

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

View Full Document
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

{[ snackBarMessage ]}

### Page1 / 2

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

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

View Full Document
Ask a homework question - tutors are online