Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I've entered the following functions into my notebook, but the solution to them contains #1's that I can't seem to make any sense of. The functions are:

z := R[r, t]
P := D[R[r, t], t]
eqn := P^2 - (2 x[r])/z - 2 y[r] == 0 
sol = DSolve[eqn, z, t]

and the solution returns the following:

 {R[r, t] -> 
  InverseFunction[-((Log[Sqrt[#1] y[r] + Sqrt[y[r]] Sqrt[x[r] + #1 y[r]]] x[r])/
    y[r]^(3/2)) + (Sqrt[#1] Sqrt[x[r] + #1 y[r]])/y[r] &][-Sqrt[2]t + C[1]]}, 
 {R[r, t] -> 
  InverseFunction[-((Log[Sqrt[#1] y[r] + Sqrt[y[r]] Sqrt[x[r] + #1 y[r]]] x[r])/
    y[r]^(3/2)) + (Sqrt[#1] Sqrt[x[r] + #1 y[r]])/y[r] &][Sqrt[2] t + C[1]]}

Any thoughts on the matter?

share|improve this question
I hate to ask this, but have you looked up InverseFunction in the documentation? What about #? –  rcollyer Dec 21 '12 at 15:38
Yes, I've looked up both. The # function appears to be a placeholder, whereas the InverseFunction simply implies that you the function inside the square brackets after InverseFunction should be inversed i.e. InverseFunction[f^-1(x)]=f(x) –  Gokotai Dec 21 '12 at 15:42
Yes, it is a placeholder, and if you dig a bit deeper you'll see it is a parameter in a pure function. Then we are left with the construct: InverseFunction[pureFunction][Sqrt[2] t + C[1]]. Any thoughts on what it is doing? Hint: what does InverseFunction[pureFunction] return? –  rcollyer Dec 21 '12 at 15:48
I'm not trying to be mean here. I'm just trying to lead you along in your thinking. The key is in how to think of constructs like f[a][b]. It is possible to define such things directly, but more simply they should be thought of as (f[a])[b]. So, f[a] returns something which b is then passed to. If f = 5, you'd get 5[b] which is nonsensical, but if you could return a function ... –  rcollyer Dec 21 '12 at 16:22

1 Answer 1


InverseFunction[f] yields a function that, given an argument y, gives a result x for which y==f[x] holds. That is to say:

f[x_] = x + x^2;
g = InverseFunction[f];





Take care here because, as always with inverse functions, it's not necessarily the case that $f^{-1}(f(x))=x$. Here, f maps both 2 and -3 to 6, but the inverse can take you back to only one value. Mathematica choose to map back to 3 in this case (and throws a warning message).

Pure functions

A pure function is specified in Mathematica using a Slot (#) and & syntax.


In this example is a function with one argument. It squares its argument and adds 1. It can be used directly on an argument like so:

#^2 + 1 &[2]


or by first assigning it to a function name and then applying it to an argument:

h = #^2 + 1 &;


Instead of plain Slot you can also use multiple arguments that are numbered like #1, #2, #3 etc.

m = #1/Cosh[#2] &;
m[5, 3]

5 Sech[3]

Pure functions can have inverses defined in the same way as above.

InverseFunction[#^2 &][2]

During evaluation of In[46]:= InverseFunction::ifun: Inverse functions are being used. Values may be lost for multivalued inverses. >>


The rather complex InverseFunction in the question

If we study the InverseFunction in the question:

InverseFunction[-((Log[Sqrt[#1] y[r] + Sqrt[y[r]] Sqrt[x[r] + #1 y[r]]] x[r])/
y[r]^(3/2)) + (Sqrt[#1] Sqrt[x[r] + #1 y[r]])/y[r] &][-Sqrt[2]t + C[1]]

You can see that it can be written as follows:

p = -((Log[Sqrt[#1] y[r] + Sqrt[y[r]] Sqrt[x[r] + #1 y[r]]] x[r])/
y[r]^(3/2)) + (Sqrt[#1] Sqrt[x[r] + #1 y[r]])/y[r] &;
q = -Sqrt[2]t + C[1]

p is admittedly a baroque beast, but it's just a pure function like the simple #^2 + 1 & above. It is a function of one argument (I only see #1's).

And with


the rule outputs of your DSolve are just


The inverse function acting on the argument q, where C[1] is an unspecified constant that is part of the solution because no initial or boundary condition was given.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.