Mathematica Asked by Kheeyal on June 17, 2021
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?
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 *)
Correct answer by tueda on June 17, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP