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

How to plot point by point in a for loop?

I first apologize for my english which is still approximative and for the spelling, I hope all will be clear. My problem is the following: I need to first solve a non-linear implicit 2-...
2
votes
2answers
49 views

Retaining rows with only non-zero values in a large table

I am not sufficiently proficient in Mathematica so my question may be stupid, apologies. I have a long table with chronological data over several variables. In some instances, the data are missing, ...
3
votes
3answers
114 views

Measuring multiple incidences of a continuous constant in a list

I had a hard time trying to word this question properly; I apologize... So I have a (very) big list of 0's and 1's: AllTimes = {{0}, {0}, {0}, {1}, {1}, ...} ...
5
votes
4answers
115 views

Distribute an integer $m$ to lists of length $n$ in all possible ways? [duplicate]

I need a function that creates a table of all possible lists of length $n$ which contain integer entries that sum up to the same given number $m$. For example, if we consider lists of size $n=3$ and ...
4
votes
2answers
264 views

Repeatedly applying a function

I have a list of numbers: allNums = {2, 5, 10, 17, 26, 1, 3, 7, 13, 21, 31, 1, 2, 11, 28, 53, 1, 6, 19, 40, 69} I calculate all possible pairs of two numbers ...
1
vote
0answers
105 views

Insert elements in several positions in a list [closed]

How to insert multiple elements in a list? list={1,2,3,4,5,6,7,8,9} Output: ...
4
votes
2answers
160 views

Finding the positions DateList dates in a range in large data set

There are similar questions to this like list search but this question is focused on finding at subset of dates in DateList format within a range of specified dates ...
4
votes
2answers
141 views

Extract part of a matrix

I have imported a matrix from a .txt file (it could be better from an Excel file): ...
9
votes
6answers
367 views

Converting a list of rules to a list of lists

What are some easy ways to convert the list of Rules ...
14
votes
5answers
400 views

Pick elements from list “separately”

I have the following list I want to pick elements from: mylist = {1, 5, 7, 3, 4, 7, 2, 9, 9, 1, 10, 12, 2, 64, 34, 64} I have another list with 0's and 1's which ...
5
votes
2answers
146 views

Extending a list

I have a range of n integers (always starting at 1) which are 1 apart, f.e. Range[10], Range[17] or ...
3
votes
2answers
78 views

union several arrays of same flag(date for example) efficiently

Suppose I have several arrays from data files which look like: arrayi = {{datei1, xi11, xi21, ...}, {datei2, xi12, xi22, ...}, ..., {datein, xi1n, xi2n ,...}} ...
5
votes
4answers
151 views

SubsetQ[] without ignoring duplicates

How could one create a code that checks whether a set is a subset of another, but not ignoring the duplicates? For example, $\{1,1,1\}$ would be a subset of $\{1,1,1,1\}$, but not vice versa. ...
0
votes
0answers
85 views

Nestlist inside Compile

My question is a continuation of question1 and question2, but I think it may be considered as a self-contained one. I am interested to make the following code faster ...
5
votes
4answers
191 views

Concise alternative to First@First@Position[…, 1,Heads->False]

Is there a more compact way to accomplish this: lst = {0,0,7}; idx = Position[lst, Except[0], 1, Heads -> False] // First // First (* => 3 *) For ...
1
vote
1answer
97 views

Iterations in Mathematica [closed]

this is probably a very easy question for all of you. I have a stochastic Mathematica code (not important what it's exactly) which gives me a number at the end. Now I want Mathematica to run this ...
0
votes
1answer
134 views

Mean squared displacement of a single trajectory

I have a single particle trajectory and would like to calculate the mean squared displacement. The particle is moving from blue over yellow, green to red data points. The {x,y} data are available ...
0
votes
1answer
73 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
124 views

position with multidimensional array

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

Give a common denominator to a whole list

If I have a list, say $\{\frac{1}{36},\frac{1}{36},\frac{1}{18},\frac{1}{18},\frac{1}{12},\frac{1}{12},\frac{1}{12},\frac{1}{12},\frac{1}{12},\frac{1}{12},\frac{1}{12},\frac{1}{12},\frac{1}{18},\frac{...
15
votes
5answers
551 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
58 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. ...
1
vote
1answer
41 views
2
votes
3answers
57 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
94 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
502 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 I'...
3
votes
1answer
64 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
85 views

How to get the values out of Alternatitves? [closed]

Saying we have something like: SomeFunction[ ... { Alternatives[1, 2, 3] :> "something" } ... ] How can I know if ...
10
votes
4answers
338 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
64 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
106 views

Find intersections points with axes

Let's create some points corresponding to a simple closed curve ...
6
votes
3answers
131 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
105 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
63 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
59 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
117 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
48 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
79 views

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

Currently I have a list such that, ...
2
votes
4answers
253 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 hardcoding,...
2
votes
2answers
91 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 this,...
3
votes
2answers
63 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
433 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
86 views

Element-wise join multiple lists [closed]

The following question is related to: Elementwise join I have the following code: ...
12
votes
1answer
283 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
40 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
117 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 ...