[Rcpp-devel] Root finder in Rcpp for a quadratic equation in two variables

Dirk Eddelbuettel edd at debian.org
Wed Feb 1 23:28:24 CET 2017

On 1 February 2017 at 16:49, Scida, Daniela wrote:
| I am new to Rcpp so I apologize in advance if this question is simple to
| answer. I searched on the web but couldn't find much help and I am hoping the
| savviness in this forum can help me!
| I have an existing code in R using Rcpp, and I need to add to this code the
| following. I have a quadratic function in two variables, f(x, y), and I need to
| find the zeros or roots of it:
| f(x, y) = (x + by + c)' W (x + by + c)
| where the unknowns are x and y. That is, I am interested in finding the set of
| pairs (x, y) that satisfy f(x , y)=0. 
| Note: This is a simulation exercise where I need to find the zeros of this
| function for different values of a, b, c and W. Therefore, I need to code this
| in a mechanical way (cannot just find the solution, for instance, by graphical
| inspection). Both variables are continue, and I don't want to work with a grid
| for (x,y) to see when f(x,y)=0. I need a more general solution. I don't really
| know what values (x,y) can take.

You asked _the same question_ on StackOverflow and where given an answer. So
you have an open question over there.

Now you crosspost here again.  Why?

You still "just" need to find the appropriate numerical minimization, or
root-finding routine, and use Rcpp for what it is for:  to _easily_ create
interface from R to such external code.


http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org

More information about the Rcpp-devel mailing list