Frequent Questions
19,383 questions
559
votes
37
answers
139k
views
What are the most common pitfalls awaiting new users?
As you may already know, Mathematica is a wonderful piece of software.
However, it has a few characteristics that tend to confuse new (and sometimes not-so-new) users. That can be clearly seen from ...
54
votes
4
answers
24k
views
How do I work with Root objects?
I want to solve the trigonometric equation :
$$(3-\cos 4x )\cdot (\sin x - \cos x ) = 2.$$
I tried
Solve[(3 - Cos[4*x])*(Sin[x] - Cos[x]) == 2, x]
It returns the ...
608
votes
19
answers
161k
views
Where can I find examples of good Mathematica programming practice?
I consider myself a pretty good Mathematica programmer, but I'm always looking out for ways to either improve my way of doing things in Mathematica, or to see if there's something nifty that I haven't ...
112
votes
4
answers
18k
views
Plot draws list of curves in same color when not using Evaluate
This example comes from
the Mathematica documentation for Plot
under Basic Examples.
Can someone please explain why these are each plotted as a different color in ...
185
votes
8
answers
23k
views
List of compilable functions
Is there somewhere a list on the functions that Compile can compile, or the cases in which a particular function can be compiled that I haven't found?
I'd be glad ...
262
votes
9
answers
21k
views
What are the use cases for different scoping constructs?
Mathematica includes three functions that I know of which can be used to effectively (if not actually) define a variable and give it a value within a local scope: ...
207
votes
3
answers
57k
views
Alternatives to procedural loops and iterating over lists in Mathematica
While there are some cases where a For loop might be reasonable, it's a general mantra – one I subscribe to myself – that "if you are using a ...
125
votes
3
answers
10k
views
What is a Mathematica packed array?
A simple sounding question with a few sub questions:
What is the difference between unpacked vs packed array?
Are packed arrays more space efficent, how much so?
Are packed arrays more time efficient ...
120
votes
4
answers
31k
views
Why should I avoid the For loop in Mathematica?
Some people advise against the use of For loops in Mathematica. Why? Should I heed this advice? What is wrong with For? What ...
56
votes
4
answers
13k
views
Why does MatrixForm affect calculations?
This is a really newbie question, but it has me confused. Why does this code work without // MatrixForm and doesn't work with ...
208
votes
15
answers
77k
views
Elegant operations on matrix rows and columns
Question
The Mathematica tutorial has a section 'Basic Matrix Operations', describing operations like transpose, inverse and determinant. These operations all work on entire matrices. I am missing a ...
216
votes
26
answers
19k
views
What are some useful, undocumented Mathematica functions?
There have already been some questions about some undocumented functionality in Mathematica. Such as (please add to these lists!)
How can one find undocumented options or option values in Mathematica?...
93
votes
5
answers
15k
views
What does the construct f[x_] := f[x] = ... mean?
This question mentions "x := x = trickery".
What does defining a function as f[x_] := f[x] = ... do and what is it good for?
54
votes
4
answers
9k
views
Dynamic Euler–Bernoulli beam equation
I am trying to solve for the vibration of a Euler–Bernoulli beam. The equation is
$\frac{\partial ^2u(t,x)}{\partial t^2}+\frac{\partial ^4u(t,x)}{\partial x^4}=0$
For the boundary conditions I ...
52
votes
5
answers
3k
views
Enforcing correct variable bindings and avoiding renamings for conflicting variables in nested scoping constructs
Using global variables the following turns an "expression" into a Function:
expr = 2 x;
Function[x, Evaluate[expr]]
Of course ...