[R] Iterative Solver [Converting Matlab's solve()]

From: Boris Igic <bigic_at_ucsd.edu>
Date: Mon, 18 Jun 2007 21:24:19 -0700 (PDT)


I can't for the life of me figure out how to get the roots for this simple (but sovable only iteratively) equation in R:

x = z*(1-(1-2/z)^y

where x and y are known, and z is unknown. In Matlab, this amounts to:

[my.solution] = solve('x = z*(1-(1-2/z)^y') my.solution.real = solution(y-1,y)

% bottom line displays non-imaginary solution (last element)

Obviously, I'm deeply unqualified as a mathematician or programmer and regret wasting your time if this question is really basic. I would very much appreciate even the smallest morsel of time that you might spend on this, and yes, you could be my hero.

Many Thanks,

Boris

P.S. The above equation is from: Paxman GJ (1963). Maximum likelihood estimation of the number of self-sterility alleles in a population. Genetics 48: 1029-1032.



R-help_at_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. Received on Tue 19 Jun 2007 - 04:32:58 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 19 Jun 2007 - 07:32:18 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.