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

learn more… | top users | synonyms (3)

1
vote
2answers
74 views

One to Many Lists Merge

I have two lists: ...
2
votes
1answer
46 views

Compare some lists, if elements are almost equal

I've got the solutions of three systems on two variables (a and b) that gives results sometimes almost equal. The three list are not of equal length! For example: ...
0
votes
1answer
57 views

How to sum 2 tables? [on hold]

this is what we've got: ...
3
votes
1answer
54 views

How can I create a set (list) provide a kind of rule/algorithm?

Example: S = {r ∈ Q : r² < 2} Let S be the set of all rational numbers whose squares are less than 2. It follows that 1 ∈ S, 4/3 ∈ S, but 3/2 doesn't ∈ S because 9/4 ≥ 2. Thank you.
2
votes
3answers
99 views

How to multiply specific columns in a matrix of data?

So I need to make a plot of some ~2000 data points I have from a spreadsheet. I'm able to import the data just fine, it stores it like so sundat ...
0
votes
0answers
107 views

Conceptual understanding of patterns [on hold]

Anyone who uses Mathematica's patterns cannot be left unimpressed by its power. To gain an understanding on how it might be working internally, I thought about the process and came up in fact with ...
3
votes
1answer
54 views

Remove values from list element, and add to other element

Basically what I need is to make a list of 400 elements, all have value 1. The next step is to create a function, that subtracts value (-1) from an element, and adds that to another element. So: ...
9
votes
5answers
689 views

Coalition Games

Suppose an election produces the following result: result = {{"a", 120}, {"b", 80}, {"c", 50}, {"d", 30}}; Letters are parties and numbers seats. To form a ...
4
votes
6answers
622 views

Convert a string into a list of numbers

I got the following problem I don't know how to solve or if it's at all possible to solve(I'm quite new to Mathematica and don't have an IT background, so please explain slowly if possible:)) I'm ...
8
votes
7answers
556 views

Populate an upper triangular matrix from a vector of elements

What is the best way to populate an upper triangular (or alternatively: lower triangular or symmetric) matrix from a vector of elements? This example input: ...
8
votes
3answers
312 views
3
votes
1answer
85 views

Random symmetric matrix

Suppose first that I want to generate a matrix whose elements are i.i.d. with distribution dist. This is easy: ...
37
votes
5answers
2k views

Partitioning with varying partition size

How can I partition a list into partitions whose sizes vary? The length of the $k$'th partition is a function $f(k)$. For example: if $l = \{1, 2, 3, 4, 5, 6\}$ and $f(k) = k$. Then the partitioning ...
31
votes
6answers
2k 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 ...
6
votes
3answers
198 views

How to count number of observations/rows within each group

I have a huge unbalanced panel data. I want to count number of rows within each group. For example, I have the following data: ...
4
votes
3answers
117 views

Combining more than two lists by first column as index

Please bear with me. It might be easy but its been hard for me. I have say three lists: ...
2
votes
2answers
40 views

Column Operation - Subtract part of nested list from part of another nested list [duplicate]

I have two lists with x- and y-coordinates with different z-coordinates of the form {{x0, y0, z0_1}, {x1, y1, z1_1}, ..., {xn, yn, zn_1}} and ...
3
votes
2answers
87 views

Sublists of Random Permutations

What is an efficient way to create a list of (psudo)randomly chosen permutations? I'm trying to create a list like below: ...
1
vote
2answers
54 views

How to append to a list of lists elegantly [duplicate]

I have have list of lists and I would like to be able to append an element to the start of each list. I am sure there must be an elegant solution. EG: a and ...
1
vote
1answer
45 views

ListLinePlot of data imported from an Excel file [duplicate]

This is a continuation of another very similar question about how to plot structured data using ListLinePlot. Here is a sample data imported from an Excel file: ...
0
votes
3answers
97 views

How to manipulate with external data?

I have a .txt file which contains a lot of triples (a, b, c) (one per row) which should be coefficients of my equation ax^2+bx+c=0. I want to include each triple in .nb file and solve each equation. ...
-2
votes
1answer
98 views

How can I produce a list of solutions for a function which is updated with updated variables using for loop?

I need to loop over a set of equations, solving for X and adding the new X value to the old X value at each step. The output I need is a list ...
7
votes
3answers
193 views

Issue with very large lists in Mathematica

I have a need to work with very large arrays of data in Mathematica. The length of the list is not known upfront. The typical size is a few hundred thousands elements and could easily go beyond a ...
6
votes
2answers
245 views

Finding the coefficient of a certain power in a generating function

I want to compute $(t^1+\dots +t^5)(t^2+\dots+ t^6)(t^3+\dots +t^9)$ and find the coefficient of $t^{15}$ for example. $t$ is an indeterminate Now in Maple this is simply as ...
0
votes
2answers
143 views

Indirect transformation based on a list of data points

I have a set of data which describes the Intensity function $Int(q)$ as a function of $q$. The data list provided below provides the shape of $Int(q)$ versus $q$.How can I use this information to ...
1
vote
1answer
106 views

Inverting matrix of unknown size

I have a matrix that has a variable number of columns and rows (but it is always square). The matrix is: $$ \Gamma = \begin{bmatrix} \Theta & 0 & 0 & 0 & T & 0 & R_j \\ ...
3
votes
1answer
68 views

How to efficiently select elements from a Hash?

How can I write an efficient version of the following selection statement: Keys[Select[hash, # < constant &]]; // AbsoluteTiming hash can be made from: ...
3
votes
2answers
79 views

Wrapping Interval Notation for Take

I'm trying to implement the solution to a math problem in Mathematica, but my code can't handle a particular boundary case. I think that I could implement a function that would do what I want it to, ...
10
votes
3answers
164 views

Pick with nested list

I have a list of pairs of values. Some of those pairs are invalid based on another list. I would like to select only the valid pairs. ...
16
votes
4answers
328 views

Make MapIndexed listable

My goal is to apply MapIndexed to every element of a nested list without destroying the arithmetic operations within the elements. For example, let's start with ...
6
votes
3answers
132 views

Mapping a function over the parts of a deeply nested Array

I have two tensors: tensorS = Array[Subscript[s, #1, #2, #3, #4] &, {2, 16, 16, 19}]; tensorR = Array[Subscript[r, #1, #2, #3] &, {2, 16, 19}]; ...
7
votes
4answers
379 views

Is there a way to riffle more than two lists?

I thought Riffle would generalize such that Riffle[{a,b,c},{1,2,3},{x,y,z}] would return ...
2
votes
2answers
77 views

How to make functions from datasets

I have a csv that encodes the results of plugging certain parameters (say, A and B) into certain functions (say, ...
2
votes
1answer
36 views

Manipulating lists with uneven amounts of entries

So I have a list like so list={{a},{b,c},{d,e,f},{g,h}} and the basic logic I want is to be able to manipulate each of the nested lists individually. So If I ...
2
votes
2answers
74 views

Componentwise Addition of TemporalData

I'm a little confused with the TemporalData structure in Mathematica, in the sense that it doesn't seem to behave like a list. What I'd like to do is plot the sum ...
5
votes
1answer
119 views

How to efficiently select element in a list of lists?

How can I write an efficient version of the following statement? Cases[list, {_, feature_} /; feature < constant]; // AbsoluteTiming List is of the form, list ...
6
votes
2answers
203 views

Is there a bug in the Part function of Mathematica 10?

I am using Mathematica 10 now. I typed code below {{1, 2}, {2, 4}, {3, 6}, {4, 8}}[[;; , 1]][[1]] and this gives result 1 ...
3
votes
3answers
149 views

Breaking up combined data into several smaller data sets

I have one combined data with first number as the x-value and the remaining as different y-axis values (y1,y2,y3...). How do I break this combined list, data= (x,y1,y2,y3...) into smaller lists, such ...
1
vote
1answer
88 views
2
votes
1answer
57 views

How to select elements with a specific style of a list?

Suppose I have a list: where 3 'up's of the list are red(I've made it to Cell Expression as follows). ...
3
votes
2answers
192 views

Why does a certain CSV file import properly into LibreOffice but not into Mathematica 10.0?

I'm working on a project involving data manipulation and it involves working with CSV files. I know that the files are properly formatted as when I import them into LibreOffice, all of the columns ...
6
votes
3answers
273 views

How to remove a line of a matrix if not all elements are numeric?

I have a matrix a n columns and m lines. I'd like to efficiently remove the lines that are not entirely composed of numeric ...
1
vote
1answer
48 views

Appending functions to a list [duplicate]

Could someone please explain the difference between these methods, and possibly a nicer way to get the first result? (This is a toy example and in my real program I'd like to use ...
2
votes
3answers
143 views

Alternatives to Append/AppendTo for generating a list in an interactive DynamicModule?

I have a stack of timelapse microscopy images that I am trying to segment frame-by-frame using some of Mathematica's image processing functions. I have created a little interactive DynamicModule with ...
3
votes
2answers
76 views

Is the MaximalBy function still used [closed]

On the mathematica reference website it gives examples using the MaximalBy function, However when I am using it, I see no desired output. This leads me to wonder if mathematica has stopped using this ...
13
votes
8answers
539 views

UnFlatten an array into a ragged matrix

Trying to unflatten an array that was part of ragged array of sub matrices. As input we have flattened array: ...
6
votes
5answers
287 views

Find patterns in a list

again, I have a list like this: ...
7
votes
1answer
294 views

Tuples without self-loop

I have a simple question coincerning the Mathematica function Tuple. Currently, I apply the following code ...
8
votes
5answers
195 views

How to do DateDifference on table items containing dates

I have a Table with data in form {{date}, value}: ...
6
votes
0answers
52 views

Listable compiled functions used in NMinimize

This is an example from MMA: cListable = Compile[{x}, (x-1)^2, RuntimeAttributes -> {Listable}] In case of single entry: ...