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!

                                cheers,

                                        Rolf Turner
                                        [EMAIL PROTECTED]

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

Reply via email to