Re: [R] loop function and integrate?

2012-11-30 Thread faeriewhisper
hello guys! thank u for the help, but u didnt understood what i need. 1st, it is a[i] cuz i want to sum 1 + x[i], for all i's not j. but i've solved it! :) like i said, my code is more complex, but, if you need to integrate several functions in a loop, thats what you should do: w2 = seq(-1,-1/3,l

Re: [R] loop function and integrate?

2012-11-30 Thread faeriewhisper
Now i've managed to do this: funcs <- list() funcs[] # loop through to define functions for(i in 1:ib-1){ # Make function name funcName <- paste( 'func', i, sep = '' ) # make function func = paste('function(x){sin(x + a[', i,'])))}',sep = '') funcs[[funcName]] = eval(parse(

[R] loop function and integrate?

2012-11-30 Thread faeriewhisper
Hi guys! I have to compute something and i don't know what i'm doing wrong. my code is a bit complex, but imagine that is something like this: a = c(1,2,3,4) ia = length(a) x = seq(1,100,length=0.1) ib = length(x) int1 = numeric(ib) b = numeric(ib) for(j in 1:ia) { H = function(x) {

[R] can't integrate in loop

2012-11-30 Thread faeriewhisper
Hi guys! I have to compute something and i don't know what i'm doing wrong. my code is a bit complex, but imagine that is something like this: a = c(1 2 3 4) ia = length(a) x = seq(1,100,length=0.1) ib = length(x) for(j in 1:ia) { H = function(x) {sen(x) + a[j]} for(i in 1:ib) {