Re: [R] Intercept between two lines

2012-04-26 Thread ghostwheel
You could also use polyroot. Do x0=Re( polyroot( c(100,-0.5) - c(150,-1) ) ) In your code. -- View this message in context: http://r.789695.n4.nabble.com/Intercept-between-two-lines-tp4587343p4589349.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Intercept between two lines

2012-04-26 Thread pannigh
Thank you Jorge, this did get me started and who else might be interested in the topic, a possible code could be something like: # Define the functions f1 - function(x) 100-0.5*x f2 - function(x) 150- x # Plot the functions par (xaxs=i, yaxs=i) plot( 1,

[R] Intercept between two lines

2012-04-25 Thread pannigh
Dear List, I know this is not the first post on this topic, but I need basic help I guess. Assuming the simple case of two lines with one intercept, how can I make R calculate this intercept, NOT using locator(). par (xaxs=i, yaxs=i) plot( 1, bty=n ,xlim=c(0,300) , ylim=c(0,300) , xlab=X, ylab=Y)

Re: [R] Intercept between two lines

2012-04-25 Thread Jorge I Velez
Hi pannigh, The following might get you started: x0 - uniroot(function(x) 100-0.5*x - (150- x), c(0, 150))$root x0 [1] 100 100- 0.5*x0 [1] 50 HTH, Jorge.- On Wed, Apr 25, 2012 at 1:01 PM, pannigh wrote: Dear List, I know this is not the first post on this topic, but I need basic help I