# [R] Numerical solution

Rolf Turner r.turner at auckland.ac.nz
Thu Jan 9 21:51:18 CET 2014

```On 10/01/14 07:00, Greg Snow wrote:

> ?uniroot
> ?optim
> ?optimize

The OP will have to be careful and clever.  Specifying the *intervals*
over which uniroot() and optimise() search is going to be problematic,
it seems to me.

>
> and look at the Optimization and Mathematical Programming task view on CRAN.

There *may* be ways to avoid the problematic specification of search
intervals to be found in this task view ....  Good luck to the OP!

cheers,

Rolf Turner

>
> On Wed, Jan 8, 2014 at 8:55 PM, Aurélien Philippot
> <aurelien.philippot at gmail.com> wrote:
>> Dear R experts,
>>
>> I want to use numerical methods to solve a complex problem. Here is a very
>> simple example that gives an idea of what I would like to do. This example
>> could be solved by hand, but I am  interested in finding a numerical
>> solution in R.
>>
>> Let's say that I have the following equation:
>>
>> Maxx (-2x^2+ Cx)=1
>>
>> I want to numerically solve for C. Of course I could use the first order
>> condition with respect to x on the left hand side, and find the value of x
>> that maximizes  the function x-> -2x^2+ Cx, (as a function of C), and then
>> solve for C.
>>
>> But, let's assume that my left hand side is much more complex and I want to
>> avoid using the first order condition. So, I would need to use some
>> numerical techniques directly.
>>
>> Is there a procedure that could be implemented in R?
>>
>> Thank you very much for any suggestion!

```