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

learn more… | top users | synonyms (5)

0
votes
2answers
103 views

Uniting lists of lists

Here's what I'm trying to do. First a simple example: ...
5
votes
2answers
107 views

Threading sublists on list

Suppose I have a list of the form: list = {a, b, {c, d}, f, {g, h}} i.e. an element of the list could be another list. I want to 'thread' each element of the ...
0
votes
1answer
54 views

Manipulation of imported Datafile

Since I am solving a differential equation in a for loop with NDSolve ...
2
votes
1answer
77 views

Apply function to a part of a list [closed]

Let's say I have some data: data={{a1,b1},{a2,b2},{a3,b3},{a4,b4},...} and I would like to apply the function: f1[x_]=x*5 to ...
2
votes
2answers
48 views

ListPlot of a complex data file

Here are some sample data: ...
6
votes
1answer
116 views

Filters on image vs data

I was using GaussianFilter and realized that applying it to an array yields a different result from applying it to an image. For instance: ...
3
votes
1answer
124 views

Plotting a table with many y values

I'm trying to plot a bifurcation map for a Lorenz System. I have a function (called estables in the code that follows) which, for a certain value r, returns the ...
3
votes
3answers
169 views

Looking for a better way to delete an arbitrary list of rows from a matrix

Delete is not suitable to delete the rows of a matrix, as illustrated below: ...
1
vote
3answers
124 views

Basic Programming in Mathematica - How to build a loop [closed]

I want to build a loop with the following rules: I have a list a={5,7,8,9,5,6,8,6,7,8}. I want to print the mean of the first two ...
12
votes
3answers
231 views

Exclude overlapping lists while keeping disjoint- and sub-lists?

Consider a function f[l1_List,l2_List] which is given lists of integers. Whenever two of the lists contain completely disjoint sets of integers OR one of the lists ...
4
votes
2answers
134 views

Select non-zero elements [duplicate]

I have a function that generates a list of numbers and variables . e.g. F[w]= {wx, wy, 5, 0} I want to select all non-zero elements i.e. ...
2
votes
3answers
146 views

What is an efficient way to pick out consecutive, same first-letter words from a list?

Taking a list of words, I'd like to pick out consecutive words that start with the same letter. The output should be a list of these pairs. The following is relatively slow: ...
0
votes
1answer
51 views

How to get a speicifc element from unknown number of lists?

I have a mathematica function that returns a list of the form: ...
0
votes
0answers
34 views

Append value to list automatically when day changes

I am trying to append values to a list automatically when the day changes, is there a way to do that on mathematica?
2
votes
1answer
48 views

Extract part of list by reading it in a cyclic manner

I have trouble extracting part of a list in a specific order, say, increasingly in a cyclic manner. For example, I have the following list list={0,10,6,-5,-10} ...
0
votes
0answers
36 views
2
votes
1answer
65 views

Why does `Position` by default return a list of lists of positions instead of a simple list of positions?

Position[{1,2,3,4,2,3,4,5},2] (* Output: {{2},{5}} *) Why does Position work this way? I understand this form might be ...
0
votes
0answers
19 views

General question about solving a large set of linear equations efficiently

In my research, I got a large set of linear equations, about 10 000 equations with more than 10 000 variables. It is not efficient to use "Solve", so does anyone know any way to solve the equations in ...
2
votes
3answers
155 views

Selecting lists from lists of lists

I have the following list: points = Tuples[Range[0, 1.25, 0.25], 9] I would like to select only those lists who have the following properties, naming the ...
0
votes
2answers
44 views
7
votes
1answer
108 views

Generalizing LongestCommonSequence to 3 or more arguments?

The function LongestCommonSequence finds a longest common subsequence between 2 lists. Apparently, this built-in function does not accept more than 2 arguments. How ...
0
votes
0answers
46 views
4
votes
2answers
209 views

Flip sign of one variable in list

I have this list of x, y-pairs l={{x1, y1}, {x2, y2}, ...}. Now I need to flip the sign of the y values only before plotting. What is the easiest way to do this ...
3
votes
2answers
124 views

Creating a Random list with constraints

I need something similar to the List below, but not totally random and values within each individual column and row remaining the same: ...
3
votes
1answer
76 views

List of first elements

I have a list whose elements are (symbol or list) and I would like to replace the inner lists by their first elements. I do this ...
4
votes
6answers
427 views

Easiest way to extract the coefficient of a polynomial

For a term in a polynomial, say 387 a1^4 a2^3 x^3 y^7 z^100 w^364 What is the most efficient way to extract the coefficient of this term, i.e. 387?
3
votes
2answers
67 views

How to delete list items that contain a non-numeric Part

A sample of the list looks like this: ...
8
votes
3answers
278 views

Creating new List by comparing 2 lists elements

Suppose I have two Lists (Not equal length). Both contain random numbers between 0 to 5000 (or another max limit): ...
0
votes
2answers
52 views

How do I add the nth element for every line in a text file?

Suppose I have a text file, in this format: ...
0
votes
2answers
81 views

Fitting a Gaussian model to specific section of my list?

I'm analysing some Decay sepctrums for a Nuclear Physics project. I need to fit a gaussian model to a specific X-Ray peak to determine the centroid so I can get a good channel-energy calibration. ...
0
votes
5answers
157 views

How to expand a MxM matrix with replicates of itself and drop some of the rows and cols periodically?

How can I expand a 2d-matrix with dimensions x,x (e.g. mat = {{ 1, 2 }, { 3, 4 }}) with replicates of mat into ...
0
votes
1answer
32 views

Question about loading data by skipping

. It is often important to take data and measurements and give them a name which has a number, and manipulate them in a for loop fashion to manipulate a large data base efficently. The loop above ...
3
votes
1answer
50 views

Returning maxima of multiple sets

I am trying to prove a conjecture which involves the SetParitions[n] function (which requires the Combinatorica package). This function returns a list of all the set partitions of n. I'd like to take ...
4
votes
2answers
169 views
3
votes
0answers
74 views

Mysterious Riffle::rspec warning

I have part of a code that looks like this: ...
1
vote
2answers
109 views

Filtering and summing sublists with Cases

I've declared a list: list = {{1, 2}, {2}, {3, 4, 1}, {5, 4}, {3, 3}, {a, b, c}, {e, f}, {g}, {}, {Sin[a], Cos[b]}}; now I've made an rule which add 2 pairs ...
2
votes
0answers
39 views

How to delete lines containing specific values from a matrix? [closed]

I am doing some numerical computations and a few iterations return values that are obviously incorrect (some numerical integration problem, I suppose.). I have managed to set these values to zero but ...
2
votes
0answers
25 views

Matching list entries by two values, adding the third [duplicate]

I have data in form of: data={{1,1,3},{1,1,6},{2,1,7},{2,2,4},{2,1,1}}; I want to match the entries with the same first two elements and add the third element in ...
1
vote
0answers
44 views

Select and use only one solution in a list solutions [closed]

I would like to use and plot only one of the two solutions of a quadratic equation. In particular this is my equation ...
1
vote
1answer
62 views

How to output the entries of two lists as equal without evaluation? [closed]

Question So, for example, I have the code here: ...
2
votes
1answer
111 views

Alternative for AppendTo [duplicate]

as I'm well aware, using AppendTo for large lists isn't recommended as the function gets progressively slower with each appending done. Lots of suggestions talk ...
1
vote
1answer
91 views

Automatically generate and manipulate variables in Mathematica

First line is just loading data from a txt.file, so that i get two lists {f1,f2,f3,..},{laser1,laser2,laser3,..}. How can I do the same thing as above in just one line? i.e. I have a list of laser ...
1
vote
0answers
40 views

Applying slots, one after another for a list [closed]

For this function: Fun[x_] := 3 x^3 + 4 x^2 - 2 x - 1 I apply Map: D[Fun[x], {x, #}] & /@ Range@3 and I get this ...
1
vote
0answers
83 views

DeleteDuplicates [closed]

After having applied "DeleteDuplicates" to a list of data (15000 rows per 3 columns), when I try to interpolate that list of data it gives me back again: "There are duplicated abscissa points in.." ...
0
votes
1answer
51 views

How To extract data to plot it from a log file

i want to extract out the data (number) from 'geometry step' and 'total energy' in form of list to PlotList[] it. this is the Log file data log Abstract the Total ...
3
votes
5answers
143 views

ListPlot with colors

Let's create some sample data n = 100; d00 = Table[{RandomReal[{-1, 1}], RandomReal[{-4, 4}], RandomReal[{-1, 1}]}, {i, 1, n}]; Now I want the following: create ...
0
votes
1answer
45 views

Export list entries under a certain condition without using loops

I have a big list that contains many 3D- chains (set of points) and for each of them a polynomial. So the structure of my list is for example ...
1
vote
0answers
62 views

Distinguish hashtag # operator when using multiple functions [duplicate]

I would like to do this list = Append[list[[#]],Map[list2[[1, #]] & , list[[#, 4]], {2}]] & /@ Range[Length[list]]; But I would like to substitute ...
1
vote
2answers
44 views

TexForm List with Rule

I'm having some difficulty TexForming a list. The output is not what I want. The following is a minimum working example. I've tried every combination of Flatten, ArrayReshape, and Partition to no ...
1
vote
2answers
74 views

Export many lists without using loops

I have a Mathematica function that creates a RandomWalk chain of length l, by generating random points on the unit sphere and ...