Re: Get list of function variables?
- To: mathgroup at smc.vnet.net
- Subject: [mg83534] Re: Get list of function variables?
- From: Jason Quinn <jason.lee.quinn at gmail.com>
- Date: Thu, 22 Nov 2007 04:51:12 -0500 (EST)
- References: <firstname.lastname@example.org> <email@example.com>
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