Resources supporting Mathematica. Currently slanted towards support of commands for calculus and differential equations.
In the following table, Maroon error messages are symptomatic: they are what you may see the computer or Mathematica do. Blue error messages are the messages that Mathematica returns. Green error messages are non-error messages that Mathematica may return as people work with Mathematica.
| Error | Reason | Solution |
| Mathematica runs one calculation interminably | Loop error or large calculation | Check that any Do loops have the correct iteration and definitions. Abort calculation, try running it with a loop of only one or two iterations; check that the output is numerical by looking at what the loop is producing. e.g., check y[i]; check that the iterator (i) starts at the correct value. |
| Expression... has no closing "]" | Parenthesis or bracket matching error. | Check that all opening and closing parentheses, brackets and braces balance and are used in the correct contexts. |
| f[x] is not a machine-size real number | f(x) is not properly defined | Check that function definition line has been correctly executed, or for errors in the definition (esp. that it is defined with an underscore: f[x_] := stuff). See if f[1] evaluates correctly. Execute f[x] to see if f[x] is correct. Clear[f] and redefine f(x). See also below. |
| LHSum[...] returns the command line entered. | Needs["Local`calculus`"] command not run correctly | Run Remove[LHSum], then (re)run the Needs command. If this doesn't work, quit and restart the kernel. |
| From LHSum: Cos[2x][x] is not a machine-size real number | Incorrect entry of function in LHSum command. | Check that command is entered as LHSum[f, {...}], not LHSum[f[x], {...}] or LHSum[Cos[2x], {...}]. |
| Limit specification {x,0,3}... is not of the form {x,xmin,xmax} | Incorrect limit list, or dropped comma in command | Check that first entry after the function(s) is of the form {x,0,3}; Check for commas between all arguments in the command; Check that multiple functions in a plot command are enclosed by braces: {Sin[x], Cos[x]} |
| ...is not a machine-size real number | Incorrect use of brackets or braces | Check that brackets are used for function arguments: Sin[x] not Sin(x); Check that all multiplication of variables has spaces or *: Sin[a*x], not Sin[ax]. |
| Sin x is not a machine-size real number | Incorrect use of brackets or braces | Check that brackets are used for function arguments: Sin[x] not Sin(x). |
| 4[x] is not a machine-size real number | Incorrect use of square brackets | Check for square brackets [ ] used in place of parentheses ( ) for grouping terms, as in 4(x) or 3(x-1). |
| NDSolve: The first argument must have both an equation and an initial condition.; {z'[t] == -.2 z[t], 5} is neither a list of replacement rules nor a valid dispatch table | Use of "=" instead of "==" | Clear variable used in assignment; correct use of "==" in equations and "=" for assignment. |
| ODESolve[...] returns the command line entered. | Needs["Local`diffeq`"] command not run correctly | Run Remove[ODESolve], then (re)run the Needs command. If this doesn't work, quit and restart the kernel. |
| PlotVectorField[...] returns the command line entered. | Needs["Graphics`PlotField`"] command not run correctly | Run Remove[PlotVectorField], then (re)run the Needs command. If this doesn't work, quit and restart the kernel. |
| Show: An error was encountered in combining the graphics objects in Show[*Graphics*,p2] | Graphic p2 not properly defined | (Re)run plot command used to generate p2. |
| Possible spelling error: new symbol name "xSin" is similar to existing symbol "Sin" | Missing space or * | Check that there is a space or * sign between variables and functions: x*Sin[x], not xSin[x]; Check that Mathematica's internal functions are capitalized: Sin[x], not sin[x] |
| Tag Times in... is Protected | Incorrect use of "=" | Check that "==" is used in equations, "=" for assignment, and ":=" in function definitions. |
| Unknown Graphics primative Red encountered | Needs["Graphics`Colors`"] not run correctly | Run command Remove[Red] (and other colors that have been used), then re-execute the Needs["Graphics`Colors`"] command. If this doesn't work, quit and restart the kernel, then run the Needs command. |
| "[4-x]" is incomplete; more input is needed | Incorrect use of brackets and parentheses. | Check that all opening and closing parentheses, brackets and braces balance and are used in the correct contexts. |
- Function Definitions
- In Mathematica, there are two rules of assignments needed for functions:
- to define a variable to be substitutable for, use an underscore:
f[x_]:=Sin[x]- rather than
f[x]:=Sin[x]- In the first case,
f[3]will substitute 3 into the right-hand side of the definition; in the second, it returns a different item, "f[3]" that is unrelated to the function definition.
- to allow subsequent modification of a parameter in a function definition, use
:=:f[x_]:=Sin[x+a]- rather than
f[x_]=Sin[x+a]- In the first case, if we later define
a=3, this change will be made when we go to evaluatef[8](or what-have-you); in the second,aretains whatever value it has when the function definition is made and will not reflect any subsequent definitions ofa.
- Lists in Mathematica
- Braces
{ }are used in Mathematica to define lists, and double square brackets[[ ]]are used to reference list items. For example, ifsomelist = { {a,b}, {c,d}, {e,f} }- then
somelist[[1]]returns{a,b}, andsomelist[[3]]returns{e,f}. By extension,somelist[[2]][[2]]returnsd.
- Substitution and Rules in Mathematica
- The substitution operator
/.may be used to apply the (list of) rule(s) on its right to the expression on its left:a + 5b /. b -> a- returns
6a, anda + 5b + 2c /. {b->a, c->2a}- returns
10a. Thusresult = f[x] + Sin[x] /. x->Pi/4- assigns the output
f[Pi/4] + Sin[Pi/4]toresult.
- Use of Parentheses, Brackets and Braces
- In Mathematica, Parentheses ( ), Brackets [ ] and Braces { } have reserved meanings:
- ( ): used to group algebraic terms--e.g., (4-x)(1+x) or 5/(3 - 2x)
- [ ]: used for function arguments--e.g., Sin[x], Plot[3x, {x,0,5}]
- { }: used for lists of objects--e.g., {x,0,5}, {{0,0},{1,1},{2,4},{3,9}}