I am using Symbolic Math Toolbox to solve following equation and get the result "s".
>> syms x;>> s = solve(-x*log(x)-0.35)s = -7/(20*wrightOmega(log(7/20) - pi*1i)) -7/(20*wrightOmega(log(7/20) + pi*1i))
To get the answer as floating point number, I tried following two approaches:
Case 1: Using "double" or "vpa" gives the correct answer.
>> double(s)ans = 0.2593 0.4884>> vpa(s,4)ans = 0.2593 0.4884
Case 2: Using "eval" or directly evaluating expression in command window gives incorrect answer for first value.
>> eval(s)ans = 0.0168 - 0.0399i 0.4884 + 0.0000i>> -7/(20*wrightOmega(log(7/20) - pi*1i))ans = 0.0168 - 0.0399i
Both approaches should give the same answer. Can you please explain this strange behavior?
Best Answer