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

learn more… | top users | synonyms (3)

0
votes
0answers
13 views

Insert a Column in a Nested Matrix

With thanks to Rahser I could access to the final desired shape of the nested matrix: ...
0
votes
1answer
35 views

Emerging in Nested Matrices

I have a nested matrix as m: ...
-1
votes
0answers
24 views

read and process hundreds of files txt

This short code is the one that broke my head for a while, are 11 variables that must meet a very specific condition, their difference must be 1. either can take the 11 values, hence all permutations, ...
4
votes
6answers
154 views

How to check if two nested lists have the same structure?

How can I check if nested lists like these have the same structure: ...
2
votes
1answer
47 views

SameTest issue?

Folks, I am trying to construct and algorithm which finds all of the remaining groupings (of three items, in this case) from a list of items for which no two items are in groups that have previously ...
1
vote
2answers
49 views

Filling a matrix with a list of lists

I have a list of lists with different lengthes: {{a1,a2},{b1,b2},{c1,c2,c3},...} Now I want to create a matrix the following way: ...
0
votes
1answer
40 views

Unexpected results from output with NumberForm and ScientificForm

I wrote this little function to help me export tables with formatted numbers to files: (By the way, if you have suggestions on how to make it more efficient and compact, it would be great) ...
3
votes
2answers
219 views

Convert a list of hexadecimal numbers to decimal

I know that to change a single number from hexadecimal representation to decimal, you can use: base^^digits. However, if you have a list of numbers, Mathematica ...
2
votes
2answers
52 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 ...
5
votes
2answers
166 views

How do I prune a list of pairs of numbers so that each number occurs on only one pair?

How do I select only the first pair of numbers in which a number occurs from a list of pairs of numbers? For example, I have ...
1
vote
1answer
44 views

Delete duplicates from list of pairs

I'm fairly new to Mathematica, and I've finally stumbled upon something that's beyond my googling powers. I have a list of pairs, where each pair contains in its first entry a matrix and in its ...
4
votes
2answers
80 views

Select sub-lists of common length from a list

Revised Question I have a list with nested lists with the following format: ...
0
votes
1answer
22 views

How to combine two or more groups while selecting form the unbalanced panel data if the number of obs is less than a scalar in certain groups

I have an unbalanced panel data. I want to calculate group statistics for each group. However, if ith group has less than K obs, then I want to combine ith and (i+1)th groups to calculate group ...
13
votes
6answers
654 views

How to sort digits in a string while keeping other characters untouched?

Now there is a string with digits and letters, for instance, "95uge678r3gi89hgfe30kgh063d51". And the expected output is ...
4
votes
5answers
248 views

How do I write a condition for Position that uses both the current and previous element?

For example, given {57, 3, 40, 94, 9, 84, 81, 93, 76, 5, 7, 76, 38, 9, 23, 95, 49, 0, 30, 3} I'd like to get all the indices at which the elements cross from ...
8
votes
3answers
348 views

Turning a set of random walk data 45 degrees

I have a set of data that is just a "random" (generated by me, not by computer) sequence of length 2000 of 1's and (-1)'s. I used it to plot a 1-D random walk where +1 is step up, (-1) is step down, ...
0
votes
4answers
76 views

Find all disjoint subsets of equal length

Suppose that $A$ is a list with $n$ elements where $n$ is even. I want to write a function that returns all pairs $(A_1,A_2)$ where the sets $A_1$ and $A_2$ each have length $\frac{n}{2}$, $A_1 \cap ...
0
votes
3answers
58 views

How to iterate through a list of rules?

Let's consider I have a list of rules: {Aa -> 1/2, Av -> 2/5, Bx -> 3/7, Ce -> 4/9, ...} I want to find all keys that contain the letter "A" and ...
4
votes
2answers
101 views

How can I insert an element every $n$th position in a list?

How can I insert an element every $n$ positions in a list? For example, inserting a zero as every 4th element to turn {1, 2, 3, 4, 5, 6, 7} into ...
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
3answers
58 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 ...
2
votes
1answer
48 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 ...
5
votes
2answers
125 views

How can I generate a $2n$-point moving maximum of a list as efficiently as MaxFilter?

This is based on the prior question, Moving maximum function?, where @rasher provided two winning solutions (i.e. clearly the most efficient): MaxFilter[list, 1] ...
0
votes
1answer
35 views

operating lists [closed]

I have 2 lists 25 items, as I do so that data entering this formula ...
8
votes
1answer
87 views

Unexpected slowness checking for empty list?

I thought I had a firm understanding of the differences between Equal and SameQ, but this has me puzzled: ...
3
votes
5answers
525 views

Can Mathematica delete some of the 0's from a list?

I have a list: {1,2,3,0,0,4,5,0,0,0}. I want to delete the 0's occurring after the last positive integer. In other words, I ...
1
vote
1answer
40 views

Change date format in nested lists

I have a list of index symbols and data as follows: ...
1
vote
3answers
125 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
34 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 ...
0
votes
4answers
60 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
0answers
34 views

Using lists for creating another list [closed]

I have list ("F") of numbers of length n. asthma = ((A - B)/A)/Sqrt[XXX], where "A" and "B" are also lists of numbers of length n. The thing I need is that "asthma" will also be a list of numbers ...
8
votes
6answers
512 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 ...
2
votes
3answers
88 views

Delete rows based on specific periods

I have data (.xlsx format): two columns - data in first column imported as DateObject (dates with specific time), data in second column are numbers (113388.28, 865165.98 etc.). I want to delete the ...
0
votes
1answer
30 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: ...
2
votes
2answers
82 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
70 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
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 ...
6
votes
6answers
434 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 ...
7
votes
0answers
73 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}] ...
1
vote
2answers
135 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 ...
1
vote
2answers
90 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 ...
2
votes
2answers
75 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
0answers
14 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
50 views

Length of Union Incorrect?

I am having a problem with the Union of sets not giving me the correct Length. ...
1
vote
1answer
86 views

What are the terms of the sequence generated by Zeta(3s)/Zeta(s)?

The LiouvilleLambda function has Dirichlet generating function of Zeta[2s]/Zeta[s]. I am curious about an analogous function with Dirichlet generating function of Zeta[3s]/Zeta[s]. Can Mathematica ...
0
votes
2answers
75 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
40 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
90 views

Creating sublists based on the first column

I have Excel file consisting of two columns such as: ...
1
vote
1answer
53 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 ...
4
votes
0answers
67 views

FindPeaks finds Minima, but not all of them

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 ...