Frequent Questions

559 votes
37 answers
139k views

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

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 ...
minthao_2011's user avatar
  • 4,535
608 votes
19 answers
161k views

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

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 ...
trayres's user avatar
  • 1,245
185 votes
8 answers
23k views

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 ...
Rojo's user avatar
  • 43.1k
262 votes
9 answers
21k views

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: ...
David Z's user avatar
  • 5,001
207 votes
3 answers
57k views

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 ...
Mr.Wizard's user avatar
  • 275k
125 votes
3 answers
10k views

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 ...
nixeagle's user avatar
  • 2,303
120 votes
4 answers
31k views

Some people advise against the use of For loops in Mathematica. Why? Should I heed this advice? What is wrong with For? What ...
Szabolcs's user avatar
  • 239k
56 votes
4 answers
13k views

This is a really newbie question, but it has me confused. Why does this code work without // MatrixForm and doesn't work with ...
Alexey Kalmykov's user avatar
208 votes
15 answers
77k views

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 ...
sjdh's user avatar
  • 7,917
216 votes
26 answers
19k views

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

This question mentions "x := x = trickery". What does defining a function as f[x_] := f[x] = ... do and what is it good for?
Chris K's user avatar
  • 20.6k
54 votes
4 answers
9k views

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 ...
Hugh's user avatar
  • 17.2k
52 votes
5 answers
3k views

Using global variables the following turns an "expression" into a Function: expr = 2 x; Function[x, Evaluate[expr]] Of course ...
einbandi's user avatar
  • 4,084
125 votes
7 answers
8k views

Note: I put Simon's implementation on GitHub. Contributions welcome! When trying to read the definition of already defined (package or built-in) symbols using ...
Szabolcs's user avatar
  • 239k
52 votes
9 answers
14k views

I have some questions for multiroot search for transcendental equations. Is there any clever solution to find all the roots for a transcendental equation in a specific range? Perhaps ...
yulinlinyu's user avatar
  • 4,875
32 votes
6 answers
5k views

I am trying to get my head around how Manipulate evaluates functions in a Plot. I have read the introduction to Manipulate, and introduction to Dynamic, but I still ...
ShaunH's user avatar
  • 807
224 votes
2 answers
15k views

When reading through the documentation, you often encounter the phrases DownValues, UpValues, ...
rcollyer's user avatar
  • 34.3k
65 votes
12 answers
112k views

I understand Mathematica can't assign the results of a Solve to the unknowns because there may be more than 1 solution. How can I assign the 4 values of following result to variables? ...
stevenvh's user avatar
  • 7,281
107 votes
5 answers
7k views

I wish to make a replacement inside a held expression: f[x_Real] := x^2; Hold[{2., 3.}] /. n_Real :> f[n] The desired output is ...
Alexey Popkov's user avatar
61 votes
1 answer
4k views

I'm curious what's inside the InterpolationFunction object? For example: ...
xslittlegrass's user avatar
164 votes
12 answers
58k views

I would like to plot those two datasets on top of each other. But they have very different range on the $y$ axis. How can I have two different axis? I found the following on the help menu but quite ...
500's user avatar
  • 5,629
33 votes
1 answer
40k views

In Wolfram Mathematica the function Fourier has the following declaration Fourier[list] And after a list is given to the ...
user253956's user avatar
86 votes
9 answers
7k views

Stan Wagon's Mathematica in Action (second edition; I haven't read the third edition and I'm hoping to eventually see it), demonstrates a nifty function called ...
J. M.'s missing motivation's user avatar
68 votes
4 answers
6k views

I am looking for a simple, robust way to evaluate an expression only one step, and return the result in a held form. The definition of a single step is ambiguous, and this itself is probably worthy ...
Mr.Wizard's user avatar
  • 275k
78 votes
4 answers
16k views

It is known that space curves can either be defined parametrically, $$\begin{align*}x&=f(t)\\y&=g(t)\\z&=h(t)\end{align*}$$ or as the intersection of two surfaces, $$\begin{align*}F(x,y,...
J. M.'s missing motivation's user avatar
78 votes
4 answers
23k views

Is it possible to save a function which was created via Interpolation of some data in such a way that I can use this function in a new Mathematica session without ...
partial81's user avatar
  • 3,121
47 votes
4 answers
5k views

I need a table with the elements made of pure functions and list elements. This is a simplified example: I need a list as: ...
yulinlinyu's user avatar
  • 4,875
187 votes
6 answers
25k views

What are the best practices of compiling functions? I understand that this is a vague question, but let me list some aspects that might trigger useful answers. Some of these have already been answered ...
István Zachar's user avatar
70 votes
10 answers
4k views

Consider the following toy example: Hold[{1, 2, x}] /. x -> Sequence[3, 4] It will give Hold[{1, 2, Sequence[3, 4]}] ...
Szabolcs's user avatar
  • 239k
140 votes
8 answers
9k views

... or are they unnecessary in such a high-level language? I've been thinking about programming style, coding standards and the like quite a bit lately, the result of my current work on a mixed .Net/...
Verbeia's user avatar
  • 34.5k
116 votes
2 answers
33k views

Solve and Reduce both can be used for solving equations. Just by working with them, I know there are some differences between ...
lachis83's user avatar
  • 1,779
165 votes
5 answers
17k views

I recently contacted McGraw-Hill to see if they have a mechanism in place for printing out-of-print books that are still of interest. Specifically, I asked about "Power programming with Mathematica" ...
140 votes
9 answers
32k views

I'm building a package to help me write packages and their documentation. In this post I explained how to make a package and its documentation. In the answer I provided I describe how to build a very ...
jmlopez's user avatar
  • 6,560
113 votes
4 answers
7k views

One thing I could never wrap my head around is how Flatten works when provided with a matrix as the second argument, and the Mathematica help isn't particularly ...
David's user avatar
  • 15.1k
149 votes
7 answers
191k views

Is it possible in Mathematica to get a step-by-step evaluation of some functions; that's to say, outputting not only the result but all the stages that have led to it? If so, how does one do it? ...
Cydonia7's user avatar
  • 2,569
32 votes
3 answers
32k views

I was just evaluating a couple of expressions and started to get errors like this: ...
user avatar
16 votes
2 answers
4k views

Consider the following differential equation: $$\begin{align*}&\rho C_p\left(\frac{\partial T}{\partial t}\right)=k\left[\frac{\partial^2 T}{\partial x^2}\right]+\dot{q}\\ &\text{at }x=0,\;\...
Feyre's user avatar
  • 8,687
60 votes
4 answers
12k views

This seems like a simple thing to do, but I couldn't find anything relevant from Mathematica documentation. So suppose I have an expression: a*b/(a + a*Cos[a/b]) ...
Echows's user avatar
  • 1,001
66 votes
2 answers
8k views

Update Finally in v13.1 the function DSolveChangeVariables is introduced, try it out! DChange in the answer below is still a ...
xzczd's user avatar
  • 71.6k
53 votes
6 answers
12k views

Say I want to quickly calculate $\sqrt[3]{-8}$, to which the most obvious solution is $-2$. When I input $\sqrt[3]{-8}$ or Power[-8, 3^-1], Mathematica gives the ...
jtbandes's user avatar
  • 1,422
32 votes
2 answers
4k views

I like to build sophisticated plots by combining simpler ones with Show[]. Typically this involves setting non-default Plot-Options with the different Plot-Commands,...
uli's user avatar
  • 1,395
58 votes
2 answers
9k views

I have written some custom functions to draw multi-panel graphs like this one: It's done by passing a matrix of (custom) plotting functions to a MultiPanelGraph ...
Verbeia's user avatar
  • 34.5k
186 votes
5 answers
20k views

What performance tuning tricks do you use to make a Mathematica application faster? MATLAB has an amazing profiler, but from what I can tell, Mathematica has no similar functionality.
John's user avatar
  • 2,663
91 votes
3 answers
6k views

Under More Information in the help page of ViewMatrix the following entry can be found With the setting ViewMatrix->Automatic...
halirutan's user avatar
  • 114k
70 votes
5 answers
32k views

So I have a graph with multiple lists, for e.g. data = {{1,2}, {3,4}, {3,5}, {2,3} . . .} If I then do ...
Eiyrioü von Kauyf's user avatar
48 votes
2 answers
11k views

I have a problem with defining a function and most of time I get confused by Set or = and ...
DSaad's user avatar
  • 1,193
124 votes
7 answers
19k views

I really miss having something like a struct in Mathematica. I know of (and regularly use) a couple of programming techniques which feel like a ...
Cassini's user avatar
  • 5,666
90 votes
11 answers
21k views

Background: I use code from An Efficient Test For A Point To Be In A Convex Polygon Wolfram Demonstration to check if a point ( mouse pointer ) is in a ( convex ) polygon. Clearly this code fails for ...
nilo de roock's user avatar

15 30 50 per page
1
2 3 4 5
388