G'day George,

On Wed, 29 Oct 2008 06:21:37 +0200
KARAVASILIS GEORGE <[EMAIL PROTECTED]> wrote:

> Hello, R subscribers.
> I would like to define a function like this one:
> Fun <- function(x)    sin(x)/x
> with value 1 at x=0. How can I do that?

Fun <- function(x) ifelse(x==0, 1, sin(x)/x)

> Is there a way to plot it "symbolically", without using x as a vector?
> e.g.
> x <- seq(from=-10, to=10, length=100)
> plot(x, Fun(x))

curve(Fun, from=-10, to=10, n=100)

HTH.

Cheers,

        Berwin

=========================== Full address =============================
Berwin A Turlach                            Tel.: +65 6516 4416 (secr)
Dept of Statistics and Applied Probability        +65 6516 6650 (self)
Faculty of Science                          FAX : +65 6872 3919       
National University of Singapore     
6 Science Drive 2, Blk S16, Level 7          e-mail: [EMAIL PROTECTED]
Singapore 117546                    http://www.stat.nus.edu.sg/~statba

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to