We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [table]

Questions on the use of the Table[] command and other functionality related to lists. Use [tag:matrix] for matrix algebra and related methods, and [tag:list-manipulation] for questions about transforming or operating on existing lists.

Filter by
Sorted by
Tagged with
42
votes
6answers
3k views

How to visualize/edit a big matrix as a table?

Is it possible to visualize/edit a big matrix as a table ? I often end up exporting/copying big tables to Excel for seeing them, but I would prefer to stay in Mathematica and have a similar view as in ...
29
votes
3answers
2k views

Generating 250 random points crashes the kernel, but not 249

Fixed in 10.1.0. Consider the following function, which generates uniformly random points on the surface of the 2-sphere: ...
23
votes
2answers
892 views

Unexpected behaviour from Table[]

The following code in Mathematica 11: iList = {i, -10, 10, 2}; Table[i, iList] produces this result: {i, i, i, i} Where in ...
21
votes
5answers
2k views

Instruct a Table to only evaluate until a condition is fulfilled

I am looking for the way of building a Table of pairs of numbers in a fast way. My true table evaluates huge functions, and I see no way and reason to show those cumbersome expressions here. Let us ...
20
votes
3answers
2k views

WYSIWYG table creating and editing

In Microsoft Office OneNote 2010, creating and editing tables is easy. There are simple toolbar controls for creating tables: , and editing them once they exist: . My question is, what's an easy ...
19
votes
17answers
7k views

Generating a list of numbers that are not multiples of 4

I want to write simple code that will list all numbers from $1$ to $n$ that are not multiples of $4$. And in this case I consider that ...
19
votes
6answers
2k views

Display 10^n as power

How can I tell MMA to display input of the form 10^n as $10^n$ and not e.g. as 1000 for $n = 3$ or the rational $\frac{1}{1000}$ for $n = -3$. This would help to ...
19
votes
2answers
1k views

How to add lines in TableForm

...
18
votes
6answers
6k views

Multiplying two dimensional data by a constant

I have a list of lists of the form: {{1, 2}, {2, 4}, {2, 8}} But I want to multiply only the second dimension of that data by a constant. I know I could do this ...
18
votes
1answer
596 views

Strange behavior of Table

Whenever I run the code a = 0; code := (a++); Table[code; a, {1000}] I get a list of 1000 zeros. However, if I replace 1000 with 100, then a get a list equal to ...
16
votes
6answers
1k views

Calling Table with custom iterator

I often find myself in situations where I, for example, need to build a table for some expression, but want to set the number of points rather then the step size, so the code ends up looking like this ...
14
votes
7answers
787 views

How to properly inject iterators into table? [duplicate]

Goofing off on a prior question, I was fiddling with other methods, which led me to the need to inject a constructed set of iterators into a table construct. Now, ...
14
votes
3answers
5k views

Table of Variables

I use a list of variables {x1, x2, x3} to Solve a particular set of equations. I am now trying to generalise this depending on ...
13
votes
2answers
376 views

Map vs. Table for index-specific operations on 2D arrays

Many experienced users on this site tend to use Map (and its variants, MapAt, MapIndexed, etc.) rather than Table. When applying the same operation to every element of an array, Map does seem more ...
13
votes
2answers
386 views

How to build a list of elements satisfying a certain property without building a list of all elements first?

Is there a way to directly build a list of elements that satisfy a certain property? More precisely, I am looking for a function IncludeIf (this is a placeholder ...
13
votes
2answers
2k views

Is there a Break[] equivalent for short-circuiting in Table?

I am running Mathematica 7. The following is admittedly a silly example, but suppose that I have a list list whose entries are either ...
13
votes
1answer
150 views

Can't make more than 249 Internal`Bags in a Table

I need a lot of Internal`Bags so I made them with Table. It works fine for 249 or fewer Bags...
13
votes
3answers
1k views

Fast way to export large amount of data in “Table” format

I have about a million 3D points, say data = Table[{1. x, 1. y, 0.}, {x, 1000}, {y, 10^3}]~Flatten~1; I want to visualize them, but ...
12
votes
5answers
557 views

TableAlignments -> Left not working

Bug introduced in 7.0 or earlier and persisting through 11.0.1 or later For a very simple dataset TableAlignments->Left does not work: ...
12
votes
2answers
7k views

Is there a Mathematica equivalent to MATLAB's logspace? [duplicate]

Possible Duplicate: How can I get exactly 5 logarithmic divisions of an interval? I want to use Table to generate a list of items, but want the indices to be ...
11
votes
4answers
450 views

Display a list or array as a centred triangle

How can I get Mma to display an array like {{2, 1, 0, 0}, {1, 0, 0}, {0, 0}, {0}} as an upside down triangle where the first row is the base and the last row is the tip, with each row centred ...
11
votes
3answers
852 views

Best way to handle nested Maps?

I often find myself working with lists of lists of data, gathering data, performing computations, and producing a variety of different sorts of output. Intuitively, it seems like this should be done ...
11
votes
1answer
188 views

What is the best way to use errors in mathematica M12?

Since ErrorListPlot has been superseded by new functionality in ListPlot for Mathematica 12.0, what is the best way to handle ...
11
votes
4answers
182 views

Specialized form of Outer[f, list, list] for symmetric f

Consider a function f that is symmetric with regard to its two arguments i.e. f[x,y] == f[y,x]. Using ...
11
votes
2answers
207 views

How to correctly implement in a new function the scoping behavior of Table, Sum and other commands that use Block to localize iterators?

It is documented that "Block is automatically used to localize values of iterators in iteration constructs such as Do, Sum, and Table." Therefore the dummy index (iterator) in a Sum is shielded ...
10
votes
5answers
1k views

Relational joining of tables

A common thing to want to do with data is to combine it (at least I thought this was a common thing). In SQL there is the idea of table joins "select id,v1,v2 from A,B where A.id=B.id" kind of thing. ...
9
votes
3answers
837 views

How do I avoid scoping collisions of iterator variables?

Yesterday I had an issue that kept for quite a while. My code wasn't producing the right results. Now I know why and I am wondering how to avoid the issue in future. Consider the following code. <...
9
votes
2answers
317 views

Correct way to generate large data sets (i.e.forward yield curve )

I would like to generate a set of forward yield curve matrix of size 1000 x 100. First I defined my SparseArray of 1000 x100: ...
9
votes
1answer
1k views

Smoothing out data points in a ListDensityPlot

I stumbled upon this problem when I was trying to make some nice smooth ListDensityPlots of my numerical data. In short, my problem is that I let Mathematica plot two copies of basically the exact ...
9
votes
1answer
236 views

TeXForm: Adding color

Background & Question So if you're reading this you probably think Mathematica is pretty great - at least I do. The function Table by itself take someone ...
9
votes
1answer
114 views

How to implement a resumable Table?

Motivation (my sob stories) Too many times I've run a notebook for hours and then Mathematica crashes (FE or Kernel, mostly FE) and things are lost. I've made various attempts at custom solutions ...
8
votes
3answers
8k views

Importing multiple files using a for-loop

once again I am stuck solving a seemingly easy problem :( I would like to make a List of tables by importing data from several txt-Files. Importing the data into a table works so far and I am able to ...
8
votes
4answers
4k views

How can I format a table to look nice?

I have this code, but I would like to see the results well formatted. How can I obtain a well formatted data with alignment similar to this one? Instead, I obtain the result you see here (click to ...
8
votes
2answers
1k views

Why does a table with a defined constant in its index compute 10X slower?

I need to do some iterative summations. Here is a minimum working example: ...
8
votes
3answers
5k views

How to make a table from two lists?

I have two lists. ...
8
votes
4answers
768 views

How best to join tables, which have different lengths on the same column values which exist in both tables?

I think my problem is pretty simple, and in SQL this would be trivial. I have two tables ...
8
votes
4answers
333 views

Optimising Table wrapping over a Select

Suppose we have the following lists: ...
8
votes
1answer
1k views

Why is building a table of function values so much slower than just plotting the function?

Here is a function that take some time to evaluate: n = 1000; coeffs = RandomVariate[NormalDistribution[], n]; f[x_] := Sum[coeffs[[k]] Sin[k x]/k, {k, 1, n}]; ...
8
votes
1answer
338 views

What is the most straightforward solution to save integers right aligned into a text file?

As an example I have a data list of dimension {10, 5}: ...
8
votes
1answer
300 views

Export bug in combination with ParallelTable?

I am programming with Mathematica 10.3.1.0 on Windows 10 Professional 64 Bit and have an i7-4940-MX 3,1 GHz processor (4 cores). When I use in the example code below ...
7
votes
1answer
2k views

Suppress warnings in ParallelTable

I'm using ParallelTable to evaluate a function that involves NIntegrate. There are a lot of ...
7
votes
2answers
1k views

Merging two Lists

I have two tables. One is given by T1 = Table[{x, y, 0.}, {x, 0, V},{y, 0, V}] and from a calculation I have the second, a list of points {x, y, z} ...
7
votes
2answers
369 views

Formatting a table to look nice

my current code is: ...
7
votes
2answers
415 views

Can Mathematica Take Advantage Of a AMD Ryzen Threadripper 2990wx 32 Core Processor?

I have a student version of Mathematica. I'm currently running it on my 8 Core Desktop. On my current Desktop I use it for Numerically integrating expressions 1000s of times, the ParallelTable ...
7
votes
2answers
224 views

Grouping the list of numbers that have common.

I am working on some simple problem. It is like puzzle.. Let's say I have some list input={{1,1},{1,2},{1,3},{2,3},{3,3},{4,4}} Which means 1 can go and back to ...
7
votes
1answer
201 views

Why does Table behave differently in Mathematica compared to WolframCloud?

In Stephen Wolfram's elementary introduction to the wolfram language it says you can use the table function like this: Table[5, 10], to create a table of the ...
7
votes
1answer
275 views

How to make a table with a jump in range?

I'd like to use Table to generate a list of numbers that includes a gap. For instance, this accomplishes what I want: ...
7
votes
1answer
127 views

Combine `Table` with `Riffle`

I have table of function f[x,a]. For the sake of easy reproduction, let's limit it to a few entries - the original is over ...
7
votes
1answer
113 views

Good practice when working with multiple solutions of a system of equations

I have a system of nonlinear equations. I want to do some comparative statistics and I want to plot the results from the statistical computations. I have two questions about good practice on ...
6
votes
5answers
314 views

How to make a table of $\sum_{i=1}^n$?

I want to create a table of $\displaystyle \sum_{i=1}^n i^k$ for $1\le k\le 5$. The output I want to obtain is a TeXForm output as follows. \begin{align} \sum_{i=...