RE: Subvalues and Parameters in Differentiation and Usage Messages
- To: mathgroup at smc.vnet.net
- Subject: [mg67788] RE: Subvalues and Parameters in Differentiation and Usage Messages
- From: James Gilmore <james.gilmore at yale.edu>
- Date: Fri, 7 Jul 2006 07:13:36 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi David, Comments below. All the best James Gilmore --------------------------- At 09:27 PM 7/6/2006, you wrote: >Hi James, > >It is very useful to be able to place parameters as subvalues. I already mentioned it was useful to use subvalues in my initial reply. I do find it useful, but I stick with the kernel standardization where possible. >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. I do understand your point here. You would like the entire syntax of non-kernel function to appear. While we are on command completion, who else would find it useful to get the entire syntax of a function with say, Crtl+Shft+K+L? For example when I type: Integr then press Crtl+Shft+K, I obtain, of course: Integrate[f, x] Would it not be nice if I could press Crtl+Shft+K+L, where the "L" stands for "Long syntax", and "L" is right next to the "K" so it is quite convenient, or some other key combo, so I get the next syntax listed in ??Integrate, which happens to be: Integrate[f, {x, xmin, xmax}] Then I do not have to type the extra syntax. This would be _extremely_ useful for the more advanced user, when you know exactly what syntax you want. >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 agree, the actual result of D[foo[x][x],x] does not make much sense. The result seems related to the product rule? But in these situations one should not rely on Mathematica to do all the thinking. Clearly a function like foo[x][x] is equivalent to foox[x]=foo[x][x], as similarly fx[x]=foo[x,x], and should be written in this manner, so it is clearly a function of one argument. Perhaps an error message should be implemented in these situations, i.e. foo[x][x], to warn the user? >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]. If [x], [y] are identifiers then they can easily be given a different name, and all these issues can be avoided. Why not use f[1][x,y] and f[2][x,y], for clarity or f["x"][x,y] as I suggested earlier? It is still easy to implement a transformation rule with either notation. In[19]:= D[f[1][x, y], x] Out[19]= Derivative[1, 0][f[1]][x, y] rather than: In[20]:= D[f[x][x, y], x] Out[20]= Derivative[1, 0][f[x]][x, y] + Derivative[1][f][x][x, 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