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

learn more… | top users | synonyms (5)

0
votes
1answer
51 views

How to make a maximum intensity projection of 3D data?

I am trying to make a maximum intensity projection of my 2D data, which has several intensity values in the third dimension and therefore makes the data 3D. So I want to take the maximum intensity of ...
1
vote
4answers
109 views

position with multidimensional array

I have this code: ...
2
votes
3answers
150 views

Give a common denominator to a whole list

If I have a list, say ...
14
votes
5answers
538 views

A quicker than outer

I need to get a matrix $\{a(x_i-x_j)\}$, where $x_i$ form a partition of an interval, $a(x)$ is a given function. I use ...
-1
votes
1answer
49 views

Extracting a random sample from a list [closed]

This is sample data data = {{1, 1, 1, 1, 1, 1}, {2, 2, 2, 2, 2, 2}, {3, 3, 3, 3, 3, 3}, {5, 5, 5, 5, 5, 5}, {6, 6, 6, 6, 6, 6}} My actual data contains ...
2
votes
2answers
67 views

ReplacePart with processed value [closed]

To illustrate, suppose I want to change the {2,2} element of a matrix. If I know the replacement value, I can just make the replacement. ...
0
votes
0answers
28 views
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
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 ...
6
votes
1answer
428 views

Does Mathematica have a functional programming idiom to loop over a list till a condition is met? [duplicate]

The module below takes a list of integers and performs fadic addition on it (if a bit slowly). ...
2
votes
0answers
39 views

Product of two list of different size [closed]

This has to be very easy, but i can find it. I have 2 list a={8, 15, 12, 1, 13, 21, 14, 4, 15} b={3, 19, 29, 47, 13} What ...
3
votes
1answer
60 views

Generate a new list

Suppose we have the following sample data ...
8
votes
2answers
202 views

How to interleave data in a certain way

Here's the deal: I have a table that has the form list = {{A,{a,b,c}},{B,{d,e,f}},{C,{g,h,i,j}}} and so on, where the innermost lists can have an arbitary ...
1
vote
0answers
81 views

How to get the values out of Alternatitves?

Saying we have something like: SomeFunction[ ... { Alternatives[1, 2, 3] :> "something" } ... ] How can I know if ...
10
votes
4answers
328 views

How to take and evaluate a specific part of a list without evaluating the rest?

I have a large list, for example, lis = {x + y, x y, Sin[x] y + Exp[y], x^2 y} and its elements depend on variables x and ...
2
votes
3answers
56 views

Cardinality of members of a list [closed]

I have to count all the words in a book. I need the cardinality (occurrence) of all the words. {{Table,30},{the,200},{apple29}, etc... I Splitted, and StringTrimed ...
1
vote
1answer
87 views

Find intersections points with axes

Let's create some points corresponding to a simple closed curve ...
6
votes
3answers
121 views

Grouping words by their differences

I'm a new guy here and I face a problem. I should pair the following words according to the rule: pair the words, that differ by max. 2 characters, like: ...
5
votes
1answer
83 views

How to order a list to match the order of another list?

How can I order a list to match the order of anoter list ? For example: Suppose I have the lists x = {3, 1, 5, 7} and ...
0
votes
1answer
31 views

add " for all member of the last (1 and -1 positions)

I have a small problem with a list. I did, that list={AA,BB,CC} and I wish to make it into the form of {"AA","BB","CC"}, but I cant insert ", because failing, I tried simply adding, or MapThreading, ...
1
vote
2answers
56 views

Creating authomatically inequalities/equations from a list of polynomials

I am trying to learn how to make automatically from a list of polynomials (or an arbitrary collection of algebraic expression) a list of inequalities/equalities (those will later serve as constraints ...
1
vote
3answers
56 views

List addition of certain elements

I have a list f, y={{a},{b},{c},{d},{e},{f},{g},{h}...} I want to sum the first 3 in this list and divide that value by 3 and append to a new list. Then repeat ...
1
vote
2answers
114 views

Apply tranformation to particular list elements

I have a list with elements {a -> -1, b -> -2, c -> -3} If I now wanted to apply a tranformation to b and ...
2
votes
3answers
47 views

Assigning sections of a matrix to lists based on row value

I'm working with a very large (4x41355) matrix and I'm trying to make lists out of sections of rows based on the value in the fourth row. It's like this: ...
2
votes
2answers
76 views

Extracting elements from a list in to a new list [closed]

Currently I have a list such that, ...
2
votes
4answers
161 views

How to remove elements from a list that are less than a certain number? [closed]

If I have a list like: list = {23,21,18,15,13,12,10,9,8,7,7,5} How can I remove numbers from that list so that no number less than 13 is on it without ...
2
votes
2answers
83 views

Expression in Part[] index

I'm new to Mathematica, and I have a problem with the following kind of code: f[x_] := {1, 2, 3, 4, 5}[[Mod[Floor[x], 5] + 1]] Integrate[f[x], x] When I run ...
3
votes
2answers
61 views

How do you add one chart to the right of another? [closed]

I have two charts, and I would like to insert the data from one at the end of the other. However, the one chart has multiple ListLinePlots, and when I use Show to try and place the two together, the ...
4
votes
6answers
403 views

Remove the odd element from a list

I have a list, which contains more lists with elements, see example {{1, 1, 1, 1, 2}, {2, 2, 2, 2, 3}, {3, 3, 3, 4, 3}} I want to remove num 2 from the first list ...
1
vote
2answers
73 views

Element-wise join multiple lists [closed]

The following question is related to: Elementwise join I have the following code: ...
12
votes
1answer
280 views

Mapping on leaves

Say I have some nested structure, such as {a,{{b,c},d,{e,{f,g}}}}, and I want to apply a function $q$ to each of the leaves; that is, I want the output to be ...
3
votes
2answers
35 views

List manipulation related [duplicate]

I have two lists l1={a,b,c} and l2={{a1},{b1,b2},{c1,c2,c3}}. What kind of operations can I use to get a list like ...
5
votes
1answer
103 views

How to increase speed of iterations with nonlinear functions

Let me ask about part of a problem which I have in solving of a nonlinear DE (numerically). I am working with vectors of length $xN$. I have an initial vector $v$, a given $xN\times xN$ matrix $A$ and ...
4
votes
1answer
107 views

How to re-assign values to a List of variables?

The accepted Answer to this similar Question can only be used one time, so it's not suitable for my problem. I do high-dimensional calculations for which I need to make lists of variables, like so: ...
2
votes
2answers
80 views

Merge two trees into a rectangular matrix in Mathematica

How can I merge two trees, t and s, so as to form a square matrix below, where both trees starts from top-left (as shown), and ...
6
votes
1answer
170 views

Improving Pop-Up Workspace in Mathematica

Despite the recent improvements to Mathematica's statistical/data analysis tools it still doesn't have a built-in workspace interface for organizing and interacting with user defined ...
1
vote
0answers
72 views

Lower memory usage and speed nested loops

I'm trying to make some tracking with Mathematica. ...
7
votes
3answers
205 views

Deleting any list that contains a negative number

We had another nice question in a student activity today. The increasing sequence of positive integers $a_1,a_2,a_3,\ldots$ has the property that $$ a_{n+2}=a_n+a_{n+1} \text{ for all } n\ge 1. $$ ...
5
votes
3answers
401 views

How to calculate a list without loop?

I have pairs of numbers {a1, b1}, {a2, b2}, {a3, b3}, ..., ...
10
votes
7answers
243 views

Extract left-upper triangular data from a square matrix-form list

Hopefully, this question is not too basic or obscure. I'd like an idea on how to extract this {{1}, {5, 2}, {9, 6, 3}, {13, 10, 7, 4}} from ...
1
vote
2answers
99 views

A better way than using nested For-loops to make a search list

I'm generating a List that can be up to 26 values long, a simplified example is below. Is there a better way than nested loops? ...
4
votes
0answers
47 views

How to transform a tree-form list to matrix-form list in Mathematica? [closed]

Excuse my naive question. Is there a quick/efficient way to transform {{1}, {1, 2}, {1, 2, 3}, {1, 2, 3, 4}} to a lower-triangular matrix-form ...
1
vote
5answers
331 views

How to repeat a string?

I really can't find a way how to multiply (repeat) strings in Mathematica. How to write this shorter? ...
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 : ...
1
vote
1answer
52 views

Problem averaging multiple series of data [duplicate]

Recently I'm having trouble figuring out a certain problem in Mathematica. I have a table of data in the following arrangement: {series no., x, y} Now, each series of data has exactly the same x ...
0
votes
2answers
61 views

Numbering the elements of a list

From a vector q={Gamma,x,y}, I would like to create the following corresponding list : qn={1,2,3}. Other example, if I have ...
2
votes
1answer
53 views

If I want a function only applies to the elements of a specific list, how should I define the function? [closed]

If I define a list: list={1,2,3,4}; and I want a function f to apply only to the elements in the list (for here it is ...
27
votes
3answers
493 views

Cyclic Take function? [duplicate]

Is there some direct and simple "cyclic Take", sometimes also known as "overtake" in Mathematica. That is, if the take specification runs out of elements, it just cycles back to the beginning (as many ...
4
votes
1answer
48 views

apply a constraint to summation limits

I have a list as list={{-0.5, 5}, {-0.25, 2}, {0, 3}, {0.25, 2}, {0.5, 5}} and I want to use of Esc+sum+Esc symbol for ...
8
votes
1answer
89 views

Understanding Part and Span operating on expressions with heads that are not List [duplicate]

I hope this is not a duplicate. I do not understand how does the Part and Span functions work on this expression: ...