This is probably a trivial question. But I could not find an answer.

Given the explicit expression for ft in te assignment

ft = InverseFunction[f[#] &][t];

I would like to invert this, i.e. to get the function t[f[x]]. Of course I can copy the expression f[#]& and paste it into the right hand side of the assignment

t[x_] = f[#]& [x];

But I think there should be a valid Mathematica method to do the extraction.

The FullForm[] of ft shows a presumed List[] which, however, is a strange contruct which only lets me extract the argument t as its first element.

Example (I write it in Latex just to save space)

$ft = \text{InverseFunction}\left[-\frac{i \sqrt{\frac{2 \text{$\#$1}^2}{\sqrt{4 w+1}-1}+1} \sqrt{1-\frac{2 \text{$\#$1}^2}{\sqrt{4 w+1}+1}} F\left(i \sinh ^{-1}\left(\sqrt{2} \sqrt{\frac{1}{\sqrt{4 w+1}-1}} \text{$\#$1}\right)|\frac{1-\sqrt{4 w+1}}{\sqrt{4 w+1}+1}\right)}{2 \sqrt{\frac{1}{\sqrt{4 w+1}-1}} \sqrt{-\text{$\#$1}^4+\text{$\#$1}^2+w}}\&\right][t]$

I wish to extract the expression in square brackets.

Taking the compact solution 2 from the answer of xzczd we find

tx = ft[[0, 1]][x]

$-\frac{i \sqrt{\frac{2 x^2}{\sqrt{4 w+1}-1}+1} \sqrt{1-\frac{2 x^2}{\sqrt{4 w+1}+1}} F\left(i \sinh ^{-1}\left(\sqrt{2} \sqrt{\frac{1}{\sqrt{4 w+1}-1}} x\right)|\frac{1-\sqrt{4 w+1}}{\sqrt{4 w+1}+1}\right)}{2 \sqrt{\frac{1}{\sqrt{4 w+1}-1}} \sqrt{w-x^4+x^2}}$

  • $\begingroup$ Do you mean something like: t = InverseFunction@Head@ft, or t = InverseFunction@Function[t, #] &@ft, or t = ft[[0, 1]]? $\endgroup$ – xzczd Nov 17 '15 at 11:21
  • $\begingroup$ Have you noticed what happens when you do InverseFunction[InverseFunction[f]]? $\endgroup$ – J. M.'s ennui Nov 17 '15 at 12:07
  • $\begingroup$ Well, actually your @name syntax is wrong, there shouldn't be any white spaces between @ and the name, or it won't trigger a notification :) $\endgroup$ – xzczd Nov 17 '15 at 13:38
  • $\begingroup$ This question would be more clear if you gave a specific example and the expected result. $\endgroup$ – george2079 Nov 17 '15 at 15:49
  • $\begingroup$ @J. M.: Thanks, I have done this first, of course. But it is returned unevaluated, at least in my case of a complicated function f $\endgroup$ – Dr. Wolfgang Hintze Nov 17 '15 at 16:56

OK, let me extend the comment into an answer. If ft still contains InverseFunction, your goal can be achieved by

(* Solution 1 *)
tf = First@Head@ft
(* Solution 2 *)
tf = ft[[0, 1]]
(* Solution 3 *)
tf = InverseFunction@Head@ft
(* Solution 4 *)
tf = InverseFunction@ft[[0]]
(* Solution 5 *)
tf = InverseFunction@Function[t, #] &@ft

Solution 5 should also work for the cases that ft no longer contains InverseFunction.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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