# How to represent a function properly?

Posted 8 years ago
7923 Views
|
|
0 Total Likes
|
 Say [x,y,z] and [r,?,z] represents Cartesian and Cylindrical co-ordinate system. Hence x & y both are functions of (r,?). Let p is function of (x, z) only and D[p, y] = 0. How should I represent them in sequence? If I writep = Function[{x, z}]thenD[p, x] and D[p, z] give results '{1, 0} &' and '{0, 1} &'But if I write like followingx = Function[?]p = Function[{x, z}]then though D[p, z] gives output '{0, 1} &', but D[p, x] and D[p, ?] gives output '{0, 0} &' and '{0, 0} &'Please explain me.During the solution of a hydrodynamic journal bearing problem following Reynold's approach all coefficients, intermediate expressions and final expressions of velocity components along x- and z-directions absolutely match with my manual derivation. However, D[Vx, y] is returning an extra term associated to '({0, 0} &)', which I suspect to be associated with D[(D[p, x]), y]. Why does it remain when p is not a function of y? How do I eliminate that term?
 I'm not sure if this helps but if you are set in using pure functions (ie Function[vars,body]) then perhaps this would help: p=Function[{x,z},f[x,z]] and D[p[x,z],x], D[p[x,z],z] should return the appropriate derivatives of the body (ie the formula) of your function (the f[x,z] part)Also, defining x=Function[theta,g[theta]] and calling D[p[x[theta],z],theta] and D[p[x[theta],z],x[theta]] should work as expected.I don't know what you want to achieve but (in my experience) perhaps you'd be better off by defining your functions using setdelayed (:=) as in f[x_]:=Module[{local vars}, body[x]] when using D[]