Dear Dawood,
it is not a really good idea to open a new email with the same problem you
already posted earlier.
I see you accepted some suggestions (HTML, seq) but not others (pi is a defined
constant in R, do not change it, type pi ENTER to see this.). I would like to
add one more, c is a function, do not use it as a variable name (I used cc
instead of c).
I tried to figure out what you want here. The following code might do what you
want. It gives you a feeling about how you would create a basic loop. There are
nicer ways to do that in R. Note the [i]-s in the for loop!
cc <- 0.5
xc <- 2
s <- 6
Hc2 <- 30
H <- 1
ep<-seq(0.01, 0.49, by=0.001)
res <- numeric(length=length(ep))
for (i in 1:length(ep)){
f<-function(k) 1.211*10^(-6)*Hc2/H*(trigamma( ((ep[i] + H/Hc2 + (2*xc/s)^2*(1
- cos(k*s))/2)/2*Hc2/H)) - trigamma(((cc + H/Hc2 + (2*xc/s)^2*(1 -
cos(k*s))/2)/2*Hc2/H)))
res[i] <- integrate(f,-pi/s,pi/s)$value
}
Best,
daniel
________________________________________
Feladó: R-help [[email protected]] ; meghatalmazó: dawood ahmad
[[email protected]]
Küldve: 2015. május 4. 10:29
To: [email protected]
Tárgy: [R] Need Help!
Dear Sir/Madam,
I hope you will be fine. I am new to R language. Recently, I am trying to fit
my data with one model.
I am sending you the code and image file on which you can see the error I am
receiving instead of executing.
If I give a single value to parameter "ep", it executes well, but if I make a
loop/seq for getting a range of data it shows
error.I need you help in solving this problem.
Thanking in advance,
With Best Regards,
Dawood
______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.