0
$\begingroup$

My goal it to get inverse of x^2 for positive x. But the result shows always minus -Sqrt[y]. How to correct

u[x_] := x ^2
$Assumptions = x > 0;
Refine[InverseFunction[u][y], y \[Element] Reals]

I have tried this code also but is also shows -Sqrt[y].

Refine[x /. Solve[y == u[x], x][[1]], y \[Element] Reals]
$\endgroup$
1
  • 1
    $\begingroup$ Clear["Global*`"]; u[x_] := x^2; Assuming[y > 0, x /. Solve[{u[x] == y, x > 0}, x][[1]]] $\endgroup$
    – Bob Hanlon
    Commented Mar 25, 2021 at 13:53

1 Answer 1

2
$\begingroup$

Using this example from the documentation as a guide:

if = InverseFunction[Function[x, ConditionalExpression[u[x], x>0]]]

Function[x, ConditionalExpression[Sqrt[x], x >= 0]]

Check:

if[y]

ConditionalExpression[Sqrt[y], y >= 0]

With actual numbers you get:

if[2.]
if[-2.]

1.41421

Undefined

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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