InverseFunction: how can I extract the function inside? - Mathematica Stack Exchange most recent 30 from mathematica.stackexchange.com 2019-09-17T05:20:18Z https://mathematica.stackexchange.com/feeds/question/99677 https://creativecommons.org/licenses/by-sa/4.0/rdf https://mathematica.stackexchange.com/q/99677 3 InverseFunction: how can I extract the function inside? Dr. Wolfgang Hintze https://mathematica.stackexchange.com/users/16361 2015-11-17T11:05:13Z 2015-11-17T17:12:40Z <p>This is probably a trivial question. But I could not find an answer.</p> <p>Given the explicit expression for <code>ft</code> in te assignment</p> <pre><code>ft = InverseFunction[f[#] &amp;][t]; </code></pre> <p>I would like to invert this, i.e. to get the function <code>t[f[x]]</code>. Of course I can copy the expression <code>f[#]&amp;</code> and paste it into the right hand side of the assignment</p> <pre><code>t[x_] = f[#]&amp; [x]; </code></pre> <p>But I think there should be a valid Mathematica method to do the extraction. </p> <p>The <code>FullForm[]</code> of <code>ft</code> shows a presumed <code>List[]</code> which, however, is a strange contruct which only lets me extract the argument <code>t</code> as its first element.</p> <p>Example (I write it in Latex just to save space)</p> <p>$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}}\&amp;\right][t]$</p> <p>I wish to extract the expression in square brackets.</p> <p>Taking the compact solution 2 from the answer of xzczd we find</p> <pre><code>tx = ft[[0, 1]][x] </code></pre> <p>$-\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}}$</p> https://mathematica.stackexchange.com/questions/99677/-/99689#99689 4 Answer by xzczd for InverseFunction: how can I extract the function inside? xzczd https://mathematica.stackexchange.com/users/1871 2015-11-17T13:32:45Z 2015-11-17T13:32:45Z <p>OK, let me extend the comment into an answer. If <code>ft</code> still contains <code>InverseFunction</code>, your goal can be achieved by</p> <pre><code>(* Solution 1 *) tf = First@Head@ft (* Solution 2 *) tf = ft[[0, 1]] (* Solution 3 *) tf = InverseFunction@Head@ft (* Solution 4 *) tf = InverseFunction@ft[] (* Solution 5 *) tf = InverseFunction@Function[t, #] &amp;@ft </code></pre> <p><em>Solution 5</em> should also work for the cases that <code>ft</code> no longer contains <code>InverseFunction</code>.</p>