Re: [R] Problem with 'expression'

About this list Date view Thread view Subject view Author view Attachment view

From: Tamas Papp (tpapp@axelero.hu)
Date: Wed 12 May 2004 - 01:13:24 EST


Message-id: <20040511151324.GA2923@localhost>

On Tue, May 11, 2004 at 04:31:21PM +0200, Perez Martin, Agustin wrote:

> For example:
>
> a<-expression(exp(-x^2))
> b<-expression(exp(x^2))
>
> And I want to calculate:
>
> a*b

Use

t<-2
expression(a, list(x=t))*expression(b, list(x=t))

I am not sure what you are using these for, but maybe you could also
use functions --- more convenient for calculations. Eg

a <- function(x) { exp(-x^2) }
b <- function(x) { exp(x^2) }
a(x)*b(x) # =1

For evaluating the same functions many times, see ?sapply and the
related pages.

Best,

Tamas

-- 
Tamás K. Papp
E-mail: tpapp@axelero.hu
Please try to send only (latin-2) plain text, not HTML or other garbage.

______________________________________________ R-help@stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Mon 31 May 2004 - 23:05:09 EST