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

learn more… | top users | synonyms (5)

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
55 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
85 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
81 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
401 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
279 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
102 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
78 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
166 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
400 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
98 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
44 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
328 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
492 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: ...
6
votes
3answers
148 views

Determining closest lists near any selected point

I'm plotting several lists of data (constant lines of density, temperature quality, etc. on a pressure-enthalpy diagram), none of which are fitted well by ...
25
votes
4answers
903 views

How to implement the general array broadcasting method from NumPy?

A friend of mine introduced array broadcasting in the Python NumPy package which is very convenient (and also highly efficient). The idea is perfectly shown in ...
9
votes
1answer
118 views

Is there an efficient way to load a large list to Mathematica from R within Rlink?

I'm working on something that involves using both R and Mathematica. For this something, I first generate a large R list (1000 matrices, each 200x1000, mixed integer and real values) and then need to ...
2
votes
2answers
59 views

Reflect manipulations on one list in a second list

I'd like to mirror the manipulations (specifically deletion, insertion, and reassignment) done at each position of two equally-sized lists, based on the contents of only one of those lists. As an ...
4
votes
1answer
55 views

How can I get all pairs of values from an association with elements key->list

I have an association of the form ds=<|key1 -> list1, key2 -> list2,... ,keyn -> listn|> I would like a simple way to map a function to all pairs ...
1
vote
1answer
66 views

Using Select function based on data range

I am using Select to take values from a multidimensional list based on a previously calculated range. The list is of time and position of a particle over time steps done for multiple particles. The ...
3
votes
2answers
115 views

Customized ListPlot

I have an external data file containing the elements (t,x,y,px,py) of an orbit. Here is a sample data file. Now I want to ...
5
votes
2answers
314 views

Smallest element distance between two lists

I have a problem, where I generate two lists of points, and I want to see which points are the closest. If I just want to find which ones are exactly the same, I can use ...
1
vote
3answers
231 views

Command like “find” in Matlab [closed]

Is there a command working exactly like Matlab's find? I know that Pick might work, but I just want to give a logic condition ...
1
vote
2answers
192 views

How to speed up a For-loop [closed]

My code is the following: ...
3
votes
1answer
75 views

Who can explain the strange behavior of command “Last”

Situation I use Last to extract the last element of an expression. Let poly=a+b*c+Log[a]+z. Problem When Using ...