I was experimenting with the Wolfram Programming Lab, but it doesn't seem to be working. I tried running this code in a notebook:

D[x^2, x]

but it gives the error

$RecursionLimit: Recursion depth of 1024 exceeded during evaluation of 2x.

and gives this as the output (the x after the is subscript):

Hold[$UserPre[∂x x^2]]

It offers the button "release hold", but clicking that doesn't solve the problem. I get the same recursion error and slightly different, though still bizarre, output:

Hold[$UserPre[ReleaseHold[Hold[$UserPre[∂x x^2]]]]]

Even just typing 2 * x gives a recursion error. My understanding is that Wolfram Language is designed around symbolic computation, so why isn't this working?

  • 5
    $\begingroup$ It sounds like at some point in the past you have probably ran code that is interfering. To test that theory, you could try running a different piece of code like D[xxxx^2, xxxx]. If that works, you’ve probably redefined x somewhere. The quickest way to solve the problem is probably to go to the Evaluation menu and select Restart Session. This should clear any lingering definitions. $\endgroup$
    – MassDefect
    Feb 4, 2021 at 3:05
  • $\begingroup$ Huh, I didn't think that would be the issue since I created fresh notebooks before and they reproduced the issue, but I tried again now and it worked. I still feel confused about why creating a fresh notebook didn't work before, but thanks for your help :) $\endgroup$
    – Camelid
    Feb 4, 2021 at 4:50
  • $\begingroup$ Also, I don't think I ever defined x before, so I'm not sure if that could have caused it. $\endgroup$
    – Camelid
    Feb 4, 2021 at 4:51
  • 4
    $\begingroup$ Camelid, creating a “fresh notebook” does nothing to change the current session or alter the condition of the kernel. Simply put, if you have defined x previously & then open a new notebook, this x will remained defined because you are still in the same session or using the same kernel. $\endgroup$ Feb 4, 2021 at 5:03
  • $\begingroup$ I'm going to vote to close this. It was either a user error or a possibly serious bug. If ever you are able to replicate this, please report it along with steps to reproduce (even if it only happens say every so often). $\endgroup$ Feb 4, 2021 at 15:23


Browse other questions tagged or ask your own question.