Re: Subvalues and Parameters in Differentiation and Usage Messages
- To: mathgroup at smc.vnet.net
- Subject: [mg67811] Re: Subvalues and Parameters in Differentiation and Usage Messages
- From: David Bailey <dave at Remove_Thisdbailey.co.uk>
- Date: Sat, 8 Jul 2006 04:56:39 -0400 (EDT)
- References: <e8lgij$r93$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
David Park wrote: > Hi James, > > It is very useful to be able to place parameters as subvalues. One often > doesn't want to differentiate with respect to the parameters. A person who > uses A LOT of that is Alfred Gray in his 'Modern Differential Geometry of > Curves and Surfaces with Mathematica'. For example he parametrizes a > circular hyperboloid of two sheets as... > > hy2sheet[a_, c_][u_, v_] := {a Cosh[u]Cosh[v], a Sinh[u]Cosh[v], c Sinh[v]} > > so if I used command completion on this (and I find command completion > extremely useful; it is what complements and makes practical the use of long > descriptive names that also seems to be a Mathematica style) I want to see > the complete command and not have the [u,v] part chopped off. > > Furthermore everything works very well if we, for example, use an undefined > function f, differentiate and then afterwards substitute the actual function > as in... > > D[f[a, c][u, v], u] > % /. f -> hy2sheet > giving > Derivative[1, 0][f[a, c]][u, v] > {a Cosh[v] Sinh[u], a Cosh[u] Cosh[v], 0} > > So having subvalues in a head of a functions is perfectly acceptable in > Mathematica. > > I am still looking for an answer as to the results of the following > statement. > > D[foo[x][x], x] > foo[x]'[x] + foo'[x][x] > > What is the mathematical justification of the second term? I don't think > that differentiation should act on the heads of expressions and am still > looking for a reason why it should. I don't see how the above will ever be a > useful answer and, in turn, it forecloses many useful constructions. But > there may be something I am missing. > > In many cases the subvalue x is only an identifier. For example, we might > have a function, undefined at the moment, with x and y components, > f[x][x,y] and f[y][x,y]. It seems to me that it makes sense to have > differentiation work on the values in the last square brackets, but not to > touch subvalues in the head. I might want to differentiate these, say as > part of didactic exposition, and only later substitute the actual functions > for > f[x] and f[y]. > > So I'm not content with 'don't use subvalues' and am still looking for an > explanation. Either the Mathematica result is useful in an important class > of cases or the behavior should be changed. > > David Park > djmp at earthlink.net > http://home.earthlink.net/~djmp/ > > > > From: James Gilmore [mailto:james.gilmore at yale.edu] To: mathgroup at smc.vnet.net > > Hi David, > > With regard to your command completion comment, at least from my > perspective, separating parameters from variables, although useful in > some instances, does not seem to be in the spirit of the standardized > Mathematica functional language of the kernel. Anyone please correct me if > I'm wrong, but I don't know of a Kernel function with that syntax > f[n][x], they are all: f[n,x]. So I think we should at least try to > follow the WRI lead and maintain the standardized notation for our function. > > As for the derivatives, writing the arguments in the standardized > notation removes any ambiguity. > In[39]:= > D[foo[p, x], x] > Out[39]= > Derivative[0, 1][foo][p, x] > > In[40]:= > D[foo[x, x], x] > Out[40]= > Derivative[0, 1][foo][x, x] + Derivative[1, 0][foo][x, x] > > Also, what exactly does the subscript x represent in D[Subscript[f, > x][x], x]? Is it the x component of a function? If so a "x" string > removes any ambiguity yet still looks the same. > In[45]:= > D[Subscript[f, "x"][x], x] > Out[45]= > Derivative[1][Subscript[f, "x"]][x] > > Cheers > > James Gilmore > > Why not define your own differentiation - say DD - that behaves in the way you want and uses D internally to do part of the work. In that way you can make DD operate on particular types of expression in whatever way you find useful. This trick can be useful in a variety of situations where you want to adjust the behaviour of the standard D. David Bailey http://www.dbaileyconsultancy.co.uk