Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Help with changing variables' topicStudent Support Forum > General > "Help with changing variables"

< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic
Author Comment/Response
Bill Simpson
08/28/12 5:04pm

Is this what you are trying to do?

In[1]:= exp1[r_]:=D[b[r],r]+D[n[r],r]

In[2]:= exp1[r]/.{f_[r_]->Function[r,f[1/r]],r->1/x}

Out[2]= Function[r,b′[1/r]]+Function[r,n′[1/r]]

In Mathematica, pattern matching an _ will match absolutely anything at all and pattern matching f_ will match absolutely anything at all (and name it f for you to use in the rest of the expression) so f_ is probably too general. Pattern matching f_[r_] will match any function, call it f, and match the argument of the function and call that r. That appears to be closer to what you want to do but I cannot be certain.

URL: ,

Subject (listing for 'Help with changing variables')
Author Date Posted
Help with changing variables Adam 08/27/12 10:22pm
Re: Help with changing variables Bill Simpson 08/28/12 5:04pm
Re: Re: Help with changing variables Adam 08/30/12 12:32pm
< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic