Re: [R] Plotting one dot in a graph

2010-08-12 Thread David Winsemius
OK, looks sensible, although I said either abs() OR squared differences. I don't think it makes sense to use both the L1 and the L2 metric at the same time. -- David. On Aug 12, 2010, at 4:58 PM, TGS wrote: # just to clean it up for my own understanding, the "difference" approach as you ha

Re: [R] Plotting one dot in a graph

2010-08-12 Thread TGS
# just to clean it up for my own understanding, the "difference" approach as you had suggested would be x <- seq(.2, .3, by = .1) f1 <- function(x){ x*cos(x)-2*x**2+3*x-1 } plot(x,f1(x), type = "l") abline(h = -.1) abline(v = x[which.min(abs(diff((f1(x) - (-.1))**2)))], lty = 'dotted'

Re: [R] Plotting one dot in a graph

2010-08-12 Thread TGS
I was meaning something like the following: 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 = -.1) But I'm guessing "uniroot" will do this?---I haven't looked far into the uniroot function to see if it will solve this. On Aug 12, 20

Re: [R] Plotting one dot in a graph

2010-08-12 Thread David Winsemius
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

Re: [R] Plotting one dot in a graph

2010-08-12 Thread TGS
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

Re: [R] Plotting one dot in a graph

2010-08-12 Thread TGS
Yes, I'm playing around with other things but the "points()" function is what I was looking for. Thanks 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,

[R] Plotting one dot in a graph

2010-08-12 Thread TGS
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) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailm