- #1
shfreeman
- 2
- 0
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!
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!