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

learn more… | top users | synonyms (3)

-2
votes
1answer
317 views

Non-regular grid data

I have issue with non-regulary spaced data. I have set of 3 numbers {x, y, z} in my list. ...
1
vote
3answers
1k views

Loop through a list and select elements

I am new to Mathematica and I have no idea how to make a basic for loop work. I want to loop through the elements of a list: Range[45, 200]. I want to select the ...
0
votes
1answer
72 views

How to get a number, but not a list, of the dimension of your array?

I need to use the dimension of a certain array, to use it as a bounder in a loop afterwards. The problem is that I get a list, when write : ...
3
votes
5answers
514 views

How to combine some elements of a list?

In order to simplify my expression, I face a list manipulation problem. For example, given the input list ...
9
votes
1answer
227 views

Creating a number based on given conditions

In the grade 7 math curriculum here in Alberta we teach divisibility. I'm trying to write a program to create questions based on the idea of a student being given say, 4 digits, and then choosing ...
0
votes
1answer
610 views

Find Roots in Do loop

Task: Finding roots in loop t = List[1, 2, 3, 4, 5] fx[x_] := a*x^2 - 5 List[Do[Print[FindRoot[fx[k] == 1, {a, 1}]], {k, 0, 5}]] Output: Currently the output is ...
4
votes
5answers
140 views

Convert a list with three arguments {x0,x1, step} into an equidistant table?

How can I convert a list such as: a = {1, 2, 0.1} into sequence so that I can pass them into a function, e.g. I want to be able to do something like this ...
8
votes
3answers
484 views

Multiply a list of matrices by a list of vectors

How does one multiply a list of matrices by a list of vectors, elementwise? For example, multiplying ...
3
votes
2answers
169 views

Sequence and boolean And

I'm trying to figure out if a calculation result it's a valid result. As it return a matrix, I need to test that every element it's a number, so I thought this could work... ...
9
votes
4answers
526 views

Find list position and mapping list

Sorry, my English is not very good. I have two lists: ...
7
votes
3answers
155 views

Given a list of lists, build a list in which lists with equal first and last elements are grouped together

I have a list of lists, and I'd like to build a new list, in which lists are in the same list if they have the same first and last element. Here's an example. Suppose I have ...
3
votes
1answer
163 views

How to make a simple tree yourself with defined distances for each generation?

I'm trying to make a function that generates a tree for spin spin analysis in spectroscopy. I though it would be pretty easy, but I'm totally stocked. The tree should look something like this: ...
0
votes
1answer
122 views

Where do those nulls come from? [closed]

I have seen discussions of unwanted nulls in the output in the context of building lists with conditions on the elements, but that is not involved here. I would like to know where the nulls come from ...
4
votes
2answers
259 views

Partition a set into $k$ non-empty subsets

The Stirling number of the second kind is the number of ways to partition a set of $n$ objects into $k$ non-empty subsets. In Mathematica, this is implemented as ...
9
votes
4answers
908 views

Passing large list by reference

I have the following problem: I would like to control evaluation of a variable that points to a list. For example, frequently in the code I have functions of the form that are supposed to work on ...
2
votes
1answer
113 views

Strange behaviour of variables in Table

I'm trying to work with some vectors and have run into a strange problem. An obvious way to define a difference of two vectors would be dif[x_,y_] := x-y I ...
3
votes
2answers
266 views

Listable compiled function using Map

I'm trying to minimize the computation time of problem which is too long to post. I use compilein order to gain some speed. To increase speed I would like to use ...
9
votes
5answers
559 views

Counting the population of integers

Suppose that myData is a list of sublists. Each sublist has a length of one or greater and contains any number of replicates of the integers 1, 2, 3, and 4. I ...
0
votes
3answers
319 views

Finding an index with certain conditions

EDIT: I need to find out an index i which depends on certain conditions and I'm not able to implement it. I have a list (time points) $t_i$ and two constants $a,c$ ...
0
votes
0answers
64 views

get while loop output into a list [duplicate]

I would like to get the output from this while loop and use it as a list so I can count the frequency of the various tuples.. ...
0
votes
2answers
316 views
6
votes
3answers
829 views

Generating a non-convex polyhedron from a list of vertex coordinates

I want to include a figure in a paper I am writing on Combinatorial Geometry which features a non-convex polyhedron given by the following vertices, EDIT: I was unaware that Mathematica could convert ...
2
votes
2answers
453 views

Replacing values of a function

I have recently starting using Mathematica and have recently come to what seems as an impasse in my understanding of the language. If this is too "tell me how to do it" I would certainly understand. ...
6
votes
3answers
375 views

Delete elements from a list really fast

I have this bit of code that works, but it's very slow when there are 600k elements in the list: ...
9
votes
5answers
343 views

How can I remove matching sublists from my list?

I want to use DeleteCases (or any appropriate function) to remove elements of a list, which in turn are lists of fixed size. The rule I wish to apply is that any ...
0
votes
1answer
160 views

Discrete 3D plots of median ratios of two 2D matrices of lists of values

Lets say I have 2 2D arrays where each cell contains a list of values: Example: ...
5
votes
1answer
972 views

How do I find the Euclidean distance between one point and all the points in a list?

I want to find the Euclidean distance between one point (x1) and a list of points (y1), which contains a lot of coordinates x1 = killer[[2]] {6.05102, ...
3
votes
3answers
185 views

Count items in a list that occur before a date

I have a list of dates that happen throughout 2013. I wish to construct a graph showing a cumulative total of elements that happen before that date. I have a working algorithm, but it seems too slow ...
6
votes
3answers
3k views

Summing along rows or columns of a matrix

I have a list of rows in database such as {{a,b,c}, {d,e,f},{g,h,i}} I want to be able to add each row across and each column down (like a spreadsheet). In other ...
3
votes
1answer
204 views

Efficiently finding the maximum value of a column in a matrix

Imagine I have a matrix of the following form: TestArray = $((a_1,b_1,...),(a_2,b_2,...),(a_3,b_3,...),...)$, where a specific example might be: TestArray = ...
2
votes
1answer
155 views

writing a function using multiple variables

I am fairly new to Mathematica and am trying to write a function for the equation: xx = [x/(Sqrt[h^2 + d^2 + y^2]))*(Sqrt[h^2 + (d + yy)^2]) where h, d are known ...
4
votes
2answers
240 views

How can I eliminate equivalent equations from a list?

I want to find the numbers $a$, $b$, $c$, $d$ of the plane $ax + by +cz +d = 0$ which make the distance from the point $M(1,2,3)$ to the plane equal to 2. I tried ...
0
votes
1answer
348 views

how to work with list as function parameter

I want to output an arrow based on input from user and I tried writing this small function to achieve this: ...
2
votes
1answer
133 views

Error in setting matrix elements [duplicate]

Possible Duplicate: How to Set parts of indexed lists? For better organization of my code, sometime I use data objects in the form: ...
1
vote
1answer
158 views

ListPlot does not recognize my list

I have created a list in Mathematica and for some reason it does not want to Plot my list in pairs {x1,y1}, but instead does {y1,y2} even though I partitioned the list to make it in the correct ...
27
votes
2answers
820 views

DeleteDuplicates not deleting duplicates

It is not surprising that DeleteDuplicates[{5,5.}] returns {5,5.} because DeleteDuplicates ...
6
votes
6answers
420 views

How can I merge two lists in a special way?

It's been over a year since I've used Mathematica, and I'm having a total brain fart on a home project. I'd like to take an existing list of lists, say, ...
0
votes
2answers
653 views

Assign the output of a loop [duplicate]

Possible Duplicate: Creating a table/Matrix during a For loop Yet another simple question. ...
2
votes
2answers
456 views

How can I transform a list of binary digits into integers?

I want to transform a list of binary digits into integers. With the Table function, I produce four lists of binary digits of length 32. Then I tried to turn these ...
1
vote
1answer
134 views
7
votes
3answers
336 views

Find all the last weekends in a year

In order to obtain the weekends of a year you'd use something like this: ...
5
votes
3answers
410 views

Efficiently extracting an array subset given a separate array

I have two arrays. The first array consists of tens of millions of rows and three columns with a string, a number, and a string. ...
0
votes
2answers
241 views

How to get a sub range of a larger matrix?

This should be an easy question but I only found a partial solution using All. Say I have a matrix A = 1000 x 5, how to get only a part of that matrix, say B = n x ...
6
votes
3answers
1k views

Ways to compute inner products of tensors

One way to evaluate the following sums is combining Table and Sum: $u_{abcd} = \sum_{e=1}^3 v_{aeb}w_{ced}$ $q_{ab} = \sum_{d,e=1}^3 v_{d e a}w_{deb}$ It will look like ...
8
votes
3answers
778 views

How can I get a running sum for a list?

I've got following data I'm reading from a file: ...
4
votes
2answers
542 views

How find the first element of a list greater than zero (or another criterion) when there is a symbol in the list?

I need to find the position of the first element of a list that is either greater than zero (or some other criterion) or a symbol. Something like ...
6
votes
5answers
352 views

Handling holidays in financial time series

I have two lists: list1and list2, which are financial time series with only 2 variables—date and price. The problem is: these ...
17
votes
3answers
826 views

Optimising 2D binning code

I have a set of (x,y,z) data, 45,000 to be precise and I want to bin the z values in 256 equidistant bins based on their (x,y) values. The final array should be a set of 256x256 array with each slot ...