Skip to content
Prev 303180 / 398503 Next

What's wrong with my code?

stephenxqy wrote
Not necessarily. For example in function Pexv you evaluate Rg(L,b) 5 times.
You can also do this evaluating Rg(L,b) once and the same thing for the
evaluation of w(...)

Pexv<-function(v,L,b) {
    RgLb <- Rg(L,b)
    wq <- w(q*RgLb) 
   
wq*PDebye(L,b)+(1-wq)*(1.22*(q*RgLb)^(-1/v)+0.4288*(q*RgLb)^(-2/v)-1.651*(q*RgLb)^(-1/v)) 
}

Other functions can be treated in a similar way.
Depending on how often Pfit is called and/or how long the vector q is, this
could save you some cpu time.

Berend





--
View this message in context: http://r.789695.n4.nabble.com/What-s-wrong-with-my-code-tp4640034p4640093.html
Sent from the R help mailing list archive at Nabble.com.