- #1
kent davidge
- 933
- 56
Suppose I have ##y = x^2##. By inverse, I mean ##x = \pm \sqrt y##. How can I get Mathematica to do that?
Solve[y==x^2,x]
Technically speaking, ##y = x^2## doesn't have an inverse that is itself a function. For a function f to have an inverse, f must be one-to-one. Your example function fails this test because for each number x in the domain that maps to ##x^2##, -x also maps to the same value.kent davidge said:Suppose I have ##y = x^2##. By inverse, I mean ##x = \pm \sqrt y##. How can I get Mathematica to do that?
Solve finds and reports both.Mark44 said:Technically speaking, ##y = x^2## doesn't have an inverse that is itself a function. For a function f to have an inverse, f must be one-to-one. Your example function fails this test because for each number x in the domain that maps to ##x^2##, -x also maps to the same value.
Right. I checked with wolframalpha, which is sort of the online version of Mathematica.Dale said:Solve finds and reports both.
To invert a function in Mathematica, you can use the InverseFunction
command. For example, to invert the function y = x^2
, you would use the command InverseFunction[#^2 &]
.
Yes, you can invert a function with multiple variables using the InverseFunction
command. Just make sure to specify all the variables in the function. For example, to invert the function y = x^2 + 2x + 1
, you would use the command InverseFunction[#^2 + 2 # + 1 &]
.
To plot the inverted function in Mathematica, you can use the Plot
command. For example, to plot the inverse of y = x^2
, you would use the command Plot[InverseFunction[#^2 &][x], {x, -5, 5}]
.
If the function you want to invert is not one-to-one, you can still use the InverseFunction
command, but you will need to specify a specific branch of the inverse function. For example, if you want to invert y = sin(x)
, you can use the command InverseFunction[Sin[#] &, 1]
to specify the principal branch of the inverse function.
Yes, you can use Mathematica to find the derivative of the inverted function using the D
command. For example, to find the derivative of the inverted function of y = x^2
, you would use the command D[InverseFunction[#^2 &][x], x]
.