[R] Looking for package to solve for exponent using newton's method

Berend Hasselman bhh at xs4all.nl
Thu Oct 10 21:03:00 CEST 2013

On 10-10-2013, at 20:39, Ken Takagi <katakagi at bu.edu> wrote:

> Hi,
> I'm looking for an R function/package that will let me solve problems of the
> type:
> 13 = 2^x + 3^x.
> The answer to this example is x = 2, but I'm looking for solutions when x
> isn't so easily determined. Looking around, it seems that there is no
> algebraic solution for x, unless I'm mistaken.  Does anyone know a good
> package to solve these types of problems? Are there built in functions to do
> this?

Univariate equations can be solved with uniroot, available in base R.

You can also use package nleqslv for this but that is intended for systems of nonlinear equations.
It does however solve your equation.
There is also BB which is especially intended for large sparse systems.


More information about the R-help mailing list