Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica: A function that derives another function on all its arguments

  1. Mar 18, 2012 #1
    Hi!

    I am wondering if someone could help me write a function in Mathematica. What I would like it to do is take another function g
    as its argument and return the sum of g derived to all of its arguments (and multiplied by a scalar Δxi)

    [tex] f\left[g\left[x_1,x_2,\text{...},x_n\right]\right] = \sqrt{\overset{n}{\sum _{i=1} }\left(\frac{\partial g}{\partial x_i}\text{$\Delta $x}_i\right){}^2} [/tex]

    I have already managed to make such a function by brute force,
    but it brakes down if I assign a value to any character (a,b,c,d,...). This is what I came up with:

    [tex] \text{symbols}=\{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,\text{Ee},F,G,H,\text{Ii},J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,\alpha ,\beta ,\gamma ,\delta ,\varepsilon ,\zeta ,\eta ,\theta ,\iota ,\kappa ,\lambda ,\mu ,\nu ,\xi ,o,\rho ,\varsigma ,\sigma ,\tau ,\upsilon ,\varphi ,\chi ,\psi ,\omega \}; [/tex]
    [tex] \text{abs}[\text{f$\_$}]\text{:=} \surd \text{Sum}\left[(D[f,\text{symbols}[[\aleph ]]]*\text{Symbol}[\Delta <>\text{ToString}[\text{symbols}[[\aleph ]]]])^2,\{\aleph ,\text{Length}[\text{symbols}]\}\right. [/tex]

    I hope someone can help me come up with a better solution.

    Thanks!
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted