Re: [R] wrong length error

2011-02-09 Thread Dennis Murphy
Hi: On Wed, Feb 9, 2011 at 6:29 AM, Claudio Carneiro < claudio_carneiro...@hotmail.com> wrote: > > Hi, all > > I'm trying to solve an optimization problem with two > variables, in wich Iuse the following functions(they all are working > perfectly): > > fxx1=function(x){ > calc=((2.5/3)*((x/3)^(2.

Re: [R] wrong length error

2011-02-09 Thread jim holtman
Your basic problem seems to be that the function RxMixed does not return a value of the same length as its input parameter. I just used the 'debug' library and here is what I got: > mtrace(RxMixed) > integrate(RxMixed,0,10) D(3)> [1] 0.8826402 D(3)> x [1] 5. 0.13046736 9.86953264 0.674

[R] wrong length error

2011-02-09 Thread Claudio Carneiro
Hi, all I'm trying to solve an optimization problem with two variables, in wich Iuse the following functions(they all are working perfectly): fxx1=function(x){ calc=((2.5/3)*((x/3)^(2.5-1))*exp(-(x/3)^2.5)) return(calc)} fxx2=function(x){ calc1=((5.3/19.3)*((x/19.3)^(5.3-1))*exp(-(x/19.3)^5.3