Re: Simple Differentiation?
- To: mathgroup at smc.vnet.net
- Subject: [mg46073] Re: [mg46014] Simple Differentiation?
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Thu, 5 Feb 2004 04:02:52 -0500 (EST)
- References: <200402021021.FAA29647@smc.vnet.net> <37C33814-5582-11D8-A5A7-00039311C1CC@mimuw.edu.pl>
- Sender: owner-wri-mathgroup at wolfram.com
On 2 Feb 2004, at 14:17, Andrzej Kozlowski wrote: > On 2 Feb 2004, at 11:21, Sunil Pinnamaneni wrote: > >> In Mathematica 5.0, if one types in: >> >> f[x_]+g[x_]^:=1 (1) >> >> and then types >> >> dx(f[x]+g[x]) >> >> we get 0. >> >> However, if we type dx(f[x]) + dx(g[x]) after typing (1), we get >> >> f'[x] + g'[x]. >> >> Mathematica doesn't recognize that f'[x]+g'[x]= >> dx(f[x]+g[x]), which equals 0. How does one get Mathematica to do >> this? >> >> I'm interested in more complicated examples, which involve more >> complex >> differential relations, but I should be able to do things in those >> situations given a nice, natural way of handling this toy case. >> Though this >> seems like a pretty simple thing, I wasn't able to find any thing in >> the >> Mathematica Book or elsewhere, which would help with this type of >> things. >> >> Thanks, >> Sunil >> > Mathematica generally performs only syntactic pattern matching what > this means is that your defintion > >> f[x_]+g[x_]^:=1 > > means that only things of the form > > f[x]+g[x] > > are to be set equal to 1 but it will not perform any transformations > that might follow from this semantically but not syntactically, e.g. > > f[x]+g[x] > > 1 > > but for example: > > > -f[x]-g[x] > > -f[x]-g[x] > > That's all you can expect form pattern matching. The same applies to > your example. > This does not mean that one can't at all hope to do do what want, but > it will take some work and will probably only work reasonably well > with polynomial expressions. You could start with something like this. > Define a function, say, F[expr,{x,y}] which computes the values of > various expressions assuming that f[x]+g[y]==1 and > D[f[x],x]+D[g[y],y]==0. (You will have to add conditions for sums of > derivatives separately). > > Here is the definition of F: > > F[expr_, {x_, y_}] := Last[PolynomialReduce[ > expr, {1 - f[x] - g[x], D[1 - f[x] - g[x], x]}]] > > Now we get: > > In[2]:= > F[g[x]+f[x],{x,y}] > > Out[2]= > 1 > > In[3]:= > F[-g[x]-f[x],{x,y}] > > Out[3]= > -1 > > In[4]:= > F[f[x]^2 + 2*f[x]*g[x] + g[x]^2, {x, y}] > > Out[4]= > 1 > > In[5]:= > F[D[f[x],x]+D[g[x],x],{x,y}] > > Out[5]= > 0 > > which seems to me not a bad start. > > Andrzej Kozlowski >
- References:
- Simple Differentiation?
- From: "Sunil Pinnamaneni" <pinnama@cims.nyu.edu>
- Simple Differentiation?