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.

learn more… | top users | synonyms

1
vote
1answer
48 views

How to use Table to assign values to variables in a list?

I'm trying to do the following: R = {a, b, c, d, e, f, g, h, i}; Table[R[[n]] = RandomInteger[{0, 20}], {n, 1, Length[R]}] My intention is to assign a random ...
1
vote
0answers
43 views

Fast construction and reshaping of large tensors

I'm trying to construct a large matrix which is derived from some higher rank tensor (the rank of interest to me changes case by case, so it needs to be a general method). Currently, the process of ...
11
votes
5answers
431 views

TableAlignments -> Left not working

Bug introduced in 7.0 or earlier and persisting through 10.1.0 or later For a very simple dataset TableAlignments->Left does not work: ...
2
votes
1answer
50 views

Why isn't Table iterator value inserted in failed NIntegrate arguments?

Consider this simplest example: Table[{z, NIntegrate[f[x], {x, 0, z}]}, {z, {1}}] Here f is not defined, so ...
1
vote
1answer
75 views

Is there a way to convert a string to a Table indicator? [closed]

I have a list like this: list = {"k1","k2"} I want to use the elements in the list as Table indicators: ...
1
vote
1answer
326 views

Usage of Piecewise/RSolve to solve an equation based on condition

I am trying to compute price of call option on a stock using the finite difference method. I have a VBA code for it, and I am trying to find out how I can use Mathematica memoization functions and ...
0
votes
0answers
24 views

Fibonacci series up to 300 terms [duplicate]

I tried to generate a list of Fibonacci numbers up to 300 terms and gets a runtime error. f[0]=0; f[1]=1; f[x_]:=f[x-1]+f[x-2]; Table[f[x],{x,1,300}] Is there ...
1
vote
2answers
80 views

Slicing multidimensional table

Say I have a multidimensional list created in the following way grid= Table[{i, j+1, k+2}, {i, 0, 1}, {j, 0, 1}, {k, 0, 1}] grid={{{{0, 1, 2}, {0, 1, 3}}, {{0, 2, 2}, {0, 2, 3}}}, {{{1, ...
1
vote
2answers
72 views

Table of ParametricPlots crashes Kernel

I can usually crash the Mathematica Kernel by using Table to generate a List of ...
1
vote
1answer
68 views

Importing Data Issue, Breaking Up Elements

I am trying to import a comma delimited text file as a Table and I am having two issues: First, the file imports all of the numbers that should be separate columns as a single string. This is not ...
0
votes
0answers
92 views

NSolve and Loop - getting error that does not occur with single instance

I am having difficulties getting this code to work. Code: ...
0
votes
0answers
66 views

Matrix iteration failing after second step

I am calculating 11x6 matrix using different logics as in below code. Problem is in Do loop in below code where I have two different criteria to update matrix "fd". I am expecting logic in IF which ...
9
votes
2answers
472 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 ...
3
votes
1answer
243 views

How can I create a colour image using raw black and white data? (FITS data cube)

I have a data cube containing pictures of a galaxy across a thousand wavelengths. I want to take the data for the image slides in the red and blue parts of the spectrum, and have them represented in ...
1
vote
2answers
54 views

How can I manipulate this list?

I performed a loop with Table where I solve a system of 4 equations that depends on two parameters: eta and p. I create two lists for each parameter as follows: ...
1
vote
3answers
57 views

Delete permutations of subtables in a table [closed]

I've got a table of tables: $A=\{\{a,b\},\{b,a\},...,\{a,b,c,d,e\},\{e,d,c,a,b\},...\}$. How do I do to remove backward duplicates, or more generally permutations of duplicates in the table? For ...
0
votes
1answer
39 views

Create a Table depending of two variables [closed]

I tried to create a table depending of two variables as: W= Table[{G[[i]], G[[j]]}, {i, 1, 3}, {j, 1, 3}] I wanted it to look like ...
0
votes
0answers
42 views

RunScheduledTask hide typing data table

I created a task that removes itself when an external variable x,is changed: ...
1
vote
1answer
93 views

Summing terms in Table

I have a table that looks like Table[m, {k, 10}, {j, k}, {i, j}] where, m is a square matrix that depends on the indices $i, ...
24
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: ...
2
votes
2answers
66 views

How to apply list of values to a list of functions

I have the following: first= {1+a,2+a,3+a,4+a} and a list t={0,1,2,3} I want to evaluate the first element of "first" at ...
0
votes
1answer
43 views

Why Table is not giving me the same sequence for eigenvalues of matrix

Let consider a matrix and evaluate the time dependent eigenvalues M[t_]:={{Sin[t],Cos[t]},{t,t*t}}; e1[t_]:= Eigenvalues[M[t]] Now If I evaluate ...
1
vote
1answer
58 views

Data Table Manipulation in Mathematica 10

I would like to select columns from a table by column name. I tried the solution described here: Data Table Manipulation in Mathematica: Step 2 . I am using Mathematica 10. (I would write a comment ...
12
votes
7answers
563 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, ...
1
vote
0answers
22 views

How do I set a PlotStyle when plotting a Table of functions? [duplicate]

I want to plot several functions each with its own color. A MWE is as follows : Plot[{2 x, 3 x}, {x, 0, 1}, PlotStyle -> {Red, Green}] which works fine. Now, ...
2
votes
5answers
125 views

Turning Pascal's Triangle 90 degrees counter clockwise

I have a function that returns a list containing sub-lists that have the numbers for each row in the list. (ex.{{1},{1,1},{1,2,1}}) If I was going to represent it regularly I would use table form and ...
0
votes
1answer
51 views

Using FindRoot in a Table of Iterations [closed]

So I have a tanh curve and a straight line that cross at the point: msol=FindRoot[Tanh[x] == (T/Tc03) x, {x, 1}] This gives me the roots that I need at a certain ...
-1
votes
1answer
45 views

ListLinePlot plots my table, but the table doesn't contain numerical values

I am trying to export a table of data to file, but the code does not appear to be returning numerical data even though ListLinePlot can plot it. Can you please ...
0
votes
0answers
36 views

NDSolveValue:dsvar error in a system of non linear differential equations generated using a Table

I have a system of 4 non-linear differential equation, that I generate using Table command. On solving, I keep getting a dsvar error that is not going away. I debugged my code and figured it has to do ...
1
vote
1answer
29 views

Generation of list of values for small gap among values

I need to run a loop as Table[expr,{i,imin,imax,di}] where I want di to be as small as order of ...
1
vote
1answer
41 views
0
votes
1answer
46 views

Table yields unexpected result [duplicate]

I evaluated Table[#[[i]] &, {i, 1, 5}] and got ...
1
vote
1answer
33 views

Export nested list with complex structure

I have a list that looks like this l = {elem1, elem2, ...} Where elem_={t, {d1,d2,d3} } How can I export it? I tried ...
0
votes
2answers
48 views

Constructing a table from a constraint on another table

I have a 1000X6 table, where in each row the first three columns are dependent on the second three. I then make smaller tables of 1000X2 from these first three columns and basically ...
2
votes
2answers
84 views

how to remove Null's from output? [duplicate]

I'm a math enthusiast and I'm looking for examples of rare divisibilities, let's look at the following one: ...
0
votes
1answer
53 views

How to speed up ReplaceAll in Table?

I am writing a code which solve a list of equations and then create a Table with resulst of equation solving. In applications where I use this code, I create a bunch of equations and my computations ...
0
votes
2answers
69 views

Function that creates a table from two lists

I have two lists shown below: list1 = {(0,0,0,0),(0,0,0,1),(0,0,1,0),...,(1,1,1,1)} list2 = {1,5,5,5,...,5} How can I construct a function that outputs a table similar to this: $$\begin{array}{c|c} ...
0
votes
2answers
50 views
1
vote
2answers
82 views
1
vote
2answers
52 views

Arrange Grid of Table elements horizontally [closed]

I have a Table consisting of an independent variable and two functions. I want to output it like this: ...
0
votes
0answers
69 views

Appending elements to a list in parallel table

Is there any way to store values in a list that is being computed in parallel? For example, if ParallelTable is computing some ...
0
votes
1answer
75 views

Plotting results of a NSolve problem

I am calculating, numerically, the zeros of a determinant. a1 and a2 are constants, q is a parameter. I would like to vary q and find the roots w as a function of q and plot roots w vs. q. All ...
2
votes
1answer
45 views

Export as Table with alignment?

I have a table in Mathematica as a list of lists. How to export the table, and force Mathematica to insert as many spaces as needed between columns so that columns are aligned? For example, ...
0
votes
0answers
79 views

Meshing of a cube

I want to mesh a cube and what I use is ToElementMesh[Cuboid[ {-1, -1, -1}, {1, 1, 1}]]. This creates a regular grid of the cube. Is there a way to specify that ...
0
votes
2answers
114 views

How to generate logarithmic/ Trigonometric tables in mathematica

I was looking for ways to create logarithmic / trigonometric tables in Mathematica. And printing them for use . Here the tables should be like standard log tables with mean differences column . I ...
1
vote
0answers
17 views

How to specify alignment of columns when exporting a table using Export, and how to use spaces instead of tabs?

I have a table in list representation. How can I export it, specifying that some columns must be right-aligned and others left-aligned? Morevoer, columns should be space-separated (with an appropriate ...
0
votes
1answer
74 views

How to sample only odd numbers in the domain of a table for list plot [closed]

The following code samples $k$ points around a circle at integer values starting from $0$: ListPlot[Table[{2 Sin[(2*y/x)*π*n] , 2 Cos[(2*y/x)*π*n}], {n, 0, k}] I ...
1
vote
0answers
65 views

Problem with ParallelTable?

I am trying to numerically solve Bloch equations using Euler's method. My code is the following ...