Re: [R] A strange behaviour in the graphical function curve

2013-04-12 Thread Julio Sergio
Berend Hasselman bhh at xs4all.nl writes: Yes. curve expects the function you give it to return a vector if the input argument is a vector. This is clearly documented for the argument expr of curve. Thanks a lot, Berend! In fact, I didn't read carefully the documentation of curve. Anyway,

Re: [R] A strange behaviour in the graphical function curve

2013-04-12 Thread Julio Sergio
Berend Hasselman bhh at xs4all.nl writes: Your function miBeta returns a scalar when the argument mu is a vector. Use Vectorize to vectorize it. Like this VmiBeta - Vectorize(miBeta,vectorize.args=c(mu)) VmiBeta(c(420,440)) and draw the curve with this

Re: [R] A strange behaviour in the graphical function curve

2013-04-12 Thread Jeff Newmiller
See below On Fri, 12 Apr 2013, Julio Sergio wrote: Berend Hasselman bhh at xs4all.nl writes: Your function miBeta returns a scalar when the argument mu is a vector. Use Vectorize to vectorize it. Like this VmiBeta - Vectorize(miBeta,vectorize.args=c(mu)) VmiBeta(c(420,440)) and draw

Re: [R] A strange behaviour in the graphical function curve

2013-04-12 Thread David Winsemius
On Apr 12, 2013, at 7:58 AM, Julio Sergio wrote: Berend Hasselman bhh at xs4all.nl writes: Your function miBeta returns a scalar when the argument mu is a vector. Use Vectorize to vectorize it. Like this VmiBeta - Vectorize(miBeta,vectorize.args=c(mu)) VmiBeta(c(420,440)) and draw

Re: [R] A strange behaviour in the graphical function

2013-04-12 Thread Julio Sergio
Jeff Newmiller jdnewmil at dcn.davis.ca.us writes: system.time( miBeta( seq( 370, 430, length.out=1e5 ) ) ) user system elapsed 1.300 0.024 1.476 system.time( miBetav( seq( 370, 430, length.out=1e5 ) ) ) user system elapsed This is very interesting, Jeff. Of course, I

[R] A strange behaviour in the graphical function curve

2013-04-11 Thread Julio Sergio
I thought the curve function was a very flexible way to draw functions. So I could plot funtions like the following: # I created a function to produce functions, for instance: fp - function(m,b) function(x) sin(x) + m*x + b # So I can produce a function like this ff - fp(-0.08, 0.2)

Re: [R] A strange behaviour in the graphical function curve

2013-04-11 Thread Berend Hasselman
On 12-04-2013, at 05:15, Julio Sergio julioser...@gmail.com wrote: I thought the curve function was a very flexible way to draw functions. So I could plot funtions like the following: # I created a function to produce functions, for instance: fp - function(m,b) function(x) sin(x) +