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

learn more… | top users | synonyms (5)

2
votes
1answer
83 views

TakeWhile for nested list

I have a nested list of time and position for multiple particles over multiple time steps. I want to cut all the time steps off (for each particle) after which the $z$ coordinate goes above a certain ...
2
votes
2answers
98 views

How to transform data in character form into a sensible form?

I have a data output from a device in a form of a string. I need to transform it into such a form that I can work with it, such as plot columns with respect to one another and such. After a apply <...
2
votes
1answer
81 views

Merge two matrices where one may be empty

In a loop, I want to merge two matrices A and B where B is sometime empty. Example: ...
2
votes
2answers
50 views

Join data imported in different variables [closed]

I've imported data from Excel into several variables and I would like to join all data in one "big" variable. I seem to have a problem when one variable contains numerical data... ...
2
votes
1answer
116 views
2
votes
1answer
139 views

Grouping large dataset across a large range of values

I have a large data set that I would like to group based upon the quantiles of one specific column. My test data set is about 2.1 million rows by 9 columns (the actual data set will be much larger). I'...
2
votes
1answer
59 views

How to show steps of “For” command

I wrote the command: list = RandomInteger[{0, 10}, {9, 3}]; For[i = 1, i <= m, i++, element=Total[ list[[i]] ] ] How can I make every step visible? If I ...
2
votes
1answer
56 views

Transformation syntax with shortcuts to a more explicit syntax for an equation

I would like to write the following code line without the signs @#%^&*?! Sequence @@ (XMLNote[#1, m] &) /@ attributes I have made this code but it seems ...
2
votes
1answer
111 views

How to loop in a nested Association?

Considering we have an Association: ...
2
votes
3answers
111 views

Shorthand to write repetitive test in mathematica

I have the following set of Mathematica statements: ...
2
votes
2answers
172 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 ...
2
votes
1answer
72 views

Listing all values in an array

I am trying to populate an array variable using a do loop as follows Do[rayseg[1, i] = i, {i, 1, 5, 1}] This does what I want it to do, however I want to be able ...
2
votes
1answer
94 views

Displaying a list in form of an upside down pyramid graphic

I was wondering how to display a list like this: list={{0,1,1,0},{1,0,1},{1,1},{0}} in form of an upside down pyramid, that is the first element of the list is ...
2
votes
2answers
318 views

How to delete certain unwanted elements from an array

Suppose I have an array like so array1 = {{Null,2,3,4,5}, {a,b,c,Null,e}, {w,x,Null,y,z}} Is there some way to selectively remove any element I ...
2
votes
2answers
66 views

replace an interval of values [duplicate]

I want to replace values in an interval [a,b] by 0 in a list of values. Example: {{.5,.2,.49,1,1},{.49,.5,.495,1}} I want to get: ...
2
votes
3answers
85 views

How to get an element of a list , which is computed out of substituted variables?

What is the best way to get the element of a list, which is computed out of substituded variables? For example one wants to get the first element of the first row of ...
2
votes
3answers
132 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 ...
2
votes
4answers
281 views

Import xls data with dates

I have an excel table that have 2 columns, the first one are dates, and the second one are values. I want to plot the value vs the date. I need to: first clean all the non numbers strings like {"Junio"...
2
votes
2answers
159 views

Map 2 list to a function

Im playing around with CountryData and I want to pass it 2 lists as argument, listCountries = {...} and ...
2
votes
2answers
118 views

Extracting “records” from a matrix

From a rank 3 matrix like ...
2
votes
1answer
386 views

How to define a list that contains all primes less than x?

how can I define my own list in which I have all primes less than x?
2
votes
1answer
234 views

What is wrong with setting one list to another within function? [duplicate]

I have built a function which carries out a set of operations given two parameters. The function looks as follows: ...
2
votes
1answer
111 views

Restoring the 1-to-1 correspondence between elements in two lists, where one list is used as a guide to prune elements from the other

when we wish to use one list to select items from another using something like Pick, writing the following code, for example, causes us to lose the 1-to-1 ...
2
votes
2answers
198 views

adding vectors of unequal length [duplicate]

If I have hundreds of vectors of unequal length that I need to sum, what is the cleanest way to do so? So, if I have as input inp={{a,b,c,d},{e,f,g},{h}} I want ...
2
votes
1answer
70 views

Conditional clustering of elements

I have a long list like: ...
2
votes
1answer
115 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
192 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
2answers
241 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
237 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
139 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
235 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
251 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
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 ...
2
votes
1answer
108 views
2
votes
1answer
34 views

Encoding/Decoding matrices as integers, integers as matrices [closed]

I want to convert large binary matrices of m x n dimensions into integers, and then to convert these integers to the original matrices. I attempted the following: ...
2
votes
2answers
60 views

Remove an element of a list [duplicate]

I want to check if any element of a list contains Missing["NotAvailable"] If so I want to delete the entire list. If I am correct I need to have some ...
2
votes
1answer
113 views

Interpolation of a multivariate function with duplicated 2D abscissa points

I want to interpolate a function q[a,b] I have a data file which has the form {a,b,q} a sample is following ...
2
votes
1answer
115 views

Explicit Contraction of Tensor Indices [duplicate]

Is there any easy way to explicitly contract indices of several given tensors. For example, ...
2
votes
1answer
40 views

Sort List by first term in case and select cases which certain number in the first term

Suppose I have the following list: list = {{1,3.4},{2,6.7},{3,0},{1,2},{2,8.6},{3,7.9},{1,0},{2,7.8},{3,5}}; I will like to sort the list by the first term in ...
2
votes
1answer
55 views

If I want a function only applies to the elements of a specific list, how should I define the function? [closed]

If I define a list: list={1,2,3,4}; and I want a function f to apply only to the elements in the list (for here it is 1,2,3,4)...
2
votes
2answers
61 views

Reflect manipulations on one list in a second list

I'd like to mirror the manipulations (specifically deletion, insertion, and reassignment) done at each position of two equally-sized lists, based on the contents of only one of those lists. As an ...
2
votes
1answer
108 views

How to take every second element [duplicate]

If I have {1,2,3,4,5,6}, how do I take all the second elements into a new list? So I want a list like {2,4,6}.
2
votes
1answer
62 views

Table: calculate the intermediate variable but not list them

I want to list {a,c} but c is depend on b, suppose the dependence on ...
2
votes
1answer
71 views

Having trouble modifying entry in a list

Hi, I am trying to create a small repository by entering three things as a list of string, namely the asp, sequence and description. The trouble that I am facing is that while I am manually running ...
2
votes
1answer
118 views

Need Help Writing code to find Capparelli Partitions

I am trying to add multiple criterion to IntegerPartitions[n] so that it sorts only partitions that fit the criterion. It creates a list of list of numbers in ...
2
votes
1answer
150 views

Sum over multiple indices that take specific values

Pretty simple question: how do I sum over multiple indices that can only take specific values all together? To clarify: let's say I have the following sum: $\sum p_{a,b,c} f(a,b,c)$ where $f$ is a ...
2
votes
1answer
96 views

Problem with plotting data (.csv)

I have a problem with plotting the data of a recent experiment. I'm quite new to Mathematica, but searched the documentation and forums without solving my issue. My data is stored in a .csv document, ...
2
votes
1answer
93 views

Part specification error with InterpolatingFunction when generating a Markov Modulated Poisson Process

I want to create a Markov Modulated Poisson Process, where the arrival rates created by the states of a ContinuousMarkovProcess are fed into an ...
2
votes
1answer
77 views

how to manipulate indices in a table/vector

Perhaps I'm missing something very basic. Could somebody guide me how to manipulate indices of a list. For example, if I have ...