Message Boards Message Boards

1 Reply
0 Total Likes
View groups...
Share this post:

How to represent a function properly?

Posted 9 years ago

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 write

p = Function[{x, z}]


D[p, x] and D[p, z] give results '{1, 0} &' and '{0, 1} &'

But if I write like following

x = 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?

POSTED BY: Sanjoy Das
Posted 9 years ago

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:


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[]

POSTED BY: nik tsak
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract