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
142 views

Creating a single three-dimensional array from imported data

I'll preface this by saying that I'm not a Mathematica veteran - I'm a chemist who is trying to find a way to import time-dependent spectral data in a usable form. I have figured out how to import the ...
2
votes
3answers
148 views

Remove pieces of a text file

I have imported a text file as a Table with testpbkg = Import["unweighted_events.lhe", "Table"] The file looks like this. I want just to select the text ...
5
votes
3answers
199 views

Operations in nested lists

New to Mathematica, I have a nested list containing many lists(A) of 16 lists(B) of 3 integers(C). I wish to put in each (Aj, Bi, C2) the result of (Aj, Bi-1, C2)+(Aj, Bi, C1). I could do it with a ...
0
votes
1answer
46 views

How to apply a piecewise function to a list? [closed]

I have created this code: xn = {4, -4, 4, -4} f[x_] = Piecewise[{{Sqrt[x], x >= 0}, {Sqrt[-x], x < 0}}] f[xn] With this code I would expect as a result: ...
15
votes
8answers
2k views

How to avoid procedural loops in this example?

I want to iterate over a list, and return the index as long as I found the first element satisfying my condition. Written in a for loop: ...
4
votes
3answers
291 views

Adding data to an existing list

I have list: {{a, b}, {c, d}, {e, f}} What is the most simple (but automated) way to add this data to the list? ...
0
votes
1answer
39 views

Combination of Values: Automated generation [closed]

How can I get a list of combinations for two values (e.g. 0 and a) such as for N=3: {{a,a,a},{a,a,0},{a,0,a},{0,a,a},{a,0,0},{0,a,0},{0,0,a},{0,0,0}} ? I'd like ...
1
vote
1answer
47 views

Finding Nearest Element to a line in a 2 dimensional Array

so i have a 2-dimensional list of data of x and y coordinates. I am looking for a way to get the element of the list which has the closest y value to a given y value. I tried using Nearest but this ...
1
vote
0answers
24 views

Why Inner doesn't work with Dot/List? [duplicate]

The recent question about generalizing Dot for list of matrices had a nice solution/comment using Inner. Briefly, we have 6 ...
7
votes
2answers
633 views

Understanding Transpose

It is very likely that it is my lack of math skills that is showing up here. However, I think Transpose is such an important function that I need to master it. So I ...
1
vote
0answers
41 views

Simple list manipulation [closed]

I have two lists: {1,2,3} and {a,b,c} and I want this result: {{1,a},{2,b},{3,c}}. What is the right command? How does one call such an operation?
4
votes
6answers
459 views

Easiest way to extract the coefficient of a polynomial

For a term in a polynomial, say 387 a1^4 a2^3 x^3 y^7 z^100 w^364 what is the most efficient way to extract the coefficient of this term, i.e. ...
1
vote
3answers
233 views

Generating a vector basis

I have several lists parameterizing a vector space, for instance {a[1],a[2],a[1]+2 a[2]-a[3]} For each list I want to generate a basis such as ...
2
votes
1answer
62 views

Replace part on string in list

I have a list with string and integers and want to replace one word in the string with an integer. For Example if I have ...
2
votes
2answers
52 views

(Cartesian product) How to get the coordinate of points while each coordinate of each axis is known? [duplicate]

For example, I have data like this: m = {{1,2,3},{4,5,6}} It means 1,2,3 are available x position, 4,5,6 are available y position. The question is, how to get ...
11
votes
5answers
471 views

Element-wise test on List elements

This question could sound pretty silly but I can't find a way to apply element -wise tests to a list. For example if I digit ...
0
votes
1answer
34 views

How-to set item background color based on criteria? [closed]

Description After carrying out some computation and establishing a set of data, I would like to tablularise data and highlight values which do not meet acceptable treshold. A similar question has ...
1
vote
1answer
32 views

Map a list of functions to a number [duplicate]

Suppose I have a list of functions like: listfun = { Sin, Cos, Tan } And suppose I want to map listfun to a single number <...
0
votes
1answer
60 views

Generating matrix of distances between points in cylindrical coordinates

I am working on an analytical model for the sound intensity generated from a vibrating cylinder. Part of this work requires me to split the cylinder up into a number of elements, with the more ...
8
votes
2answers
3k views

Get the coordinates from ContourPlot and RegionPlot

How do I get the coordinates from a contour plot I've done in Mathematica? For example, I have a two-variable function f[x, y], for which I can make a contour plot: ...
4
votes
5answers
555 views

Creating overlapped block matrices

I'm doing an FEM assignment using Mathematica. (EK1 = {{a11, a12}, {a21, a22}}) // MatrixForm (EK2 = {{b22, b23}, {b32, b33}}) // MatrixForm I don't know how ...
15
votes
5answers
914 views

Permutations[Range[12]] produces an error instead of a list

This input: Permutations[Range[12]] Results in this (error) output: ...
2
votes
0answers
56 views

How to Set Priority Between Longest and Shortest [closed]

As is shown in this post's answer, it seems that though you can set priority of Longest (or Shortest) by ...
0
votes
0answers
57 views

Time series of a point using ImageFeatureTrack

This question regards tracking, however it is more about writing efficiency in mathematica compared to other programming softwares. I get the tracking of a point between two movie frames by: ...
1
vote
0answers
37 views

Removing every member of a list from another list [duplicate]

I have a list of lists A={{1,2},{3,6},{7,8},{5,0}}, and another list of lists B={{1,2},{5,0}}. If any list in B is also in A, I want to remove them from A. E.g.,Taking {1,2} and {5,0} out of A to get ...
10
votes
0answers
234 views

Solve and design “water flow”

In some strategy game I play, I'll have to change the terrain to make the water flow in some specific way to fulfill my goal. The water flow changes with terrain so if I can change the terrain wisely ...
20
votes
2answers
598 views

Mysterious behaviour of Pick

As everyone knows, Pick can do amazing things, The most fascinating phenomenon is that it can pick though all sorts of lists: The basic & pattern matching: <...
5
votes
1answer
81 views

Longest and Shortest won't work in ReplaceList?

I'm trying to make a pattern that's easy to preceive by human but hard to write out by Mathematica when I came across this problem. (Check the original problem here) Let's check this simple case: I'...
3
votes
1answer
117 views

How to Find out the Recurring Period by Pattern Matching?

Note: It's not hard to solve this problem AT ALL, so please, try to explain how to use PATTERN MATCHING instead of how to find out the recurring period. We can easily extract real digits from a ...
2
votes
1answer
41 views

Diagonal part of product of matrices

I am trying to find the best way to compute only the diagonal part of a product of two (or three) matrices. I tried two different approaches: computing the standard matrix product and then extracting ...
3
votes
2answers
332 views

Maximum brightness of two gray scale images

I am using the answer of bill s in Greater operator should give greater element. Here he showed the example: ...
1
vote
1answer
55 views

Export list entries under a certain condition without using loops

I have a big list that contains many 3D- chains (set of points) and for each of them a polynomial. So the structure of my list is for example ...
4
votes
2answers
283 views

Finding the position of a specific value in a list

Is it possible to easily find the position of a specific value in a list? For example, if the list is {{x1,y1},{x2,y2},...,{xn,yn}} I would like to know the ...
4
votes
2answers
587 views

Replace a column in table with a list of numbers?

I have a Table of values e.g. {{x,y,z},{x,y,z},{x,y,z}…} How do I replace the the "z" column with a List of values?
0
votes
0answers
42 views

More efficient way of filling in a specific entry in a list of lists [duplicate]

"coords" is a list of coordinates in the 2D plane ordered in a specific way, with the 3rd (z-axis) positions left empty to be filled in with specific values, like temperature or concentration at the ...
0
votes
2answers
57 views

Random Matrix with criteria

I want to construct $k$ lists $M$ of positions $(i,j)$ for a matrix $X$ of size $n\times m$, where all entries are "painted" with "white" color. The distribution of such a list $M$ must obey the ...
2
votes
2answers
58 views

How to transform the $y$ values in a list of $(x,y)$ pairs [duplicate]

How can I transform data = {{1, 0}, {0, 1}, {1, 1}} to {{1, f[0]}, {0, f[1]}, {1, f[1]}} This is similar to ...
0
votes
0answers
41 views

output has a term uncomputed

I am trying to sum the all numbers in each row of matrix and divide them by the max value of the row. My output has the following terms that has not been computed yet (example, the second element in ...
1
vote
1answer
67 views

How to do abstract matrix operation?

In this simple example, I have 2 lists, each of which contains 3 matrices。 $J$ here is also a matrix with the same dimension. What I want is $aJc+bJ(b+c)$, but if I use dot product, the result is as ...
-1
votes
2answers
164 views

Selecting points inside a closed curve

Let's create a rather dense grid of initial conditions ...
29
votes
4answers
1k views

Filtering beat-to-beat heart rate data

From an experiment, I have a dataset of beat-to-beat heart rate data: a list of the time between each heart beat in [ms]. The data is measured using an infrared optic sensor at the finger tip. The ...
0
votes
2answers
69 views

Selecting the maximum value from the results returned by NSolve

I'm trying to select the maximum value from the answers Mathematica 7.0 is getting from a simple basic NSolve algebric equation : ...
3
votes
3answers
124 views
0
votes
1answer
31 views

How to pair elements of a nestlist? [duplicate]

I have a this list for example expdata={{49, 50, 51, 52, 53, 54},{0,3,5,2,0,1}} and I want to rearrange it like this ...
6
votes
5answers
528 views

another way to do this mapping of a two argument function

Sorry, I'm just starting to learn mathematica. I have the following two-argument function: h[{x_, y_}] := x ^ y When I do the following: ...
2
votes
1answer
91 views

Python Convolve2D functionality in Mathematica

I am new to mathematica. I am looking for an alternative for scipy.signal.convolve2d. I did find functions like ListConvolve, ...
0
votes
0answers
60 views

Henon Map Equation Trekker

I am trying to make an Equation Trekker for the Henon map in the following way: ...
1
vote
1answer
33 views

Converting a list of lists of indices into a sparse matrix of ones and zeros

I have data formatted like {{a,b},{c,d},{e,f}} where each entry is an integer. I need to turn this in to a sparse array with entries ...
0
votes
1answer
59 views

How can I get the differences of all elements of list? [duplicate]

I want to get the difference of all elements of a list for example: $L=\{1,2,3,4,5,6\}$ for any $i$ and $j$ $\in L$ return the differences, for example for the first element $1$ we get the difference ...