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

learn more… | top users | synonyms (3)

4
votes
2answers
94 views

Finding column-wise ranks of values in a multidimensional list

I often have to find ranks of values in a list. However, Mathematica does not have built-in functions for that, or may be I'm just not aware of them. I can easily find ranks of a row/column vector. ...
1
vote
1answer
147 views

LinearModelFit[] of simulated data

I'm trying to simulate Hooke's law, f = k * x, so I generate data with the code: ...
1
vote
1answer
70 views

Importing, sorting and exporting lists

I have several TSV lists (.txt) of something like 2000*2000 numerics (e.g. 1.8645) to import ...
0
votes
0answers
64 views

Autocorrelation of 3D Points

I'm trying to compute the autocorrelation of a list of points (x,y,z) in 3D. Can the CorrelationFunction or maybe ListCorrelate ...
-1
votes
1answer
41 views

Convex Combinations of List Elements

Let's say I have two lists $L_1=\{a_1,...,a_5\}$ and $L_2=\{b_1,...,b_10\}$. Is there an easy way to make new lists from convex combinations of these two lists' entries? Let me be more specific: 1 ...
1
vote
6answers
150 views

Converting two lists into a list of tuples [duplicate]

I wonder how I can turn the list $\{a_1,...,a_n\}$ into the new list $\{(a_1,1),...,(a_n,n)\}$, i.e $a_k \mapsto (a_k,k)$, how do I do that? I figured the function Tuples might work, but it just ...
0
votes
1answer
37 views

Delete String sub list

I have a list with several sub lists containing either strings or integers. I'd like to delete all list with strings. The following list ...
3
votes
1answer
63 views

Finding pairs where the intersection of them is empty set from a nested list

It would be better to give an example first. Suppose I have a nested list of the form list = {{ 1,2,3,6}, { 3,6,10,20}, { 4,7,11}, { 10,20}}; where each element ...
2
votes
3answers
115 views

Function like Cases/Select which also returns complement

I'm looking for a function similar to Cases or Select, but that also returns the complement of the resulting list. In other ...
2
votes
1answer
80 views

Dirichlet convolution of two lists [closed]

The Dirichlet convolution of two arithmetic functions f,g is defined by $f*g(n) = Sum_{d|n} f(d)*g(n/d)$ How can I get the Dirichlet convolution of two lists? For example: Input: ...
0
votes
0answers
54 views

Using NestList instead of Do [duplicate]

How can I express the following code using NestList: ...
3
votes
2answers
96 views

How to define a list of symbols as a list of functions?

I have a list in Mathematica for example P={1+t,1+t+t^2,1+t+t^3}; My question is, how I can define each element of this list be a function of ...
0
votes
2answers
100 views

Exclude elements from mapping

I have had this problem way too often and still have not found a solution, yet. One acually used code is:` ...
1
vote
1answer
32 views

Cannot use Part in Pure Function [duplicate]

I need to select some lists in the nested list of form of {{1,2,3},{2,3,4}}. I have used Select to complete my work. But when I tried Position, it doesn't work. For example, ...
7
votes
5answers
333 views

Calculating weird numbers

A weird number is a number such that the sum of the proper divisors (divisors including 1 but not itself) of the number is greater than the number, but no subset of these divisors sums to to ...
2
votes
2answers
51 views

How to edit a list according to the other list? [duplicate]

Gday guys. This problem troubles me, and I hope you can help me solve it. Say I have two random lists L1={{2},{5},{1},{0},{4},{7},{8}} L2={2,5,1,0,4,7,8} and ...
1
vote
1answer
48 views

Mathematica defines a function as list

This might be a very silly question but i'm defining a function as: \[Chi][AR_] := ((AR^(2) - 1)/(AR^(2) + 1)); which is clearly a scalar function of AR; however ...
4
votes
3answers
78 views

position of rows (or columns) whose elements all satisfy a condition

How do I determine the position of rows whose entries all satisfy some condition (e.g., all elements of the row are positive)? I've found out how to use Select to ...
1
vote
1answer
63 views

Transform List from {a,a,b,b,b,c} to {{a,2},{b,3},{c,1}} [closed]

The title pretty much says it. I want to map over the solutions returned by Solve but want to avoid calculating the same thing over and over again. e.g. ...
3
votes
1answer
87 views

Creating an autokey cipher function

Can someone help me with putting what I can say in words into code. I want to create autokey encrypt and decrypt functions (just wanting help encrypting and then can figure out decrypting). Everything ...
1
vote
1answer
59 views

How to list indices of list elements that meet a condition? [closed]

Is there a tidy way to create a list of the indices of elements of a list that meet specified conditions? This method gets the job done, but it's clumsy and not conducive to nesting: ...
4
votes
2answers
137 views

How to check whether elements of a list meet a condition without generating the whole list first?

I have to find the number of elements satisfying a given condition from the set: Tuples[Tuples[Tuples[{0,1},n],n],m] The condition for $n=3,m=3$ is: ...
5
votes
4answers
174 views

Sort two lists at the same time, based on another

I am new to using Mathematica and I can not find a solution to what I am wanting to do. I want to take a list such as: x = {1,2,3,4,5,6,7,8} and a second list ...
4
votes
4answers
123 views

Counting subsequences (i.e., patterns) within a list?

I would like to count the number of subsequences in list. Say I have data given by: data = {1, 1, 1, 2, 1, 2, 2, 2, 1, 2, 1}; I would like to count the number ...
3
votes
1answer
91 views

Given a list made up of subsets of an alphabet, how can I use associations to create a Boolean dictionary of the given list

I have a list of 30,000 elements, each of the element is a list in itself {{a, b}, {p, q, r}, {a, p}, ..., {z, x}}. Second one contains unique elements ...
8
votes
7answers
283 views

Input a square matrix and return a list of the matrix entries read by antidiagonals

I have a square matrix: {{1,2,3},{4,5,6},{7,8,9}} and I want to get a list: {1,2,4,3,5,7}
0
votes
2answers
75 views

Cases Except - Selective Exclusion

Please help me use Cases,Except on list data. I just want to remove all primes, or equivocally to see only the values in the list produced that aren't prime. the prime factorization of those values ...
6
votes
4answers
158 views

Define Function with Sum over a list

I want to define a function that would symbolically look like $$ t(s,\underline{a})=\pi s + \sum_{n=1}^{n_{max}}a_n\sin(n \pi s) $$ (something like a finite Fourier series). Here $s\in [0,1]$ and ...
1
vote
2answers
43 views

Evaluate list of functions at a certain point

I have a list of functions (actually they are derivatives) of the type: {D[g[x,y],x],D[g[x,y],y]} I would like to evaluate all of these functions at a point, ...
3
votes
4answers
103 views
1
vote
2answers
102 views

How do I remove the quotation marks from each element of a list containing dates that I have import from excel?

I've been stuck in this problem for 1 week. I just want to make a graph (Log-Return vs time (in year, month, day)). The code is: ...
0
votes
0answers
47 views

Selecting values over lists for discrete inputs in NDSolve

I'm currently trying to simulate a step response in a simple tank system with NDSolve. I would like it to start at say time 2 (the precise time is not important). ...
0
votes
2answers
55 views

For Loop in Mathematica {n, factored form of x^(n)-1} for 95<=n<=105

I am new to mathematica. I am trying to write a for loop to print out {n, factored form of x^(n)-1} for 95<=n<=105. I have followed the directions of another for loop, and gotten the following ...
1
vote
1answer
46 views

Summimg peculiar nestings

I have some lists with peculiar nestings: ...
6
votes
3answers
263 views

Finding all sublists or substrings of a given list/string

Given a list or string, how do I get a list of all (contiguous) sublists/substrings? The order is not important. Example for lists: ...
2
votes
4answers
130 views

accessing elements of nested list

I have a list of the form: toy = {{a, {b, c}}, {d, {e, f}}, {g, {h, j}}, {k, {m, n}}}; and would like to create the list ...
1
vote
1answer
66 views

How to use a list of rules as a data set

I have a file of models that I have saved that I want to be able to call in another program to be solved with NDSolve. Can I use ...
0
votes
1answer
52 views

How to use MemberQ for such Variables?

This is NOT the desired out come. I want this test to fail: ...
1
vote
2answers
62 views

Insert an element to AdjacencyGraph

I'm not able to insert an element to mine AdjacencyGraph. I suppose that i should modify my AdjcencyMatrix: ...
2
votes
2answers
82 views

How to rearrange structure and type of an imported dataset?

I have a bigger dataset imported from Excel. Its elements have a form of {time, data}. Day is irrelevant and I would like to have the time in decimal form e.g. 10:30 is 10.5 ...
2
votes
2answers
107 views

How to efficiently get a list like this?

I want a function myfun that generates list like this ...
10
votes
5answers
330 views

For a given expression: if it appears, remove it, but if it is absent, add it

While reformatting Szabolcs's code from (42660) I noticed this interesting operation: ...
3
votes
1answer
125 views

linear combination of successive elements in a list

Say I have a list $E$ and want to build a list $F$ with the entries $F_j=E_j-2E_{j-1}+E_{j-2}$. I know that this happens to be achievable by iterating the function ...
0
votes
1answer
56 views

Correcting a gap in ListPlot

This is a small sample of my data ...
0
votes
0answers
45 views

Generating a list of overlapping end coordinates [duplicate]

I'm a very new user to mathematica so this may be a silly question. i'm trying to evaluate some integral between end coordinates of some evenly spaced range. my range is defined by the number of ...
1
vote
1answer
58 views

How to delete more than one (specific) elements in a list

lst = {a, b, c} DeleteCases[lst, a] Delete one specific element a. How do I delete elements ...
3
votes
1answer
63 views

Converting path list to the nested list

I'm trying to convert the plain path list to the nested tree list like the following codes. ...
3
votes
3answers
224 views

Use map on a different level

I have just started to get used to Mathematica's Map, Apply, and related functions, and I can't figure out how to do maps that require working "one level down". For example, I am currently trying to ...
2
votes
2answers
139 views

How to apply # on different lists? [duplicate]

If I have list1 = {1, 2, 3, 4} list2 = {5, 6, 7, 8} How can I do so, that function[#1, #2] takes ...
4
votes
1answer
89 views

Parsing string with nested information

I am trying to parse a string, but I have no idea how to solve the following problem ...