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

Robert A LaBudde ral at lcfltd.com
Tue Jun 19 07:40:23 CEST 2007


At 12:24 AM 6/19/2007, Boris wrote:
>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)
><snip>

1.  Your equation is syntactically incorrect. It is missing a ")". 
Ditto for your Matlab example.

2. Are you looking for an analytical (symbolic) solution? If so, I 
don't believe one exists (if you place a ")" after y).

3. To find numerical roots, see uniroot().

4. If you want more help, you'll have to specify domains or values for x and y.

================================================================
Robert A. LaBudde, PhD, PAS, Dpl. ACAFS  e-mail: ral at lcfltd.com
Least Cost Formulations, Ltd.            URL: http://lcfltd.com/
824 Timberlake Drive                     Tel: 757-467-0954
Virginia Beach, VA 23464-3239            Fax: 757-467-2947

"Vere scire est per causas scire"



More information about the R-help mailing list