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

learn more… | top users | synonyms (3)

11
votes
4answers
497 views

Finding the period of an array of integers

A simple array of integers is given. The problem is to detect if a pattern is repeatedly occurring in the array, and find the length of that pattern. For example, for ...
0
votes
1answer
138 views

Making table and plotting results of NDSolve problem

I am trying to solve two equation to find /[Phi][x] and plot h vs. /[Phi][x] for different values of L.I tried by writing as: ...
3
votes
2answers
54 views

How to re-arrange lists, divide one list into 2 lists with a particular step [duplicate]

How to re-arrange following list: {a1,b1,a2,b2,a3,b3,a4,b4} or this {a1,b1},{a2,b2},{a3,b3},{a4,b4} to get: ...
1
vote
4answers
153 views
2
votes
0answers
37 views

Faster trimming of leading/trailing zeroes in rectangular array

Given a (large) rectangular array, e.g. (small for example case): ...
1
vote
1answer
41 views

Collecting specific Lists of data in coordinate form

Note: This might be trivial for many of the users but i am new to mathematica so i don't know!!! Question: Suppose i have three list of data as follows: ...
37
votes
6answers
2k views

Find zero crossing in a list

I'm looking for a function that finds the index of the zero-crossing points of a list. Before I go making my own subroutine to do this, I was wondering if anyone knows of any built-in Mathematica ...
0
votes
0answers
21 views

ListContourPlot for 3D data [on hold]

I have an n x 3 list of some solar cell data that looks like this. ...
18
votes
3answers
284 views

Bug in MovingMap (breaking change between version 10.1 and 10.0.2)?

The MovingMap window spec has been changed between version 10.1 and 10.0.2. Version 10.0.2 ...
1
vote
2answers
47 views

Perform operation on part of a table / create a reference

There is a function f that I would like to operate on a rectangular part of a table t. The part is specified by function ...
0
votes
0answers
22 views

Generating a list consisting of function values like in a triangular matrix

A goal is to generate a SymmetrizedArray of dimension n^k with specified symmetry (let it to be ...
9
votes
5answers
360 views

Most efficient way of making pair list from a list

I have a bunch of datasets which looks like: 3 7 1 6 5 8 2 4 1 2 8 1 5 2 5 ... and I need to make a list of pairs such that the first element makes a pair with ...
2
votes
2answers
154 views

Are there any good mass row/column swapping functions for matrices?

I have the following matrix Keeping the 20 row and 20 column fixed (so the 21st rows and columns because I started at 0)...how do I push each row and column back one spot? I need to push the 0th row ...
4
votes
6answers
209 views

Indexed Map Thread

I'm attempting to MapThread a function of two lists that requires the index of the list values. For example, MapThread[#1*i+#2*j&,{{a,b,c},{e,f,g}}] Where #1 ...
1
vote
1answer
95 views

How to add an extra column to a current matrix (list)? [duplicate]

a = {{-800, 1712}, {-801, 1713}, {-806, 1832}} TableForm[a] b = a[[All, 2]] - Min[a[[All, 2]]] How do I make a new matrix (list) whic looks like this ...
2
votes
1answer
52 views

Simplify on a structured array

Why doesn't Simplify and FullSimplify operate on object generated using SymmetrizedArray? ...
0
votes
0answers
28 views

Copying an Imported List to another File

I have a file which begins with a large list of elements created by joining 12 different data imports, which I would now like to copy to another file so that the file can be sent by itself and not ...
1
vote
3answers
118 views

How to do a Check for every element in the list?

I know how to do a Check for the list in general: ...
1
vote
5answers
132 views

How to split list to strings?

Considering a list: lst = {"1", "2", "3", "4", "5", "6"} How can I have two strings : str1 = "1, 2, 3" str2 = "4, 5, 6" ...
0
votes
1answer
25 views

Add elements of one list to sublists of another list [duplicate]

I have the following list of sublists with different lengths {{1,1,1},{2,2},{3,3,3,3}} and a second list {4,5,6}with the same ...
0
votes
0answers
43 views

Loop over elements of list and output to table [on hold]

I have little experience with flow of control in Mathematica and the following task seems daunting to me. I need to evaluate the same set of expressions to all the elements of a list, and then output ...
0
votes
4answers
112 views

Make a program that does union of two lists

I have to make a program that gives as a result the union of two lists using a For loop. I can't figure out how to inspect if the elements of a list are different. ...
5
votes
2answers
163 views

Create a list of rules built from data set fields

I want to convert a dataset to a list of features and a list of target values, for use in Predict and also more generally. I know ...
0
votes
1answer
32 views

Strange behaviour of Append [on hold]

I have the following situation and I completely do not understand why the second system can be solved but the first (of the same equations, as it seems) cannot. How is it possible? ...
4
votes
4answers
589 views

Writing a circular matrix

I have two square matrices, $A$ and $B$, of the same size, say, of $m \times m$. What I want is to write a programme/function of three variables, $A$, $B$ and $n$, that outputs the $mn \times mn$ ...
2
votes
4answers
193 views

How to switch from array to string?

Considering we have an array: a = {2/3, 4/5, 9/7, 3/7, 1/7, 1/9}; How can I get this to be: "2/3 4/5 9/7 3/7 1/7 1/9" ...
0
votes
1answer
192 views

mathematica apply list of functions to the same arguments [closed]

EDIT: "Through" is partial solution, because it cannot be used in expressions, where these functions are used without arguments. How can I apply list of functions to the same arguments? e.g. ...
2
votes
1answer
54 views

sparse array with list [closed]

i'm trying to populate a sparse array with lists in certain positions, i tried the following code, ...
4
votes
3answers
116 views

How to map over inner keys of nested Associations?

Considering an association: <|"a" -> <|aa-> "asc", bb-> "asd", cc-> 0, ImageType -> "asd", dd-> "asd"|>|> How can I make the inner ...
1
vote
2answers
46 views

How can I manipulate this list?

I performed a loop with Table where I solve a system of 4 equations that depends on two parameters: eta and p. I create two lists for each parameter as follows: ...
4
votes
4answers
110 views

Creating a new list from other two lists using for loops

I have two lists 'ups' and 'downs' where they are composed of positions of an element in a matrix and their weight. For example, ...
0
votes
2answers
58 views

Writing a function with variable arguments [duplicate]

I want to write a function which takes multiple arguments varying from 1 to n, where each argument is a triplet. sublistProduct[{$a_1,b_1,c_1$},{$a_2,b_2,c_2$},...] = { $\Pi_{i=1}^{i=n}a_i ...
6
votes
6answers
330 views

Total by a criteria

I am developing a weighted KNN algorithm. In a step, I need to do the sum of weights of each class. For example: ...
4
votes
4answers
181 views

How to highlight the elements in a list that match a pattern?

For example, {{1,2,3},{1,2,3,1,2,3,4,5}}with pattern {1,_,3}is transformed to ...
6
votes
3answers
87 views

Comparing elements of a set and deleting elements based on a criterion

I have a function that has two inputs. The first input is a set of 2-element sets, and the second input is a single 2-element set. My function complements each 2-element set with the second ...
16
votes
7answers
730 views

How to use Union on list of lists without sorting them first?

If I do ClearAll[a, d] lsts = {{a, d}, {a, d}}; Union[lsts] I get the expected answer {{a, d}} but if I do ...
0
votes
0answers
39 views

Procedure argument value change [duplicate]

I'm trying to create my own hamiltonian cycle algorithm using Mathematica for school, and I'm stuck on a syntax issue. I get the following error: ...
1
vote
3answers
47 views

Delete permutations of subtables in a table [closed]

I've got a table of tables: $A=\{\{a,b\},\{b,a\},...,\{a,b,c,d,e\},\{e,d,c,a,b\},...\}$. How do I do to remove backward duplicates, or more generally permutations of duplicates in the table? For ...
0
votes
1answer
32 views

Create a Table depending of two variables [closed]

I tried to create a table depending of two variables as: W= Table[{G[[i]], G[[j]]}, {i, 1, 3}, {j, 1, 3}] I wanted it to look like ...
3
votes
4answers
203 views
2
votes
3answers
99 views

DeleteDuplicates in a list of 2-tuples under condition

Having a list of 2-tuples, I would like to delete such 2-tuples that have 0 at second position, but only those, whose first element is not unique in the list. E.g. ...
6
votes
0answers
89 views

ListConvolve Memory Hemorrhage

I wrote a routine that convolves an impulse response array with a test array and checks for the RMS difference between that convolution and a data array. I do this iteratively so that I can modify the ...
14
votes
5answers
3k views

Best way to create symmetric matrices

From time to time I need to generate symmetric matrices with relatively expensive cost of element evaluation. Most frequently these are Gram matrices where elements are $L_2$ dot products. Here are ...
22
votes
3answers
1k views

Using pure functions in Table

I need a table with the elements made of pure functions and list elements. This is a simplified example: I need a list as: ...
1
vote
2answers
58 views

How to make function accept list of rules as an argument?

Considering the list of rules: r= {"a" -> "1", "b" -> "2", "c" -> 3, d -> 231, "e" -> 1.25}; I want to have a function ...
77
votes
7answers
21k views

Elegant operations on matrix rows and columns

Question The Mathematica tutorial has a section 'Basic Matrix Operations', describing operations like transpose, inverse and determinant. These operations all work on entire matrices. I am missing a ...
1
vote
3answers
97 views

How to manage list of list of rules?

Considering we have a list: str = "{1 -> {a -> aa, b -> bb}, 2 -> {2a -> \"{b -> bb}\"}}" Bringing this to expression gives: ...
4
votes
1answer
64 views

Automatically assign Variablenames to multiple checkboxes

I want to implement the option to import data from Excel and then the ability to trim this data in order to fit the needs. The import from Excel: (source) ...