MATLAB: Solve(E) gives different answers when using x and y as symbolic varible

solve(eqnvar

Hi,
I have run into a problem with solve(eqn,var) function.
>>solve('exp(2*x)+3*exp(x)=54')
gives me just one answer:
>>log(6).
However, when I switch x to y.
>>solve('exp(2*y)+3*exp(y)=54')
the answers become: log(6) and log(9) + pi*1i.
Is x somehow special? I am using matlab R2016a

Best Answer

Even when you pass in a string, solve() interacts with any assumptions you have created for the symbol names. You could see that behavior if you had done
syms x real
Or
syms x positive
Related Question