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

learn more… | top users | synonyms (3)

1
vote
1answer
27 views

Find maxima and minima of data like {time,value}

I have a list of time and values of the charge and discharge of a capacitor, and i want to separate in two list of {time,value of charge} , {time, value of discharge} I know there is a lot of the ...
11
votes
5answers
499 views

Permutations[Range[12]] produces an error instead of a list

This input: Permutations[Range[12]] Results in this (error) output: ...
18
votes
4answers
4k views

Finding Local Minima / Maxima in Noisy Data

I'm trying to find local minima / maxima in noisy data, consisting of data values taken at certain time intervals. Ideally, the function should take a pair of lists (one containing time values and one ...
2
votes
4answers
207 views

Get 'new' list of data by manipulation 'old' list

Assume I have the the following list of data: valuesOld = {5, 10, 15, 20, 25, 35, 40, 45, 55, 65, 80}; I would like to construct the following list: ...
3
votes
1answer
200 views

Indexing of Large Autonomous System of Equations for Use in NDSolve

I currently have a list of ~150 autonomous ODE's that I need to be able to work with using NDSolve. Fortunately I already have them formatted in plaintext, which ...
14
votes
12answers
516 views

Join lists with nested list

Is there a way of smarter way of joining list of the form l1 = {a,{b,c}}; l2 = {d,{e,f}}; l3 = {g,{h,i}}; To obtain ...
1
vote
3answers
71 views

Remove all “not equal” clauses from an expression

I am banging my head against the following question: how can I have Mathematica take cond = 2 a >= 3 b && 70 a >= 19 && 20 a != 13; and ...
12
votes
7answers
469 views
1
vote
1answer
97 views

references in a nested matrix

I have a nested matrix n: ...
0
votes
1answer
78 views

Creating and handling really large matrices [on hold]

I use Mathematica for a long-time to program physics simulation and I love Mathematicas programming style, but recently I am using fortran because it can do my calculations faster. I am doing some ...
3
votes
3answers
225 views

Faster Integer Approximation of pi

I'd like to speed up this calculation: First[Sort[Table[{k,Abs[Round[k/Pi]Pi - k]1.{k,1,100000}],#1[[2]]<#2[[2]] &]] The code above generates a list of ...
2
votes
1answer
56 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 ...
4
votes
5answers
123 views

getting at the right parts of a list

I have a way to solve my problem, but it seems like there should be something better. Also I realize that I probably don't have a good enough handle on how to get at parts of lists the way I need to. ...
6
votes
3answers
143 views

Remove Successive Duplicate From A Large List (200k by 4 matrix)

I am interested in removing successive duplicate rows from a very large list (~200k rows by 4 columns) using Mathematica.The built-in 'DeleteDuplicates' seems to remove all duplicates, I am interested ...
0
votes
0answers
50 views

ListPlot and ListLinePlot, show nothing, how can I plot correctly? [closed]

I'm trying to plot a graphic using a list of pairs, i.e., {{x1,y1},...,{xn,yn}} but nothing appears in mathematica notebook. I used the following commands and list: Does anyone can help me please, ...
0
votes
0answers
41 views

Convergence Problem using FindFit

I have the following input where there is a convergence problem in the FindFit as shown in the attached figure.The figure shows 2 plots: one of the real data and the other of the fitted line. Any ...
0
votes
0answers
61 views

list numbering problem

I have a list that is generated from a unparsed matrix, and another list that is generated by a parsed matrix. However, since the second one is parsed, the numbering of the elements in the list have ...
2
votes
2answers
45 views

parsing a list or vector

I have a table of elements that generate a list q[i_]=i; B=Table[q[i],{i,1,50}] I would like to parse the list meaning, take the first 10 elements, then take ...
0
votes
0answers
36 views

Not getting proper x-values in a ListPlot [closed]

I have a table of data points to be subtracted by another table of data points. I have succeeded in subtracting the y values of each data point successfully, but it is the x values of each data point ...
5
votes
3answers
232 views

Element-wise list operation on list of lists [closed]

Suppose a function F operates on list A: $$A=\{a_1, a_2,\cdots, a_n\}$$ I have a list of lists, B: $$B=\{A_1, A_2,\cdots,A_m\}$$ Is there a syntax to specify that F should operate on members of B, ...
3
votes
2answers
45 views

Read off entries of UndirectedEdge [closed]

Suppose I have an undirected edge e=UndirectedEdge[a,b]. How do I extract one of the entries a,b of e? I tried accessing e like a list, but that didn't work (...
3
votes
2answers
121 views

How to define even permutations correctly?

I define even permutations as following, but there may be some error. I use it in two different way and get different output. ...
8
votes
2answers
156 views

How to partition a list according to a value in the list

I have a list of the form $\{\{d_1,c_1\},\{d_2,c_2\},\ldots,\{d_n,c_n\}\}$. The values c_i take values between $1,\ldots,k$. I want to partition the data into $k$ lists according to the values $c_i$. ...
6
votes
4answers
271 views

How do I find the number of countries that have a type of industry?

I am trying to find the number of countries that have a certain type of industry. Currently, I have this code: ...
4
votes
2answers
100 views

Sorting out atom types in an XYZ file

I am trying to rewrite the output of "VertexCoordinates" such that instead of a hybrid list of atoms and coordinates that result from using the following input program, I want all coordinates of the ...
9
votes
6answers
235 views

Is there a better way to add a “key” for the list of GatherBy?

In ruby , 1.upto(10).to_a.group_by{|x| x%3} gives {1=>[1, 4, 7, 10], 2=>[2, 5, 8], 0=>[3, 6, 9]} I would like use ...
1
vote
1answer
221 views

Frequency of elements in a list (merging tally data) [duplicate]

I've got a list in the format of list={{a,1},{a,1},{b,1},{c,1},{b,1}} And I want it to "compress" into a list of pairs ...
3
votes
3answers
101 views

Working with calculations that depend on the previous value in a list

I'm trying to make calculations on a list that depend on the previous value. In my case I'm doing event detection - detecting the point where a value rises above some threshold for the first time ...
3
votes
4answers
154 views
4
votes
0answers
182 views

Strange behavior of undocumented RawArray and ArrayObject expressions

I discovered several strange results and inconsistencies while trying to understand what undocumented RawArray and ArrayObject ...
2
votes
1answer
51 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: ...
3
votes
1answer
59 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
108 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 ...
3
votes
1answer
61 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
701 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 ...
5
votes
6answers
666 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
563 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
4
votes
1answer
91 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
204 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
123 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
42 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
99 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
100 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 ...