3
$\begingroup$

I have an equation of the form

eq := 4/\[Pi] y x^2 - 1/16 c^2 Log[(2 x)/(\[Pi] w)] == cons

with the following set of parameters

parameters = {w -> 100, c -> 1, cons -> 0.46, y -> 0.5};

Replacing the parameters and solving the equation, gives

Solve[eq /. parameters, x]

$x = 0.114106, x = 0.351317$

But if I first solve the equation analytically and then replace the parameters, I get

 xans = x /. Solve[eq, x];
 xans /. parameters // Chop

$x=0.114106,x= -0.114106$

My question is that why the second answer appears in the first way, i.e., $x= 0.351317$ is missed in the 2nd way? How I can I find the analytic solution with this x as the answer?

$\endgroup$
4
  • $\begingroup$ Think of xans = x /. Solve[eq, x, Reals] xans /. parameters and compare with xans = x /. Solve[eq, x] xans /. parameters. $\endgroup$ – user64494 May 29 at 15:19
  • $\begingroup$ x==- 0.114106 is not a solution in view of 4/\[Pi] y x^2 - 1/16 c^2 Log[(2 x)/(\[Pi] w)] - cons /. {w -> 100, c -> 1, cons -> 0.46, y -> 0.5, x -> -0.114106} which outputs 1.74124*10^-7 - 0.19635 I. The Solve command uses nonequivalent transformations in some cases. $\endgroup$ – user64494 May 29 at 15:51
  • $\begingroup$ Reduce[eq, x, Reals] performs a warning "Reduce::nsmet: This system cannot be solved with the methods available to Reduce." and returns the input. Reduce[eq, x] has no chance in view of four parameters. $\endgroup$ – user64494 May 29 at 15:58
  • $\begingroup$ @ user64494 Thanks for your comments. In fact I need the analytic solution which leads to x=0.351317. $\endgroup$ – Kheeyal May 29 at 17:12
7
$\begingroup$

When you solved it analytically by Solve, I think you got the warning message:

Solve::ifun: Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution
     information.

So it is not guaranteed that all the analytic solutions are obtained in this way. (Note that the Lambert W function is multivalued.) As user64494 pointed out, the second analytic solution leads to a wrong numerical answer in your case.

To get the second analytical solution, you need to select another branch for ProductLog (see also this post):

x /. First[Solve[eq, x]] /. ProductLog[z_] -> ProductLog[-1, z] /. parameters  (* 0.351317 + 0. I *)
$\endgroup$
1
  • 1
    $\begingroup$ Thank you so much for your great help. $\endgroup$ – Kheeyal May 29 at 17: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.