Hi,

> how can i write a loop that makes algorithm keeps repeating until a solution
> is converged?do i use a for loop? i know that we can use for loop to ask for
> a number of repetitions, but how to use it to ask the algorithm to keep
> repeating until a solution is converged?

I don't know what your problem is, and I am far from being a specialist, but it
seems to me that in this case you often use a variable, for example 'epsilon',
which measures your "level of convergence". Then you could you use a loop which
repeats while this measure is above a certain threshold, for example :

while (epsilon > 0.0001) {
   ... repeated expressions ...
}


Hope that helps,

-- 
Julien

______________________________________________
R-help@stat.math.ethz.ch mailing list
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.

Reply via email to