[R] intersection points of two functions

Liaw, Andy andy_liaw at merck.com
Mon Feb 23 23:58:06 CET 2004


If both functions are univariate, you can define the difference between the
two as the objective function and use uniroot() to find the intersection
(where the difference is 0).  If the functions are multivariate, you can use
optim() to minimize the squared or absolute difference between the two
functions, instead of uniroot().

HTH,
Andy

> From: Rajarshi Guha
> 
> Hi,
>   I have two functions (which are basically fouriers series) 
> and I would
> like to find the points of intersection (in general there will be more
> than one). Is there any function in R which would allow me to 
> solve the
> equations? Or should I be looking at packages like octave/mathematica?
> 
> Thanks,
> 
> -------------------------------------------------------------------
> Rajarshi Guha <rxg218 at psu.edu> <http://jijo.cjb.net>
> GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
> -------------------------------------------------------------------
> A bug in the code is worth two in the documentation.
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
> 


------------------------------------------------------------------------------
Notice:  This e-mail message, together with any attachments,...{{dropped}}




More information about the R-help mailing list