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

learn more… | top users | synonyms (5)

6
votes
3answers
585 views

Preparing data for making an ErrorListPlot

I often have the following notebook in Mathematica, which I use to make a dataset and associated errors: ...
4
votes
2answers
381 views

Colors associated to parts of a 3D distribution of points

Suppose we have a long list of random points (in Cartesian coordinates) in 3D space. coords := ...; Until now, I was associating colors in a radial way, from the ...
15
votes
4answers
492 views

Reproducing a ranking function that behaves like Excel's RANK

I tried to find a function or expression in Mathematica that produces the same output as the RANK function in Excel (see its description here), but unfortunately I ...
1
vote
2answers
55 views

Creating Association [duplicate]

I have provided a dataset bellow and I would like to store the data as an Association that I can query. Such that e.g. ...
1
vote
1answer
44 views

changing intervals in do loops

I have a main program whose structure has Do loop and changing that to Table form is not easy at this stage. I want to have ...
0
votes
1answer
31 views

Conflict in deleting because of some digits [closed]

I have a list at 3dplot and I want to have a list the second element of which be equal to 0.2 ...
0
votes
1answer
45 views

Mapping StringToDouble over nested lists of strings, still confused about slots

This is a simple question about slots but I still cant see how to do it after searching stackexchange. (I'm importing a large data file as text and to convert to numbers I think it'll be quicker to ...
14
votes
2answers
247 views

`Part` like `Delete`: How to delete list of columns or arbitrarily deeper levels [duplicate]

On trying to write this answer I reached the frustrating realization that I didn't have an efficient way to delete a list of columns or deeper level components in a simple way as ...
4
votes
2answers
222 views

Elegant way to partition list to be faster than `ParallelTable` (using `ParallelSubmit`), or some alternative?

Suppose you have a function fun[x_] := (Pause[.05*x]; x^2); of which you know that its evaluation time increases with its argument - in this case obviously ...
9
votes
5answers
201 views

Transpose two uneven lists [duplicate]

I am trying to plot two lists using the ListPlot command. I need to merge two lists. The two lists I have are: ...
5
votes
2answers
560 views

From a list of dates, get a list of the last date available in each month

I wondered if anyone has another or even a more direct way of finding the last dates of each month available from a list of successive dates? I currently do the following (note: nothing special about ...
0
votes
1answer
51 views

Number of points of a polygon [closed]

Hi I have the following polygon: a = {{{-105.5, 842.}, {-105.5, 496.464}, {1.4375, 519.379}, {28.5, 528.271}, {28.5, 655.25}, {3.6, 842.}}} I want to count ...
11
votes
1answer
98 views

Speed up Dynamic for graphical interface

I am trying to create a user interface where I can click on certain points in a set of data and save them into a list that can be used later in my code. The problem is it is currently sluggish. Is ...
3
votes
1answer
62 views

How can I get the arguments of the function Graph?

If I have f0 = f[x,y,z] and I am interested in the list of the arguments, what I do is ...
9
votes
3answers
295 views

Implementation of a matrix formula

For the Bézier surface, which owns the following matrix definition: $$\begin{align*} S(u,v)&=\sum_{i=0}^m \sum_{j=0}^n P_{i,j} B_{m,i}(u) B_{n,j}(v)\\ &=\small ...
3
votes
2answers
38 views

Setting initial conditions of a domain grid?

So I'm writing some code to try and produce a cellular automaton which will model an oscillatory chemical reaction, but I'm trying to set up the initial conditions of the grid so that I can vary them ...
3
votes
0answers
56 views
3
votes
2answers
81 views

Problem with Custom Sort/Split/Gather

Please help me Sort/Split/Gather/Group(by) a set of symbolic expressions! (extreme TL;DR at bottom) I have a set of symbols (which represent 2-vectors in a plane, ultimately) and I want to ...
-1
votes
1answer
330 views

Efficient Table Generation & NDSolve Error

I'm currently working on solving an SEIR model with data from the CDC. I've created a function to calculate the Square difference for the model and want to create a table of values for the 4 variable ...
4
votes
1answer
107 views

Trim a list of elements [closed]

I suppose this is a trivial question to many of you, please bear with me. I have a long list of words, list1. I would like to "remove all words that contain a specific letter, say "o". ...
9
votes
4answers
243 views

How to convert a sparse matrix to a list of sparse arrays?

I have a matrix stored as a SparseArray. How can I convert it to a List of its rows, where each row is stored as a ...
7
votes
2answers
162 views

Threading elements over corresponding elements in the second list

I often need to merge two lists like the following: $A=\{\{0.1\},\{0.2\},\ldots,\{1\}\}$ $B=\{\{x_1\},\{x_{21},x_{22},x_{23}\},\{x_{31},x_{32},x_{33}\},\ldots,x_N\}$ in a way to ideally obtain a ...
4
votes
2answers
198 views

Replacing numbers of which you only know certain digits

If I have a list of numbers like this: list = {0.3565127, 0.8656421, 0.231479879, 0.39698787, 0.536987651}, which are all between 0 and 1, each having lots of ...
1
vote
2answers
72 views

Is it possible to draw a line on a MatrixPlot that would reflect density of row values? [closed]

I have a MatrixPlot with some data and I'd like to draw a vertical lines representing the "average" (density) of that data for each row. Something like this for ...
7
votes
2answers
114 views

Deleting certain elements from a nested list

I have a nested list of the form {{{{a, 0},{b, 1},{c, 2}}, {{d, 4},{e, 5},{f, 6}}} ... } where the $...$ just means it goes on like that. On the innermost level, ...
2
votes
2answers
108 views

Implementing an affine cipher

I am trying to create functions for encoding and decoding an affine cipher in Mathematica. I have written these two functions: ...
3
votes
2answers
91 views

Get position in list of the first element with a certain property

Consider a toy list l = {x[2],x[32],x[43],x[56],x[72]}; I would like to find the position of the first element within this list, for which ...
2
votes
2answers
335 views

How to optimize this code?

I am implementing a code that works correctly but it takes too much time. I did not see how to optimize it to be run quickly. Here is my code: ...
1
vote
5answers
275 views

How to repeat a matrix on it's side?

I have the following matrix in Mathematica: mat = {{0,0,1,1}, {0,1,0,1}} I want to repeat this matrix N number of times on the side. For example if N = 3 then ...
8
votes
1answer
185 views

Taking one list Mod a second list

Just on my free trial and can't find this anywhere in online docs. Trying to use the Mod function as follows: Mod[{list},{list}} where it takes each number in list ...
4
votes
0answers
101 views

Bug in ListLinePlot[] when Filling up and down?

I'm trying to understand this apparently incorrect Filling behavior in ListLinePlot[]. Evaluating this ...
11
votes
1answer
153 views

Is there is a design problem or documentation problem with FirstCase?

In version 10 the new function FirstCase can take up to 4 arguments (plus option). The third argument is a default value to be returned if there is no match: ...
3
votes
1answer
87 views

How do I convert Subscript[{4, 5, 1}, 7] to the integer 4*1 + 5*7 + 1*7^2 = 88?

I am working with the finite fields package in Mathematica 9. If I input: GF[7, {-2, 0, 0, 1}][{3, 4, 1}]^2 Mathematica gives me $\{4,5,1\}_7$. I want to ...
1
vote
1answer
55 views

Fast arithmetic on matrix elements

I have a square matrix $U$ of dimension $L\times L$, I am interested in the following quantity $U_{1,j}U_{2,k}U_{3,l}U_{4,m}\cdots U_{L,q}$ summed over all permutations of the letter indices, ...
6
votes
2answers
122 views

How to map a function over 2 lists? [Syntactic Analysis]

I have two lists words = {"the", "man", "hit", "the", "table"} grammarTerminal = {{N,"man"},{N,"woman"},{N,"table"},{D,"the"},{D,"a"},{V,"hit"}} and a ...
6
votes
2answers
3k views

Is it possible to compute with the trapezoidal rule by numerical integration?

Is it possible to compute trapezoidal rule numerical integration? I know that Mathematica has Interpolation, and that a list of points can be interpolated and then ...
0
votes
1answer
67 views

Normalize data in feature engineering

Here is the dataset to be used to train the model. ...
8
votes
3answers
232 views

How to create a version of FixedPointList for asymptotically periodic functions?

I need to efficiently generate a bunch of bifurcation diagrams. A simple familiar example illustrates the efficiency problems I'm running into: ...
17
votes
6answers
775 views

Apply multiple functions to same list

I'd like to get the Min, Max, Median, Mean, etc. for the same list. For now I'm doing the following: ...
6
votes
5answers
206 views

Create a list of all possible multivariate monomials of a certain order

Given variables x[i] for i=1,2,...,n I would like to create a list of all possible multivariate monomials of order ...
4
votes
1answer
59 views

Transform set of linear equations into matrix and two vectors

Consider a list L containing entries dependent on variables x[i] (the i are integer, yet not ...
3
votes
1answer
69 views

Conditional deleting pairs inside a list of pairs [duplicate]

I have a list of pairs for example like following: list={{1,0.001},{10^(-7),0.001},{0.01,0.00005},{10^(-11),10^(-4)}} Now I would like to delete all pairs (the ...
7
votes
4answers
535 views

Filter list based on date

What I would like to do is remove entries from a list of instrument data when it is in maintenance. The maintenance data I have is a series of dates which look like this; ...
4
votes
1answer
752 views

Removing an ordered pair from a list of ordered pairs if the second element in the list is Less than a Value

I have a list of ordered pairs from a piezoelectric sensor sampled at 2kH. The first element is time and the second, amplitude. I'm trying to remove all ordered pairs in the list of ordered pairs when ...
9
votes
2answers
439 views

DeleteDuplicates[] does not work as expected on floating point values

Here is my simple example, and in this case function DeleteDuplicates does not work as expected. I want to FindRoot of my ...
3
votes
2answers
101 views

How do I run 1-855 data points( imported from excel sheet) into a formula to obtain value for each data point?

I am very new to Mathematica and I just couldn't figure out the solution for the following problem. I have two columns in an Excel file. I have imported the 1st column as ...
3
votes
2answers
95 views

Count values inside sublists separately

I've the following problem: given a nested list like this: a={{1,2,3,2,1},{2,3,4,6,4,3,2},{4,5,12,5,4}}; How can I count, in each sublist, those values that are ...