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

learn more… | top users | synonyms (5)

2
votes
2answers
998 views

Get positions of all non zero matrix elements

I want to find all non zero elements of a table and I want to create a list that contains the name of the table the element was removed from, the position of the element, and the value of the element. ...
2
votes
3answers
261 views

Distinguishing slots in a function mapping Position across a list

Suppose that I have a list myList that has more than one level. Here is an example of such a "data structure": ...
2
votes
2answers
219 views

How to replace data in a list (tree) in a functional Mathematica way?

I have list containing 2D points in various groupings, i.e. points, lists of points (figures), lists of lists of points (patterns) and finally a list of patterns. The list also contains other data, ...
2
votes
3answers
549 views

Select sublists with second element nearest to zero

I've got some big lists from which i need some data (one of the big lists). To be specific, I need to divide this biglists in sublists of the same length (10000), and form a new list with the mean of ...
2
votes
2answers
430 views

How to populate a table using a rule replacement

I am trying to populate the rows and columns of a table by using a rule replacment. To generate a table that looks like this For example Sc would be row 1, column 1. An example of a record looks ...
2
votes
5answers
169 views

Test First row of matrix

What is a good way to test the first row of a Matrix to check if one of the values equal a value. For instance, In this example, I want to get vector in the second row that has the bigger value in the ...
2
votes
2answers
91 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: ...
2
votes
3answers
150 views

Give a common denominator to a whole list

If I have a list, say ...
2
votes
3answers
54 views

Replace rows based on index with different rows

I have a list and I want to replace all rows that are given by index pos with rows from different list. But the rows in different list are sequential while the rows in the original list that need to ...
2
votes
2answers
68 views

Problem with ArrayFlatten to concatenate matrix

I would like to concatenate 2 matrix : - the first which is a line of 2 elements - the second which is a matrix of 2-2 elements I use the following code : ...
2
votes
2answers
125 views

How to find the palindromic number I'm looking for?

I'm looking for a number which is the same when you read it reverse like 101 or 878. I have to get all numbers from 10 to 1000. There are 99 numbers. ...
2
votes
3answers
115 views

How to check keys and values in nested Associations?

Considering we have a an association: ...
2
votes
4answers
103 views

Reshaping list of 2D points by first coordinate

I have a list of (integer) 2d points, and I want to calculate the mean at each point in the first coordinate. So if my data is: ...
2
votes
4answers
119 views

Pairs of data to Classify[]

Suppose I had the following data a={1,2,3,4,5} How would I turn this into b={{1,2,3}->4,{2,3,4}->5} That is, ...
2
votes
3answers
140 views

How to extract both first and last rows of each group from unbalanced panel data

This is a follow up question form my last question click here. I have unbalanced panel data such as : ...
2
votes
1answer
118 views

Excluding cases from Map

I'm doing operations of the form: PowerMod[#, -1, 126]+# & /@ Range[1, 125] When a number is not invertible, I don't want it to be included in the result ...
2
votes
3answers
158 views

How to multiply specific columns in a matrix of data?

So I need to make a plot of some ~2000 data points I have from a spreadsheet. I'm able to import the data just fine, it stores it like so sundat ...
2
votes
1answer
189 views

Extra brackets of Position command

Command Position always comes with two extra curly brackets {{}} when it's just one index for the location. I use [[1,1]] in front of my position commands. Is there ...
2
votes
2answers
151 views

Elegant way to rearrange year/date table into time series/values

I often have data in the form of YEAR JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC 1950 -1.022 -1.146 -1.289 -1.058 -1.419 -1.36 -1.334 -1.05 -0.578 -0.395 -1.151 -1.248 1951 ...
2
votes
2answers
299 views

Covariance of a P x M x N matrix

I have a stack of tiff files. When imported to Mathematica, they form a $P \times M \times N$ matrix, where $P$ is the number of single images in the stack, $M$ is the number of horizontal pixels and ...
2
votes
2answers
540 views

How can I build a GraphicsGrid of arbitrary size?

This is actually a very simple scenario, in order to make simpler this question Part I. Consider the following piece of Mathematica code ...
2
votes
2answers
851 views

Building a new table by repeating elements from another table

I have a small problem that I cannot solve. I have two tables, one with three elements: a = {0, L/c, 2L/c}; and the other with 9 elements, all 0: ...
2
votes
1answer
847 views

Find elements of a list which are empty

Sorry for the most basic of questions. How would I find the positions of a list of elements which are empty, for example I have the list ...
2
votes
3answers
367 views

Introduction of straight Line into Manipulate function

I just want to implement a line within my chart that starts from time point 0 to time point T and whose y-coordinates can be manipulated, which in my case is represented by D. I tried to implement a ...
2
votes
1answer
1k views

Indices and variable definitions in Mathematica

Does anyone know how I can do this in Mathematica? Just an example.. Defining indices and variables (defined over indices), "mapping" variables and indices: ...
2
votes
2answers
140 views

Using FreeQ with implicit functions

In Mathematica 7, I want to determine whether a list of free of numbers greater than 1 or not. It seems like using FreeQ would be a concise way to do this: ...
2
votes
1answer
526 views

Symmetric difference of a sample of lists

Consider the following: list1={a,b,c,d}; list2={c,d,e,f}; list3={g,d,c,h}; Now I would like to get the symmetric difference. Hence, the result must be ...
2
votes
2answers
4k views

Creating Lists From Loops

Consider the following: lists = Import["G:/Notebooks/Lists.csv"]; col7 = lists [[All, 7]]; For[i=0,i<101,i++,Print[Count[col7,i]]] This will get a 100 cells ...
2
votes
4answers
87 views

Sum selected rows/columns and replace them with the sum

I have the code: pos = {2, 3, 5}; tbl = Table[i*j, {i, 6}, {j, 3}]; totRow = Total /@ tbl[[pos]]; which defines some row indices (pos) and a table and some of ...
2
votes
1answer
102 views

Collecting Data in table

I wrote a program (with help of the stackexchange) that is supposed to run in a loop. Each time the program runs, it exports a small data. Is it possible to generate a table where each run adds the ...
2
votes
1answer
89 views

How does this code work to substract a set A from a set B?

In an answer to a question (as given here: code), the proposed function was to to subtract a set B from a Set A: ...
2
votes
1answer
85 views

Efficient creation of lists from other lists

Given the following lists: v1 = {a, c, e}; v2 = {b, d, f}; how does one efficiently create the following "combination lists"? ...
2
votes
2answers
85 views

Creating pairs and specifying a name for them

I have a list as list={-3/4, -3/4, 3/4, 3/4, -1/4, -1/4, -1/4, -1/4, -1/4, -1/4, 1/4, 1/4, 1/4, 1/4, 1/4, 1/4} I want to create pairs with an added ...
2
votes
2answers
55 views

Implementing BinCounts for alphabetical structures

Is it possible to implement BinCounts for alphabets such that those alphabets which fall into the group {a,b,c,d} can be counted ...
2
votes
2answers
81 views

Perform calculation on several sublists using Map

I am trying to perform a calculation on a list containing sublists. More exact: The x-axis values are time data, progressing from zero, the y-axis data are data points, which I want to normalize. I ...
2
votes
3answers
93 views

How to compare and remove x-coordinates (and the associated y-coordinates) that are less than previous x-coordinates?

I am using Mathematica version 9.0 and am trying to compare and remove x-coordinates, and the associated y-coordinate, that are less than previous x-coordinates. Below is an example using sample data. ...
2
votes
3answers
152 views

Given a list of triangle vertices, how to find the neighbors for each vertex?

A triangle is represented by {a,b,c}, indicting that its vertex IDs are a, b, and ...
2
votes
3answers
109 views

Efficient extraction of a subset

The context is molecular dynamics. The data is in the format (index_1, index_2, distance). The goal is to find all of the distances to the neighbors of point index_0 and to present a set listing the ...
2
votes
2answers
115 views

How do I partition a matrix?

I have a data file with fields x y z. When I import it to "data", I get a matrix if the form: ...
2
votes
5answers
108 views

Find list item before first negative value [closed]

If I have a list like this: ...
2
votes
3answers
196 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
336 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 ...
2
votes
1answer
85 views

How to select elements with a specific style of a list?

Suppose I have a list: where 3 'up's of the list are red(I've made it to Cell Expression as follows). ...
2
votes
3answers
292 views

What is the order of faces on a D20? How can I optimize the order of faces on a D-n?

I am creating a customizable D20 for 3D printing using OpenSCAD, with the following code: ...
2
votes
2answers
209 views

Alternative for MapThread in listable functions

How can I rewrite this more efficiently taking advantage of flo, dem, and Nsup being ...
2
votes
2answers
117 views

Select words from different rows of column headings

I have a 2-dim array. The first 3 rows have column headings. The heading can be a single word, or 2 words (which take 2 rows) or 3 words (which take 3 rows). For each column I know which row has ...
2
votes
2answers
191 views

make a list based on two other lists

I have two lists: list1={4,6} list2={1,2} and I now want a function f that produces f[list1_,list2_]:={1,1,1,1,2,2,2,2,2,2} ...
2
votes
2answers
346 views

Generating complete lists of polynomials

I would like to generate a list of all $3$-variable Laurent polynomials with non-negative integer coefficients using a looping construct so that I can, one-by-one, check them for specific ...
2
votes
1answer
258 views

MathLink c++ passing lists of real values simple example

So this may come down to me not being a very competent programmer but I am struggling with passing list from Mathematica via MathLink that aren't of integers. The final code I am hoping to get out of ...
2
votes
2answers
831 views

Convert list to sequence

I was just thinking how Tuples was created so , I came up with this, ...