Linked Questions

602 votes
19 answers

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 ...
123 votes
7 answers

Struct equivalent in Mathematica?

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,586
139 votes
8 answers

Can one identify the design patterns of Mathematica?

... 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.3k
90 votes
6 answers

How to avoid nested With[]?

With[ {v1 = #}, With[ {v2 = f[v1]}, g[v1, v2] ] ] How to avoid nested With[] like the above? I'd like to use <...
user13253's user avatar
  • 8,666
77 votes
4 answers

How do I save a variable or function definition to a file?

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,101
83 votes
3 answers

Metaprogramming in Mathematica

Being functional, and having no "quotation", i.e. essentially treating data and programs semantically same, Mathematica seems naturally capable of doing metaprogramming. But could anyone construct a ...
user13253's user avatar
  • 8,666
44 votes
4 answers

Do people actually use UpValues?

I know what they are and how to define them. They have to serve some purpose - else why include them? But I never used them and all examples on this site and the docs never show a practical use of <...
VF1's user avatar
  • 4,732
36 votes
2 answers

How to save all data in all variables so that loading it is fast?

I've got this CSV file I've imported that has tens of millions of lines in it. It takes around 20 minutes to import. I've been working with it for a while and have the processed data spread out in a ...
Mr Alpha's user avatar
  • 3,156
25 votes
4 answers

Efficient circular buffer?

I wish to create an efficient circular buffer. That is, I wish to keep a fixed length list while appending a new value and dropping the oldest, repeatedly. As we know lists in Mathematica are ...
Mr.Wizard's user avatar
  • 272k
27 votes
2 answers

Populating and storing a very large array in Mathematica

I am using Mathematica 8 to generate a very large multidimensional array of floating-point numbers and then store it in a file. Typical array sizes are 10000 x 50 x 15 x 40, resulting in a 3-4 GB ...
davidsd's user avatar
  • 371
25 votes
3 answers

How to develop an Import/Export converter for Compress[]ed data?

Mathematica has a cross platform data exchange format, WDX. Unfortunately importing or exporting large data from/to WDX is very slow. Using MX files is very fast, but they are not compatible across ...
Szabolcs's user avatar
  • 235k
20 votes
2 answers

How do you deal with very large datasets in Mathematica?

This question is in two related parts. The first is about dataset size, the second data wrangling. Part 1: I've built a naive Bayesian classifier on Mathematica. It uses ...
user avatar
19 votes
2 answers

Dealing with large files

I have a *.dat file in which the contents are basically one giant list: {1,2,3,4} {5,6,7,8} {9,10,11,12} and so on. I'd like to read in the first 500 members { }...
Luap Nalehw's user avatar
7 votes
3 answers

Import data from first/last 100 rows of a file

If one wants import data from the first three rows of a file "", one can use the command Import["",{"Data",{1,2,3},All}]; However, if I ...
user avatar
7 votes
3 answers

Save and call matrices with large output in Mathematica [duplicate]

If we have the large matrix A=RandomReal[{-10, 10}, {1000, 1000}]; and I need it for further calculation, how can I save it on hard disk and then call for ...
George Mills's user avatar

15 30 50 per page