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

learn more… | top users | synonyms (5)

0
votes
1answer
53 views

Selecting from a list [duplicate]

OK, I know this must be a simple problem, but right now I'm just stuck and need some advice with this :). I have the following list: ...
4
votes
2answers
241 views

Dynamic arrays and lists with compile (Append, Linked lists etc.)

I have a code that I need to compile. The code contains a loop in which I need to gather data into a list. The question is how to best gather data so that the code works inside Compile. The following ...
0
votes
2answers
128 views

Block anti-diagonalize a square matrix?

In Mathematica there is a very convenient function called JordanDecomposition[]. It takes a square matrix A as an argument and ...
0
votes
1answer
44 views

Writing a math formula to order results in a certain way [closed]

I am not very well educated in math and I have a math puzzle that I'm trying to solve. I have the following list and each object has 3 numbers. The first 2 numbers are better when they are as high as ...
6
votes
6answers
541 views

Find (longest) overlapping elements between two lists

I am trying to write a function f that returns the overlapped sublist where A ends with this sublist while ...
8
votes
0answers
122 views

TimeConstrained[Delete[Range[1],1]] causes kernel crash

Run these two samples of code here (AFTER SAVING YOUR CURRENT WORK): Do[ TimeConstrained[ While[True, Delete[{1}, 1]; ];, 0.1];, {100}] ...
2
votes
2answers
185 views

How to generate a range of numbers

Is there a quick and dirty way to generate a list of numbers from 1 to some arbitrary large number in order such that the digits of each number are only 0's, 1's, and 2's? I tried doing ...
2
votes
2answers
471 views

Check RUT (Rol Único Tributario) for numbers over 7 digits

In Chile the RUT (Rol Único Tributario) is a national identification number. Every RUT has a check digit modulo 11. The RUT has 7 or 8 digits plus a check digit or letter. I made this code that works ...
3
votes
2answers
166 views

Replace missing data

I have vectors of equal lengths where I want to replace the zeroes (missing data) with their preceding values. So far I have written: ...
0
votes
1answer
58 views

Length of Union Incorrect?

I am having a problem with the Union of sets not giving me the correct Length. ...
0
votes
2answers
154 views

Exporting a table to Excel in CSV format

I am trying to create a table which when exported in a .csv format and opened in MS.Excel has the following form; ...
1
vote
1answer
71 views

How do you hide/show a dynamic element in a list?

Here is the simplified version of the problem: THIS: {1,2,##&[],4,5} RETURNS: {1,2,4,5} ...
2
votes
3answers
125 views

Creating sublists based on the first column

I have Excel file consisting of two columns such as: ...
1
vote
1answer
68 views

How to extract a contiguous s_1 x s_2 x … x s_d subarray from an n_1 x n_2 x … x n_d array, where the dimension d is a variable

Given a multidimensional array, such as the 3-dimensional 2 x 2 x 3 array { {{a,b,c},{d,e,f}}, {{g,h,i},{j,k,l}} } How can I extract an arbitrary 3-dimensional ...
3
votes
0answers
261 views

FindPeaks finds Minima, but not all of them [closed]

I have 10 sets of data, which are the result of measuring the way of a mass falling down over time, bringing a wheel into rotation when the mass hits the ground and then the wheel lifts the mass up ...
3
votes
3answers
241 views

Selecting sublists of different length if at least one element of the sublist fulfills a criterion

I have the following list, containing sublists with 1,2 or 3 elements. ...
5
votes
2answers
370 views

Is there an inequality operator (Less, Greater) for lists of elements (as opposed to elements)?

Like multi-column sorting. For example, {1,3,5} > {1,2,5} would return True, while ...
1
vote
1answer
200 views

Finding Coordinates of a Peak on a Plot

I have plotted a graph from a CSV file which consists of two columns of data Time and Intensity. I simply want to find the time where the intensity is largest. This code: ...
1
vote
0answers
102 views

Disease Network Model Using NDSolve

I have a basic disease model using NDSolve: ...
1
vote
2answers
207 views

Evaluate a list

I have a function $f(x_1,\cdots,x_n)$ that takes $n$ arguments, and I would like to evaluate it using a list of lists $\lbrace\lbrace x_1,\cdots,x_n \rbrace,\cdots,\lbrace x_1',\cdots,x_n' \rbrace,\...
-1
votes
1answer
116 views

Null before each element in a list [closed]

I have a list of colors that I am trying to use to color another list, I have a function that makes the list and I call that function and set it to a variable in another function. If I try to print ...
9
votes
1answer
173 views

Map at a subsequence of a list

I'm trying to construct a function somewhat similar to MapAt. A basic usage example should look like this: ...
1
vote
0answers
45 views
25
votes
7answers
760 views

Faster position list construction from a “take instructions” list

Take some list, e.g., {1,2,3,4,5}, and a "take instructions" list, say {1,1,2,1,1}. The latter is read as "take the first ...
5
votes
1answer
213 views

Slow exponential evaluation over lists

This question,which is still unanswered, might be relevant because it involves NIntegrate over lists and it also has Exp. In ...
0
votes
2answers
102 views

Convert Range to List of Strings

I need to generate the result given by ...
13
votes
2answers
554 views

What is the fastest way to get the nth distinct permutation of a list?

What is the fastest way to write a function nthPermutation[xs_List, n_Integer] which is equivalent to Permutations[xs][[n]] but ...
4
votes
1answer
154 views

Last Position function

The FirstPosition[] function can be use to locate the first position of an occurrence in a list. For example ...
1
vote
0answers
56 views

Substitution does not work while substituting with a value from list [closed]

I am writing a program which iteratively solve and make substitution from a list. As I have shown in the code substitution works when I enter the value directly (Input 100). When I extract the same ...
9
votes
2answers
217 views

Checking if one partition is a subpartition of another

Say I've got two partitions of a list (not necessarily containing numbers, and not necessarily distinct), and I want to check that one is a subpartition of the other. Let's look at some examples: <...
1
vote
1answer
176 views

How to plot multiple yearly data in one graph

There is a dataset: for each year a single data for 6 seas. I would like to have a graph to visualize paralel changes. This is what I attempted to reproduce http://www.eea.europa.eu/data-and-maps/...
1
vote
2answers
86 views

Avoid nesting of functions [closed]

is there a way to avoid the "nesting" of functions like f[f[f[a, b], c], d] where a, b, c, d are lists and f is a function that merges two lists with certain ...
0
votes
0answers
60 views

How can I get the covariance result cumulatively?

I am trying to derive the covariance results for a $n \times 4$ matrix where $n$ is an arbitrary number. I am trying to derive the covariance for each row cumulatively. For example, I am trying to ...
4
votes
1answer
194 views

MovingMap maps to second level unexpectedly

I'm trying to build a financial indicator in mathematica. I import some historical data ...
3
votes
1answer
130 views

Finding position of non empty matrix entries

I have a series of circles in space and I am trying to find the intersections of a given line and the circles and storing that in an array using Table. As the line ...
1
vote
2answers
118 views

Find maximum of 'y' coordinates from a list of duplicate 'x' coordinates

I have a multidimensional-variable list, suppose for example {{x1,y1},{x2,y2}..}. I have duplicate values for the 'x' coordinates and I need to find for the duplicate 'x' elements the corresponding ...
6
votes
2answers
178 views

Generating $\mathbb{Z}^*_n$

I'm using Mathematica to illustrate basic number theory concepts in a graduate cryptography class. To generate elements of the multiplicative group of integers modulo $n$, i.e. $\mathbb{Z}^*_n$, I can ...
1
vote
1answer
168 views

Missing elements using FinancialData

I have a list of stock symbols which I selected with FinancialData["Menbers"] that looks like the following list: ...
3
votes
4answers
178 views

How to combine the elements of two lists using a user-specified function

I have two lists of integers. From these lists I want to produce a list where each element is a fraction derived from a corresponding pair of elements in the original lists, the smaller integer of the ...
1
vote
2answers
221 views

Manipulating elements of a matrix, to loop or not ?

I have a grid of values generated from a MATLAB evaluation. Most of these elements are 0, some 0.5 and the remainder 1. I'd like to write a mathematica script which reads in the CSV and then, in every ...
0
votes
2answers
73 views

How to change list to a list of points

I have a list of angles {a1, a2, .... , an} and I would like to have a list of points ...
1
vote
4answers
122 views

Group data in table by 2nd column while consolidating values in 3rd column

I currently have a list in the format: {Group, State, num} {{a, CA, .5}, {a, AK, .2}, {a, MX, .1}, {b, CA, .8}, {b, AK, .8}, {b, MX, .1}, {b, HI, .7}} I ...
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 ...
3
votes
3answers
189 views

Change matrix elements at specific locations?

Let's say I have an array a={{1,2,3}, {4,5,6}, {7,8,9}} I want to have all elements along the diagonal multiplied by 2. ...
0
votes
3answers
85 views

Delete nested lists with Missing[“NotAvailable”] [duplicate]

I have a list of stock symbols and related information containing some entries Missing["NotAvailable"]. I would like to delete all nested lists which contain a ...
0
votes
1answer
119 views

Select nested lists based on string pattern

I would like to select nested lists out of a master list based on certain string pattern as in the following example: ...
1
vote
2answers
197 views

How do I disorder a list in Mathematica?

Given a list like this (the original list is much longer), how I can get a completely unordered list and save it in plain text? I change the file names (names at random), using a length of 5 digits, ...
0
votes
1answer
66 views

Selecting elements from a list [duplicate]

I have the following array of numbers: a = {{0, 2, 5}, {3, 5, 1}, {4, 0, 5}, {8, 3, 4}, {0, 8, 6}}; then I make a list of the first row with ...
0
votes
0answers
70 views

Improve performance of processing transactions in a large file

I want to work with a table which has 296,705 transactionslines and 172,147 transactions. ...