[6231] in s-news-athena

home help back first fref pref prev next nref lref last post

Integration and Algebra in S

daemon@ATHENA.MIT.EDU (Mark A. Carey)
Fri Jan 20 14:40:27 1995

Date: Fri, 20 Jan 95 14:05:58 -0500
From: Mark A. Carey <carey@Warp.dmed.iupui.edu>
To: s-news@utstat.toronto.edu

Hi all,

	I've been attempting to write a function which will multiply several
equations together and then integrate them.  Take as a simple example the
following equation:

y = c*x^2 + d*x

I wish to pass different values of c and d to the function, multiply them
together and finally integrate it.  S won't accept the following:

x <- function(c,d) {c*x^2 + d*x}

if I try: integral(x(3,2),lower=0,upper=10) I get
Error in x^2: Non-numeric first operand

So, I suppose step 1 is, how can I specify the above so S can understand
it and step 2, how can I then obtain the product which I wish to integrate?

Thanks


home help back first fref pref prev next nref lref last post