Re: Get list of function variables?
- To: mathgroup at smc.vnet.net
- Subject: [mg84082] Re: Get list of function variables?
- From: David Bailey <dave at Remove_Thisdbailey.co.uk>
- Date: Mon, 10 Dec 2007 04:29:56 -0500 (EST)
- References: <email@example.com> <firstname.lastname@example.org> <email@example.com>
Jason Quinn wrote: > On Nov 21, 6:09 am, Szabolcs <szhor... at gmail.com> wrote: >> It seems that you were not convinced by the previous posts that the >> original question does not really make sense in Mathematica (because >> there are no "function variables", or "functions", only patterns and >> transformation rules, and the pattern names don't carry any >> information by themselves). So here is an example of a mathematical >> function, implemented in Mathematica, on which getVariables does not >> work: >> >> factorial = 1 >> factorial[n_] := n factorial[n-1] >> >> May I ask what you intend to use getVariables for? > > I am aware that the "solutions" I posted do not hold in general. My > basic desire for the getVariables function was to help generate a new > function with those variables (and another set of the same size). I > wanted a notebook that could give the the error function for ANY > function the user inputed without having to do any work. Maybe there's > a better way than how I did it (but I have a working notebook so I'm > better off than I was). > > In other words give some function, say, the price to carpet an "x" by > "y" by "z" room at "w" per square unit area: > f(w,x,y,z)=w(x*y*z) > I want the sigma error on f given sigma errors on the variables. So a > new function "ef" > ef(x,y,z,ex,ey,ez) > where ef is defined by the usual error propagation equation a sum over > partial derivatives squared. The "e" prefix denotes the sigma error on > the corresponding variable. Note the new function recognizes w as a > parameter. > > If I went about this in some ass-backwards fashion by grabbing the > variables from f directly, I'm a little bit embarrassed but would be > interested in knowing a better way. > > Jason > > > > > > > > > I don't really know what you want your getVariables function for, but if you type the name of a built-in function - say Plot - and then press Ctrl-Shift-K (under Windows), you get some help with the arguments. This also seems to work with user-defined functions if they have a suitable usage statement. David Bailey http://www.dbaileyconsultancy.co.uk