NDSolve[{"a"''[t] + "a"[t] == 0, "a"'[0] == 0, "a"[0] == 1}, "a", {t, 0, 10}]

This code works in Mathematica 10 and below but in Mathematica 11, I got the error message:

NDSolve::dsfun: "a" cannot be used as a function.

Is this a bug or just the new limitation?

The reason I use string as function name is because it can avoid memory problem for using NDSolve in Module. See the question and answer here https://mathematica.stackexchange.com/a/78382/34148

  • 2
    $\begingroup$ I never knew a function name can be string except now. But may be someone at WRI finally noticed this and decided it was bad idea and removed this hidden feature? I have no idea why any one would want to write code using strings for function names to start with, even if it possible, as it leads to convoluted code to say the least. But you are correct, I verified it worked on 10.4 and not on 11.3. $\endgroup$
    – Nasser
    May 3, 2018 at 7:59
  • $\begingroup$ Because I try to avoid the memory problem. See my new edited. $\endgroup$
    – Louis Yang
    May 3, 2018 at 8:37
  • $\begingroup$ @LouisYang This was never intended to work (at least starting from 10.0) - see my updated answer $\endgroup$
    – Lukas Lang
    May 3, 2018 at 9:13

1 Answer 1


This is a bug in 10.0 (or earlier) up to 11.1 that has been resolved in 11.2

From the documentation of NDSolve::dsfun (this exists at least since 10.2):

This message is generated when a number or a string is used as the name of a function in DSolve or NDSolve.

So it appears as if this was never intended to work, and the oversight was finally fixed in 11.2.

In case you were not aware, some messages are documented on a separate page:

  • 1
    $\begingroup$ I think the question was asking, why it worked before and not now. $\endgroup$
    – Nasser
    May 3, 2018 at 8:10
  • $\begingroup$ @Nasser Well, it answers the question whether it's a bug or not. Unfortunately, I don't have MMA 10 installed, so I can't tell how the documentation looks there $\endgroup$
    – Lukas Lang
    May 3, 2018 at 8:12
  • $\begingroup$ in version 10.4, there is no error message and it works ok. So no message to trace as you show. $\endgroup$
    – Nasser
    May 3, 2018 at 8:13
  • 1
    $\begingroup$ @Nasser Ok, found an installation of MMA 10.0 - the message is already there with the same description, apparently the error just wasn't detected properly up to 11.1. - I've updated the answer accordingly $\endgroup$
    – Lukas Lang
    May 3, 2018 at 9:15
  • 1
    $\begingroup$ OK, I thought this is the new feature introduced in MMA 9. Now, I will have to find another way to avoid memory leakage for NDSolve in function. $\endgroup$
    – Louis Yang
    May 3, 2018 at 9:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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