[R] Graph f(x) = 1/x

AbouEl-Makarim Aboueissa abouelmakarim1962 at gmail.com
Tue Sep 19 10:09:20 CEST 2017

Dear All: good morning

I am trying to graph the function y=f(x)=1/x over the interval (-5,5). But
I am getting an error message. Please see below.

I am getting the error message: *Error in xy.coords(x, y, xlabel, ylabel,
log) : *
*  'x' and 'y' lengths differ*


x <- seq(-5, 5, 0.01)
y < 1/x

plot(x,y, type='l', xlim=c(-5, 5), ylim=c(-5, 5), xlab = "x", ylab = "f(x)
= 1/x", lwd = 2, col ="red")

abline(h=0, lty=2, col = "blue")
abline(v=0, lty=2, col = "blue")
title(main="The Graph of f(x) = 1/x")

any help will be highly appreciated.

with thanks
AbouEl-Makarim Aboueissa, PhD
Professor of Statistics
Department of Mathematics and Statistics
University of Southern Maine

	[[alternative HTML version deleted]]

More information about the R-help mailing list