| To: | <s-news@wubios.wustl.edu> |
|---|---|
| Subject: | Double integration 3 |
| From: | "Dr. Takashi Kikuchi" <takashi.kikuchi@st-hughs.oxford.ac.uk> |
| Date: | Fri, 29 Jun 2001 10:07:50 +0100 |
| References: | <01fc01c0ffc5$229f4f80$761401a3@stats.ox.ac.uk> |
Dear All
After several try and error, I have found a solution for a double
integration of f(x,y)= 2- 2*x- 2*y/3 over {x, 0,1} and {y, 3-x, 3-3x}.
Integrate on y first and on x next.
demo.fn <- function()
{
fun <- function(x)
unlist(lapply(x, function(x)
{
integrate(f = function(y, x)
2 - 2 * x - (2 * y)/3, lower = 3 - x, upper = 3 - 3 * x, x = x)$integral
}
))
integrate(f = fun, lower = 0, upper = 1)$integral
}
demo.fn()
[1] 0.4444444
This returns "a right answer". Does it have something wrong? Please test
these S-codes with your examples and report it.
Thank you.
Best,
Takashi Kikuchi
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | S-PLUS 6 for Windows Release Candidate 3 now available, David M Smith |
|---|---|
| Next by Date: | summary:convert to weights, Andrew Beckerman |
| Previous by Thread: | Relating distribution parameters to other outcomes (non SPLUS), Patrik Öhagen |
| Next by Thread: | Re: Double integration 2, Bob Baskin |
| Indexes: | [Date] [Thread] [Top] [All Lists] |