[R] Need Help!

dawood ahmad dawoodmalik at hotmail.com
Wed Apr 29 16:47:39 CEST 2015


Dear Sir/Madam,
 
I hope you will be fine. Recently, I have started to use R language. I am new in programming. 
I have to fit my data with mathematical equation which I am pasting below. The problem is that one of the
parameter named "ep" which is x-axis required a loop so that I could a range of data. Please see below the code,
 
 
pi<-3.14159; c<-0.5; xc<-2; s<-6; Hc2<-30; H<-1; ep<-0.01; 
f<-function(k) 1.211*10^(-6)*Hc2/H*(trigamma( ((ep + H/Hc2 + (2*xc/s)^2*(1 - cos(k*s))/2)/2*Hc2/H)) -  trigamma(((c + H/Hc2 + (2*xc/s)^2*(1 - cos(k*s))/2)/2*Hc2/H))); 
integrate(f,-pi/s,pi/s)$value
I have typed in bold the x-axis. If I execute this model, it works well. But, I want to make a loop for this parameter inorder to enter a range of values.For instance, from 0.01 to 1 with specific interval (increment interval 0.005). I will be really grateful if you help me in this matter.  With best Regards, Dawood 		 	   		  
	[[alternative HTML version deleted]]



More information about the R-help mailing list