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

learn more… | top users | synonyms (3)

5
votes
2answers
294 views

Can someone explain this code for joining two lists by the first element of each sublist?

Background (which may be skipped, unless context is needed) I've recently begun learning Mathematica (and only up to chapter 3 of Wellin), but wanted to write some code to get a better feel for ...
1
vote
3answers
65 views

Selective data append to nested list

I have a list of database id and stock indicies which I use to withdraw the related price data. lis = {{4470, "^AEX"}, {4471, "^AFLI"}, {4472, "^AORD"}} I use ...
0
votes
0answers
23 views

Returning multiple results from compiled functions in M10 [duplicate]

I have found a similar question from 2012 here. It has been 3 years now and we have version 10. Have there been any attempt to solve this problem either by Wolfram or by the community - how to return ...
1
vote
1answer
41 views

Change date format in nested lists

I have a list of index symbols and data as follows: ...
2
votes
1answer
53 views

Evaluate recursive funtion as a whole before computing a recursive step

I'll try to make a basic example of my problem with $n$ being an array of elements, ex. $\{1,2,2,3,3,3\}$: If i have a sum which needs a computed value i would like to compute it beforehand and store ...
0
votes
2answers
73 views

Sorting non-numerical lists [duplicate]

The Sort function will by default sort from lowest to highest. In[1]:= Sort[{3, 1, 4}] Out[1]= {1, 3, 4} However, if the list ...
11
votes
5answers
313 views

Make a ragged list rectangular by trimming instead of padding

I have a ragged list ragged = {{a,b,c,d,e},{x,y,z}} that I would like to trim (on the right) to be rectangular. The desired result is ...
0
votes
4answers
66 views

Delete data were y = “NS” in a list with elements {x, y} [duplicate]

I have a list of data {x, y}and not all of them have actual values. They show as {x, "NS"} or ...
0
votes
1answer
37 views

operating lists [closed]

I have 2 lists 25 items, as I do so that data entering this formula ...
9
votes
6answers
547 views

Flatten nested lists

I have a list as follows lis= {a, {{{b}, {c,d,e}}, {{f}, {g,h,i}}}} which I would like to flatten to ...
14
votes
12answers
620 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
139 views

Deleting one of each chosen elements in a list containing duplicates [duplicate]

I want to delete one of each (and not all) selected element in a list containing duplicates. For example i have the list: $\{1,1,1,2,2,3\}$ and i want to delete $\{1,3\}$ so the leftover should be ...
2
votes
2answers
35 views

Count elements between matching opening and closing parentheses?

Suppose I have a List of the form: lst={"(", "x1", "x2", "(", "(", "x3", ")", "x5", "(", "x6", ")", ")", ")"} For each pair ...
7
votes
4answers
466 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; ...
14
votes
8answers
895 views

DeleteCases on list of Strings

Consider the following: data={"AB","CD","AF"}; Now I would like to delete all String from data which starts with "A". ...
11
votes
3answers
701 views

Specifying string patterns in DeleteCases

It seems that DeleteCases is not compatible with string patterns, at least directly (see, for example, this question). Is this true? If so, why is this the case? ...
0
votes
1answer
32 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: ...
6
votes
6answers
452 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 ...
2
votes
3answers
101 views

Creating sublists based on the first column

I have Excel file consisting of two columns such as: ...
0
votes
2answers
73 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 ...
4
votes
1answer
117 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
1answer
58 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 ...
2
votes
2answers
87 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
38 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 ...
1
vote
2answers
111 views

Checker rut for over 7 digit numbers

In Chile the RUT identifier identity, every rut has a check digit module 11 is used, I made this code to 7 digits, but not me 8 digits, a number of 7 digits is the abcdef- form (check digit ) and ...
0
votes
1answer
235 views

How do I plot results of complicated calculations in Mathematica?

I am new to Mathematica and am struggling with making plots of how features of solutions vary with parameters. For example, I can find the eigenvalues and zeroes of a Sturm Liouville problem (showing ...
1
vote
2answers
148 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 ...
0
votes
0answers
16 views

Sublist position? [duplicate]

Suppose I have a list of the form: lst = {a,b,c,d,e,f,a,1,5} If I want to find the position of d in ...
0
votes
1answer
51 views

Length of Union Incorrect?

I am having a problem with the Union of sets not giving me the correct Length. ...
4
votes
1answer
151 views

MovingMap maps to second level unexpectedly

I'm trying to build a financial indicator in mathematica. I import some historical data ...
0
votes
2answers
104 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
43 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} ...
22
votes
4answers
5k 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 ...
3
votes
3answers
97 views
5
votes
2answers
356 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
2answers
100 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' ...
1
vote
0answers
65 views
-1
votes
1answer
46 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 ...
4
votes
3answers
408 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: ...
5
votes
1answer
154 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
80 views

Convert Range to List of Strings

I need to generate the result given by ...
9
votes
2answers
374 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
107 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
3answers
147 views

How can I make a summary of all the commands of Mathematica?

I would like to have a simple way to get summary information about all the many commands built into Mathematica. How could I do this? Is there a site I may refer to?
6
votes
2answers
137 views

Checking if one partition is a subpartition of another

Say I've got two partitions of an 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
0answers
40 views

Substitution does not work while substituting with a value from list

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 ...
1
vote
1answer
90 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 ...
1
vote
2answers
79 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 ...
3
votes
1answer
62 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 ...