[R] Plotting one dot in a graph

David Winsemius dwinsemius at comcast.net
Thu Aug 12 22:00:56 CEST 2010


On Aug 12, 2010, at 3:54 PM, TGS wrote:

> Actually I spoke too soon David.
>
> I'm looking for a function that will either tell me which point is  
> the intersection so that I'd be able to plot a point there.
>
> Or, if I have to solve for the roots in the ways which were  
> demonstrated yesterday, then would I be able to specify what the  
> horizontal line is, for instance in the case where y (is-not) 0?

Isn't the abline h=0 represented mathematically by the equation y=0  
and therefore you are solving just for the zeros of "f" (whaich are  
the same as for (f-0)? If it were something more interesting, like  
solving the intersection of two polynomials, you would be solving for  
the  zeros of the difference of the equations. Or maybe I have not  
understood what you were requesting?


>
> On Aug 12, 2010, at 12:47 PM, David Winsemius wrote:
>
>
> On Aug 12, 2010, at 3:43 PM, TGS wrote:
>
>> I'd like to plot a point at the intersection of these two curves.  
>> Thanks
>>
>> x <- seq(.2, .3, by = .01)
>> f <- function(x){
>> 	x*cos(x)-2*x**2+3*x-1
>> }
>>
>> plot(x,f(x), type = "l")
>> abline(h = 0)
>
> Would this just be the uniroot strategy applied to "f"? You then  
> plot the x and y values with points()
>

>

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list