Questions on the manipulation of List objects in Mathematica, and the functions used for these manipulations.

learn more… | top users | synonyms (3)

2
votes
1answer
50 views

Conditional clustering of elements

I have a long list like: ...
2
votes
1answer
81 views

MapThread over a nested list

This may be a simple question. Please close it if it is already answered. I have a nested list kr = {{35, 32, 27, 20}, {36, 33, 28, 21}, {37, 34, 29, 22}} I ...
2
votes
2answers
181 views

Plotting data in a weird format

I have a lot of data on the following form: data = {{param1,param2,param3,param4,{{x1,y1},{x2,y2},...,{xn,yn}}},...} The first variables in each sublist are ...
2
votes
3answers
111 views

Plotting lists, exact color values

I read some descriptions of similar problems but I cannot make them work in my example, I don't know why. I have list of 3 dim values to plot: x, ...
2
votes
2answers
72 views

How can I generate a variable-length list of options in PieChart?

I would like to allow a user to manipulate the segments of a pie-chart, which is to be generated from a list of a specific format. The code looks something like the following: ...
2
votes
2answers
117 views

Interpolating a list with exclusion [closed]

I have a list, data, where the elements data[[i]] range over i from ...
2
votes
1answer
101 views

How to make an efficient difference of sets function?

How to write a nice code that removes all elements from given set A, that occur also in set B? I would like to use DeleteCases[] for this purpose, but have no good ...
2
votes
2answers
163 views

How to select elements from a 4D Array?

I am very new to Mathematica (first time!) and I'm already having troubles with arrays. I basically have a 4D tensor, that is a matrix (call it M) which has for ...
2
votes
1answer
122 views

How to extract the bin width from a Histogram made with an automatic binning method?

I am using the Scott binning method with Histogram and Histogram3D to plot some data. How could I find out the bin width chosen ...
2
votes
1answer
130 views

Replace a specified portion of an array with elements from another smaller array

This may be a trivial question, but I have been at it for a couple of hours and I have not made much progress. I have a 10 x 10 array (T) that I have used to generate an 8 x 8 array (Q). I want to ...
2
votes
1answer
126 views

Error in setting matrix elements [duplicate]

Possible Duplicate: How to Set parts of indexed lists? For better organization of my code, sometime I use data objects in the form: ...
2
votes
3answers
214 views

Adding elements in the sublists

How can I add the elements in the sublists? For example, if I have the list which is m={{1,3},{2,3},{4,1}} then, the output that I want is ...
2
votes
3answers
222 views

Taking only particular subsets and doing calculations

I have subsets formed from a list using the Subsets command and want to do a particular calculation, lets say subtraction using the ...
2
votes
1answer
228 views

Conditional Data Selection, efficiency

Building up on the solution proposed here : Simplifying nested If statements You can find here the data set : allGazes.dat ...
2
votes
2answers
115 views
2
votes
2answers
38 views

How to further process a 2 dimensional list created with tuples

I created with Tuples[{{USD, EUR, JPY}, {UP, DOWN}}] the following result: ...
2
votes
2answers
72 views

Adding a tree to a list of trees within a loop [duplicate]

I'm trying to write a function which for a list of trees checks if a given tree is isomorphic with any of the listed, and if not - adds it to the list. I tried to use both ...
2
votes
2answers
43 views

How do I delete items at the same position from every sub-list within a list? [duplicate]

We have data in a list called megadata where megadata[[1]] for instance are the temperatures of each data point, ...
2
votes
2answers
172 views

Delete pairs from a list

I have a data set in which I need to remove all matched pairs of entries - not just the first entry that is duplicated but both entries. To add to the complexity, the pairs must be between different ...
2
votes
1answer
116 views

Deleting selected rows from data table [closed]

I'm an intermediate Mathematica user and the select function presented on Data Table Manipulation in Mathematica: Step 2 was very useful in helping me manipulate a 36Mb data file - 13 columns and 180k ...
2
votes
1answer
44 views

Complement for a Matrix

In a matrix, there are some non-zero elements same as: aA= Also, there is a list such as: list = {a, b, c, d, e, f, g, ii, jj, kk}; I want to access to ...
2
votes
1answer
173 views

Is there a better way to create my rotational-symmetric (180 degrees) rectangles?

I have created a simple way to create rotational-symmetric (180 degrees) rectangles, but my stuffit function bothers me. No matter what I tried, I couldn't get it ...
2
votes
1answer
89 views

Explore a nested list

This question is similar to Numbering nested list according with Depth (or Level) I have a list like ...
2
votes
2answers
128 views

Generating an editable table that can be used as input

Say I have a number $n_{max}$. I want a command to generate a table like 1 1 2 2 3 3 4 4 ... nmax nmax where the second column is editable, and this table can be ...
2
votes
2answers
58 views

Specifying an array with a specific number of copies of two elements

To specify an array of length L in Mathematica, where each entry is someElement, I'm accustomed to writing: ...
2
votes
1answer
69 views

Convert Integer to Numeric with Replacement rules

I have a long list of triples, each looking something like {AGO, 1988, 2345.23}. Some of these, however, have an integer in the third spot, like this: ...
2
votes
2answers
146 views

How to delete all rows in datafile that contain a string

I'm importing some data from a file. However, the file was created by an unreliable instrument, such that the data looks like this: ...
2
votes
1answer
369 views

Newton-Raphson Method and the Van der Waal Equation Coding question

So I need to find Specific Volumes using the Newton Method from the Van der Waal equation over a change of constant Temperature but variant Pressure. I have been able to make a list of however many ...
2
votes
1answer
279 views

Extracting a range of data from a table

I have text file with data in 2 columns. I have imported it using the following line c = Import["ab", "Table"]; This text file has a large amount of data, and I ...
2
votes
1answer
138 views

How to compute a discrete histogram of a list [duplicate]

I'm trying to compute the discrete histogram of a set of values. By histogram I mean the absolute frequency a value appears on the dataset, by discrete I mean the values are from a discrete set, e.g. ...
2
votes
1answer
124 views

Match a sequence of integers

I would to match a pattern p1 = 0,0,1,0,0 to the elements in listA. The elements are a boolean sequence that may look like this ...
2
votes
1answer
112 views

How to make a list/matrix out of an expression?

I would like to make a matrix out out of the following expression: $$ (\Omega^2 (2 d\theta^2 + d\phi^2 - d\phi^2 \cos(2 \theta) \coth(\chi)^2) + (2 d\Omega^2 + (2 d\theta^2 + d\phi^2 - 2 ...
2
votes
1answer
127 views

Plot several lines with different starting points on the x-axis

First of all, I would like to apologize in advance if I don't use the correct terms or if I express myself unclear but I just started to work with Mathematica. I'm simulating electricity prices and ...
2
votes
1answer
694 views

How to solve equations self-consistently

I want to solve the following equation self-consistently. So, H.u = e.u {{1, d}, {d, 1}}.{u1, u2} = e.{u1, u2} I guess an initial value for ...
2
votes
1answer
148 views

writing a function using multiple variables

I am fairly new to Mathematica and am trying to write a function for the equation: xx = [x/(Sqrt[h^2 + d^2 + y^2]))*(Sqrt[h^2 + (d + yy)^2]) where h, d are known ...
2
votes
1answer
176 views

List of different values which have to be formatted differently

I have a large list of values which – for presentation in my LaTeX document – I need to format. For instance: I have calculated growth rates which I now would like to have formatted in the form of: ...
2
votes
4answers
118 views

Backsubstituting solution into FindRoot and Plot

I want to find roots from a transcendental equation using FindRoot as a function of a real parameter and then plot the solutions vs. the parameter. The following commands work perfectly: ...
2
votes
2answers
61 views

Ordered indices of a multiple product or sum

Given a summation like $$\sum_{1 \leq i_1 < i_2 < \dotsc < i_k \leq n} f(i_1, i_2, \dotsc , i_k)$$ how can the lists of indices be enumerated? For example, if $n=4$ then the possible lists ...
2
votes
1answer
149 views

Finding the optimal teams ranking based on the table of match results

My original question was this: So my task is to score all the possible rankings of the 14 SEC football teams and find the best one, using who won in head-to-head games as the sole criterion ...
2
votes
1answer
86 views

Recursion when randomizing elements in a list

I want to randomize certain elements of a list; Since the code list = {a, b, c, d, e, f, g}; list[[{1, 3, 5}]] = RandomSample@list[[{1, 3, 5}]]; list works fine, ...
2
votes
1answer
180 views

What is an elegant way to aggregate two cash flows

When modeling a swap contract a common operation is to sum up two cash flows producing a resulting cashflow with netted amounts in the highest granularity of the two initial cash flows. What is a ...
2
votes
1answer
89 views

Putting values into a grid after iteration process

I'm developing a model of thermodynamic cycle in Mathematica. I wrote several functions, applied them to a list containing starting values and iterated, for the model to converge. ...
2
votes
3answers
91 views

List Manipulation matrices

I have the following two lists: List A: ...
2
votes
1answer
145 views

Coarse-graining and/or sorting of a list of arbitrary triades {x,y,z} in the (x,y) plane [duplicate]

In general my question is related to an approach to make an interpolation of a data which is not on a regular mesh. Another aspect of this question has already been discussed after my question ...
2
votes
2answers
141 views

Modify all the second elements of every pair in a list of pairs

I have a list in the form {{a, 1}, {b, 2}, {c, 3}}. Let's say I want to operate a transformation on all the second elements of each sublist, but this transformation is a function of them all ...
2
votes
1answer
106 views

Expand List Operation

On applying a multiplication and subtraction on a list, like so: x = 2y - 4; Where y is a list containing fractions of complex numbers generated from dynamic ...
2
votes
2answers
246 views

Efficient code for building a big list

I would like replace the following code ...
2
votes
5answers
254 views

Creating ordered triplets from an Excel sheet

I have an Excel sheet of the form: " " a b c 1 R S T 2 U V W 3 X Y Z Where every entry is a number (except the blank quotes, ...
2
votes
1answer
366 views

RowReduce: Solving for the resource vector (a, b, c) in Augmented Matrix

Here are two examples: RowReduce[{{3, 1, a}, {2, 1, b}}] evaluates to {{1, 0, a - b}, {0, 1, -2 a + 3 b}} but ...