1
$\begingroup$

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

$\endgroup$

closed as off-topic by march, LCarvalho, m_goldberg, user21, user42582 Jun 15 at 12:44

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – march, LCarvalho, m_goldberg, user21, user42582
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ For me it works. Have you tried stopping the kernel prior to this? $\endgroup$ – Gladaed Jun 11 at 11:56
  • $\begingroup$ I don't know how but restarting Mathematica solved the problem... Still curious why this happened $\endgroup$ – OD IUM Jun 11 at 11:58
  • $\begingroup$ You must have assigned some value to x that causes the code to loop. Just like what happens when you assign x = x + 1. $\endgroup$ – Sjoerd Smit Jun 11 at 13:04
3
$\begingroup$
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

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.