The expressions I am working with are much too complicated to fully enter here, but I’ve included a simple examples that highlights the problem I am running into. I am hoping there is someone out there with enough programming fortitude to help me around this issue. Let me preface this by saying I have little to no background in programming in general, but I know the basics of Mathematica. Any and all help is greatly appreciated. Suppose I have set up the following functions:
X[x_] := x Log[x]
X[0] := 0
Y[y_] := y Log[y]
Y[0] := 0
Z[z_] := z Log[z]
A[x_, y_, z_] := X[x] + Y[y] + Z[z]
In[7]:= A[x, y, z]
Out[7]= x Log[x] + y Log[y] + z Log[z]
In[8]:= B[x_, y_, z_] :=
Evaluate[A[x, y, z] - x*D[A[x, y, z], x] - y*D[A[x, y, z], y] -
z*D[A[x, y, z], z]]
In[9]:= B[x, y, z]
Out[9]= x Log[x] - x (1 + Log[x]) + y Log[y] - y (1 + Log[y]) +
z Log[z] - z (1 + Log[z])
I have set up A[x,y,z] with the rules for X[x], Y[y], and Z[z] so that it can handle the case where x,y,z == 0, i.e. when x == 0 I want all expressions in A[x,y,z] with x to go to zero or be neglected including Log[x]. I’ve defined a function B[x,y,z] that involves the partial derivatives of A[x,y,z]. Now, I want the result so that B[0,y,z] yields
yLog[y]-y(1+Log[y])+zLog[z]-z(1+Log[z])
that is to basically go back and make A[x,y,z]:= Y[y]+Z[z] but instead I am currently running into the following, understandable, error:
Infinity::indet: Indeterminate expression 0 (-[Infinity]) encountered. >>
There must be some way around this with Mathematica and I am wondering if it will involve the Hold function or something related. Thank you all for the help.
One way is to use dummy variables in the derivatives, and replace afterward with the actual values.
This works because each derivative has a factor of 0. A more general solution might involve defining
UpValuesonX, Y, Zfor handling derivatives at the origin (I don’t have time to check this at the moment).