From ihaka@stat.auckland.ac.nz  Tue Apr 15 21:16:23 1997
From: ihaka@stat.auckland.ac.nz (Ross Ihaka)
Date: Wed, 16 Apr 1997 08:16:23 +1200 (NZST)
Subject: R-alpha: D()
Message-ID: <199704152016.IAA24269@stat1.stat.auckland.ac.nz>

	R> D(expression(z * (log(z) /z)),"z")
	Error: invalid form in unary minus check

Yep. this is the result of an implete "if" statement in the C function
"isUminus" in deriv.c.  The function should read

static int isUminus(SEXP s)
{
	if(TYPEOF(s) == LANGSXP && CAR(s) == MinusSymbol) {
		switch(length(s)) { 
		case 2:
			return 1;
		case 3:
			if(CADDR(s) == R_MissingArg)
				return 1;
			else return 0;
		default:
			error("invalid form in unary minus check\n");
		}
	}
	else return 0;
}

This now gives

	> D(expression(z * (log(z) /z)),"z")
	(log(z)/z) + z * (1/z/z - log(z)/z^2)

which I thought was pretty ugly, but

	S-PLUS : Copyright (c) 1988, 1996 MathSoft, Inc.
	S : Copyright AT&T.
	Version 3.4 Release 1 for Sun SPARC, SunOS 4.1.3_U1 : 1996
	Working data will be in .Data
	> D(expression(z * (log(z) /z)),"z")
	(log(z)/z) + z * (1/z/z - log(z)/z^2)

So we are no worse than S.

And shame on you for trying to fool such a dumb bit of software :-).
	Ross
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


R-alpha: D()
Ross Ihaka