All Questions

Filter by
Sorted by
Tagged with
43 votes
5 answers
22k views

What is the most efficient way to add rows and columns to a matrix?

Say I have a matrix m and a vector v. ...
user avatar
  • 19k
21 votes
1 answer
1k views

Transparent textures don't show

EDIT For now, I'm going to accept Brett's answer. It's a way to get transparency back by having 3D calculations done in software instead of hardware. It addresses the symptoms but not the causes. ...
user avatar
7 votes
3 answers
282 views

How to avoid spaces between numbers when displaying TagBox(es)

The instruction : DisplayForm[RowBox[List[0,1,Superscript[2,3],Superscript[1,2],a]]] displays a gap between the first two items of the list but if one is careful ...
user avatar
  • 937
72 votes
9 answers
61k views

How to find the position of elements in a list satisfying criteria

Say I have a list x={2,4,6,8,10} and I want to find out the positions of the elements that are greater than 7. ...
user avatar
  • 1,393
11 votes
5 answers
3k views

How do you efficiently return all of a List but one element?

I have a problem that I am working on that requires that I compare several lists of overlapping data points. As I traverse one of the lists, I'd like to only compare those data to the other lists, and ...
user avatar
  • 33.3k
36 votes
4 answers
2k views

What are the most common (usual) ways to make palettes with non-trivial functionality?

What are the best (most robust and most convenient) ways to create palettes that can be installed permanently (using Palettes -> Install Palette...) and are safe ...
user avatar
  • 225k
34 votes
6 answers
3k views

How to find out the (current) free memory on the system?

Is there any way in Mathematica to find out the currently free memory on the system Mathematica runs on (like the utility free shows on the command line)? I've ...
user avatar
  • 18.8k
44 votes
4 answers
7k views

Importing videos in Mathematica

Mathematica's Import command is purportedly able to import .AVI files. However, I find that many files that I want to import do only result in MMA showing a blank ...
user avatar
29 votes
6 answers
6k views

Using ListPointPlot3D to simulate 2D plots moving in time

I wrote a 1D solver for the heat equation $u_t=u_{xx}$, and I can animate the solution using normal ListPlot command, where the x-axis is the rod length, and the y-...
user avatar
  • 109k
10 votes
2 answers
251 views

How to force neat linewrapping in Print?

I am regularly annoyed by the fact, that a neatly arranged Print statement gets ruined by a large piece of data, which - instead of linewrapping "in place" - is ...
user avatar
9 votes
1 answer
429 views

How to check for Mathematica’s definition of XY?

The question is: Can I ask the Mathematica kernel directly what it takes as the definition of the built-in symbol XY? After all this has to be in the kernel. And if the documentation is not giving any ...
user avatar
  • 1,305
136 votes
7 answers
159k views

Get a "step-by-step" evaluation in Mathematica

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? ...
user avatar
  • 2,409
59 votes
3 answers
7k views

How to find out which method Mathematica selected?

There are commands like NonlinearModelFit[] or NDSolve[] that have the option Method it ...
user avatar
  • 1,305
72 votes
5 answers
11k views

ListPlot: Plotting large data fast

Mathematica produces fantastic-looking graphics, but it can be slow on large data sets. Here is an example for a (random) time series: ...
user avatar
  • 1,937
27 votes
4 answers
4k views

Sum over n variables

What is the most painless way to sum over n variables, for example, if the range of summation is $i_1 < i_2 < i_3 < \dots < i_n$, where $n$ is an argument of the function in question? Is ...
user avatar
  • 755
20 votes
5 answers
935 views

Change syntax from other programs to mathematica syntax

Is there a good way to transform syntax from other computer algebra systems or from latex to mathematica syntax?
user avatar
  • 755
34 votes
1 answer
1k views

which is better, using Assert[] or manual checks on arguments and other computations?

I never used Asserts in Mathematica, but trying to see what advantage they have over just argument check and additional definitions of the function to capture unwanted input. For example, which one ...
user avatar
  • 109k
32 votes
2 answers
3k views

Plot Option Precedence while combining Plots with Show[]

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,...
user avatar
  • 1,305
52 votes
4 answers
7k views

Saving Mathematica kernel state?

If I save a notebook, I only save what I see. That is, if I close Mathematica and reopen the notebook later, all previous calculations are lost, except for those things I've output. Now I know that ...
user avatar
  • 18.8k
8 votes
1 answer
350 views

Can the Notation function support complex structures on its left hand side?

In my investigation of the possibilities offered by the Notation package, I came over a limitation in the complexity of the left hand side symbol. For instance, although I am able to enter ...
user avatar
  • 609
106 votes
4 answers
6k views

Flatten command: matrix as second argument

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 ...
user avatar
  • 14.7k
13 votes
2 answers
460 views

Difficulties in creating strict and robust equivalence between two symbols using the Notation package

I am investigating the use of the Notation package facilities to create strict the equivalence between pretty-printed symbols such as ...
user avatar
  • 609
25 votes
4 answers
946 views

Continuous evaluation of complex calculations

When having a first look at some system, it's often very useful to just play with the parameters and see how it develops. Therefore, I would like to let a certain evaluation run "until I cancel it". ...
user avatar
  • 14.7k
11 votes
1 answer
660 views

Manipulate evaluation sequence

Manipulate doesn't always evaluate in the order I expect it to. What is the evaluation sequence for Manipulate and other ...
user avatar
  • 405
63 votes
4 answers
4k views

Speeding up this fractal-generating code

I used the code below (which is a sample from this gist containing more similar code) in my answer to my own question about Mandelbrot-like sets for functions other than the simple quadratic on Math....
user avatar
  • 3,129
44 votes
2 answers
6k views

How can I improve the speed of eigenvalue decompositions for large matrices?

I often need to compute the eigenvalues of large matrices, and I invariably resort to MATLAB for these, simply because it is much faster. I'd like to change that, so that I can work entirely inside my ...
user avatar
  • 86.9k
9 votes
2 answers
1k views

What causes Manipulate to stop evaluating expressions?

I'm working on a N-body simulation within Mathematica, and currently I have something along these lines: ...
user avatar
  • 1,905
211 votes
2 answers
13k views

What is the distinction between DownValues, UpValues, SubValues, and OwnValues?

When reading through the documentation, you often encounter the phrases DownValues, UpValues, ...
user avatar
  • 33.3k
15 votes
3 answers
3k views

How can I ensure graphics exported in WMF format don't have text-spacing problems?

A lot of my work involves manipulating data, drawing a pretty plot of it and then inserting that graphic into a report written in Microsoft Word, under Windows.1 The fun comes with the exporting part. ...
user avatar
  • 33.7k
14 votes
1 answer
262 views

Choosing among different function definitions without sacrificing speed

I'm working on some code that numerically integrates a function, let's call it G, which calls another function, F, that can be ...
user avatar
  • 4,731
11 votes
1 answer
780 views

Creating custom notation

How does one generate custom symbols? For example, the physicist notation for the rotation is "nabla cross function". In this case however, Mathematica complains that the ...
user avatar
  • 14.7k
18 votes
4 answers
1k views

How can I randomly generate a unique, unused symbol?

In a previous question on collecting terms for a multivariable polynomial, I answered with a solution that required a unused symbol to be used for a temporary substitution and back substitution. It ...
user avatar
  • 1,905
18 votes
1 answer
715 views

What are the exact guidelines for what is allowed in a CDF?

I have read the guidelines published by Wolfram (these are restricted: non-numeric input fields, dialog windows, and data import and export) but I have a CDF that seems simple enough and seems to ...
user avatar
  • 1,325
17 votes
2 answers
370 views

Clearing a specific definition

Consider the case where a symbol has multiple definitions attached to it, a /: Subscript[a,2] := 1 a[b_] := 2 a[b_, c_] := 3 How does one clear (/unset/remove) ...
user avatar
  • 14.7k
10 votes
2 answers
2k views

How can I get Overlay to position graphics according to coordinates?

If I draw graphics like this, I get exactly what I need: Graphics[{{Blue, Disk[{0, 0}, 10, {0, Pi/2}]}, {Red, Disk[{0, 0}, 3, {0, Pi/4}]}}] But I need to ...
user avatar
  • 683
55 votes
3 answers
11k views

Best way to give presentations with Mathematica

I have typically used PowerPoint or plain PDFs of slides to give presentations, but with heavy mathematical content, it can be tedious to create these presentations and make them look good. How can I ...
user avatar
  • 3,129
56 votes
5 answers
5k views

How can I implement dynamic programming for a function with more than one argument?

Dynamic programming is a technique for avoiding the repeated computation of the same values in a recursive program. Each value computed is immediately stored. If the value is needed again, it is not ...
user avatar
18 votes
2 answers
3k views

Texture mapping and resizing a sphere primitive in Mathematica

Background Info In Mathematica, it's only possible to texture map a sphere through the use of SphericalPlot3D or ...
user avatar
  • 1,905
20 votes
7 answers
2k views

How to use Union on list of lists without sorting them first?

If I do ClearAll[a, d] lsts = {{a, d}, {a, d}}; Union[lsts] I get the expected answer {{a, d}} but if I do ...
user avatar
  • 109k
24 votes
1 answer
2k views

How to create regular (planar) graphs?

How to programmatically create and plot regular planar graphs with $k = 3, 4$ or $6$ (not hypercubes) and regular nonplanar graphs of $k = 8$ (see figure)? Note that what matters is the average ...
user avatar
17 votes
4 answers
6k views

Is there a way to Collect[] for more than one symbol?

Oftentimes you find yourself looking for polynomials in multiple variables. Consider the following expression: a(x - y)^3 + b(x - y) + c(x - y) + d as you can ...
user avatar
  • 2,493
55 votes
9 answers
2k views

Is it possible to invoke the OEIS from Mathematica?

I had always wondered if there might be a way to write a function, which I'll call OEISData[], that more or less works as a curated data function for The On-Line ...
user avatar
14 votes
1 answer
720 views

ImageAlign doesn't always work correctly

I've been working with ImageAlign in Mathematica 8 and I'm having trouble getting it working reliably. Perhaps there are some subtleties that I'm not yet aware of? ...
user avatar
  • 23.9k
119 votes
1 answer
8k views

File-backed lists/variables for handling large data

Background Currently I am working with some large data (most of it generated by Mathematica itself). I usually find it a hassle to do this. For example, I just exported a large amount of data to ...
user avatar
  • 225k
14 votes
1 answer
1k views

How to run mathlink external commands in parallel?

I have an external function called increment (for the sake of illustration) that I call from Mathematica using MathLink. I.e., ...
user avatar
  • 4,941
21 votes
2 answers
2k views

RegionPlot is producing odd gaps, even for simple functions. Is there an option to prevent this?

When I use RegionPlot to plot the region between two functions, I get strange gaps in the resulting figure. Is there a way to prevent this from happening? For ...
user avatar
  • 12.7k
586 votes
19 answers
149k 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 ...
62 votes
11 answers
6k views

Can Mathematica propose an exact value based on an approximate one?

Sometimes, I use Mathematica to do some hypothesis on homework to make the question easier. For instance, when I have to compute big sums when $n\to\infty$ and Mathematica can't give the exact answer, ...
user avatar
  • 2,409
31 votes
3 answers
6k views

How to symbolically do matrix "Block Inversion"?

Consider a block (partitioned) matrix matrix = ArrayFlatten[{{a, b}, {c, d}}] where, a, b,...
user avatar
  • 7,289
27 votes
2 answers
1k views

Is there a way to have Plot draw points on a function where the function is undefined as circles as in textbooks?

A very common feature of graphs of functions used throughout textbooks are simple indications, such as open circles, of the points at which a function is undefined. Is there a way to do this in ...
user avatar
  • 12.7k

15 30 50 per page