Example:
Solve[x^2 + a x + 1 == 0, x]
Output: Hold[Solve[x^2 + a x + 1 == 0, x]]
What is the problem? Any child can solve this in its head
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityExample:
Solve[x^2 + a x + 1 == 0, x]
Output: Hold[Solve[x^2 + a x + 1 == 0, x]]
What is the problem? Any child can solve this in its head
Solve[x^2 + a x + 1 == 0, x]
gives the correct answer. Unless x or a are defined. It is pretty much guaranteed to return the correct answer if you Clear the symbols prior to execution or use a Block.
x = 1
a = 1
Solve[x^2 + a x + 1 == 0, x]
does not work, even if only x is defined. This is actually fairly confusing and might be because the expression does not get properly Hold 'ed. Be Aware!
x = 1
a = 1
Clear[a,x]
Solve[x^2 + a x + 1 == 0, x]
does
x = 1
a = 1
Block[{a, x},
Solve[x^2 + a x + 1 == 0, x]]
{x, a}
does aswell while preserving any potential values of both x and a
x
that causes the code to loop. Just like what happens when you assignx = x + 1
. $\endgroup$ – Sjoerd Smit Jun 11 '19 at 13:04