Re: [R] Adding "sum" to derivatives table

From: Rolf Turner <>
Date: Fri 05 Aug 2005 - 05:13:53 EST

Martin C. Martin wrote:

> Rolf Turner wrote:
> >> deriv(expression(sum(x)), "x")
> >>
> >>
> >
> > does not make any sense.
> >
> >
> Good point. But this does:
> deriv(expression(sum(log(a*x))), "a")
> where a is a scalar.

        Okay --- I see what you're getting at now.

	But I think that to get deriv() to handle expressions
	of that sort, i.e for

		 deriv(expression(sum(log(a*x))), "a")

	not to fall over, requires more than ``putting sum in the
	derivatives table''.  The problem is that ``sum'' is not the
	``right sort of function''.  Functions that appear in the
	derivatives table are (I think --- I am not knowledgable
	about this) functions of a single variable, like sin and cos
	and log, u.s.w.  Whereas sum is a function of arbitrarily
	many variables.

	What is needed is for deriv() to know the rule that ``the
	derivative of a sum is the sum of the derivatives''.  This
	would require rewriting the code of deriv().  Whether the
	required rule could be built into deriv() safely and sensibly
	is not clear to me.  It might be do-able; I wouldn't want to
	try it, but!


					Rolf Turner

______________________________________________ mailing list PLEASE do read the posting guide! Received on Fri Aug 05 05:19:39 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 15:04:48 EST