
Thanks!

Date: Sun, 12 Aug 2012 07:42:12 -0700
From: ml-node+s789695n4640093h13@n4.nabble.com
To: stephenxqy@hotmail.com
Subject: RE: What's wrong with my code?



	
stephenxqy wrote
Yes, missing * is the problem. Thank you a lot. Do you mean I need to incorporate all expression of Rg0sq, Rg etc. into the final Pfit function?


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




	
	
	
	

	

	
	
		If you reply to this email, your message will be added to the discussion below:
		http://r.789695.n4.nabble.com/What-s-wrong-with-my-code-tp4640034p4640093.html
	
	
		
		To unsubscribe from What's wrong with my code?, click here.

		NAML
	 		 	   		  



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

