I have a problem finding the inverse of a function, perhaps I'm missing something.. I'd appreciate it if someone can help me out.

First, I calculate an Integral of the form

int = Integrate[(1+x)/(3(1-x)x),{x,0.3,y}]

From which I get

ConditionalExpression[0.333333 (-2. Log[1. - 1. x] + Log[x]) - 
  0.333333 (-2. Log[0.7 - 3.*10^-15 Sign[x]] + 
     Log[0.3 + 3.*10^-15 Sign[x]]), 
 2.*10^-21 < Re[x] <= 
   0.9999999999999999 || x \[NotElement] Reals]

The function I want to invert is then f:

f = Exp[int] - 1

I want to find $f^{-1}(x)$ so I do:

purify[f_, x_] := Function @@ {f /. x -> #}

Which will rewrite the function properly and then do


This syntax works for almost every function I try, except the one I need. Mathematica keeps "running" and never returns a result for the Inverse Function. Does anyone have any ideas of what is going on? and maybe how to fix it?

My guess is that the problem comes from the function defined by the integral "int", It may be written in a weird manner or has something in it that mathematica does not understand.. I've tried Rationalize to write the result of the integral without floating points, but without any luck so far.


Here's one way to approach this:

int = Integrate[(1 + x)/((1 - x) x), {x, 0.3, y}, Assumptions -> {y > 0.3}]
ConditionalExpression[0.490623 - 2 Log[1 - y] + Log[y], y < 1.]

I added the assumption to make sure that y is considered real-valued. So let's assume y<1, and assign:

f[y_] = Exp[0.4906229164484712` - 2 Log[1 - y] + Log[y]] - 1
-1 + (1.63333 y)/(1 - y)^2

That looks simple enough to invert. The inverse is:

g = InverseFunction[f]
(0.0166667 (109. + 60. #1 - 7. Sqrt[169. + 120. #1]))/(1. + #1) &

So you can see what it looks like:

Plot[g[y], {y, 0, 1}]

enter image description here

  • $\begingroup$ Thank you so, so much! $\endgroup$ May 14 '19 at 6:45

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.