Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am trying to find the inverse function of $\frac{\ln{x}}{x^2}$ in Mathematica. I am using the Solve[] function to find the inverse (yes, I know about InverseFunction[], but I was told to solve it with Solve[]).

Why doesn't the following output evaluate correctly? I know that I shouldn't get imaginary values:

enter image description here

Plugging the equation into Solve[] directly also gives me the same result:

enter image description here

However, if I drop the x from the Log[] function, I get something that looks more plausible:

enter image description here

Does Log[x] and Log evaluate to the same thing? Thank you for your time!

share|improve this question
add comment

1 Answer

up vote 10 down vote accepted

No, Log is the name of the function and Log[x] is the function applied to x. Using Log without the argument is accepted by the system because Log is a symbol just like any other, but it does not make any sense.


The correct way to write it is

Solve[Log[x]/x^2 == y, x]

or

Reduce[Log[x]/x^2 == y, x]

The latter tries to give you full solution information, while the former's result may only be valid for certain values of x and y (see below). The differences are explained in this guide.

The first result you get from Solve is correct for some real values of y as you can check by numerical evaluation:

x /. Solve[Log[x]/x^2 == y, x]

(*
==> {-(I Sqrt[ProductLog[-2 y]])/(Sqrt[2] Sqrt[y]), 
      (I Sqrt[ProductLog[-2 y]])/(Sqrt[2] Sqrt[y])}
*)

% /. y -> 0.05

(* ==> {1.05751 + 0. I, -1.05751 + 0. I} *)

Log[x]/x^2 /. x -> %[[1]]

(* ==> 0.05 + 0. I *)

The second result is not correct for y == 0.05 but it is correct for other values such as y == 1.0 I for which the first result is incorrect.

Mathematica generally assumes that all variables are complex and tried to solve for the this general case. While the expression does contain an explicit I, it will evaluate to a real value for some real x.

Reduce will try to generate conditions under which the solutions are valid. We can also specify that we are interested in only positive real values of x:

Reduce[Log[x]/x^2 == y && x > 0, x]

(*
==> (y == 0 && x == 1) || (y < 0 && 
   x == E^(-(1/2) ProductLog[-2 y])) || (0 < y <= 1/(
    2 E) && (x == E^(-(1/2) ProductLog[-1, -2 y]) || 
     x == E^(-(1/2) ProductLog[-2 y])))
*)

Note though that this function has no inverse even for $x \in (0, \infty)$:

Plot[Log[x]/x^2, {x, 0, 10}]

Mathematica graphics

share|improve this answer
    
Thank you. Your description is quite complete! +1 and answer accepted! –  spryno724 Feb 24 '12 at 20:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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