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

learn more… | top users | synonyms (3)

0
votes
0answers
25 views

Help needed with assignment

Can I get some help with this: Write a module which as an input receives two matrices, the first matrix transforms in to the same matrix, but in the new matrix occur absolute values of the first, ...
1
vote
4answers
100 views

Drop row if sum of part of row is equal to zero

My problem is the following: Suppose I have a matrix A which looks the following: ...
1
vote
3answers
61 views

Use Do to evaluate an expression over two indices $i \ne j$ (over a list of tuples)?

I have an expression of the form: expr1[i_,j_] = Sum[\[Beta][j]*\[Phi][i, j]* C[i] I would like to evaluate this expression over i=1:4, j=1:4 with i!= j. One ...
5
votes
5answers
2k views

Delete duplicate elements from a list

If a list contains duplicate elements, for example list = {a, 1, 5, 3, 5, x^2, x^2}, how can the duplicate elements be removed? The result would be ...
1
vote
3answers
65 views

ListPlot the results of FindMaximum

I want to plot a list of the form whose elements are of the form {value, {x -> value_x, y -> value_y}} The list generated by FindMaximum applied on ...
5
votes
3answers
245 views

Generate a list of equations of curves and plot them

I want to plot a series of lines. This is how I did it: ...
0
votes
1answer
53 views

Finding the points where the derivative is zero [on hold]

I want to find points where the derivative of a function is zero. Therefore, I discretize the waveform (vbusa) and have substituted time and voltage values into the ...
2
votes
2answers
105 views

make trace of a matrix listable?

I have a list of 2 by 2 matrices and I want the list of their traces. I have been using Map[Tr,mylistofmatrices] But I wonder if there is a way to make ...
1
vote
0answers
40 views

Fast construction and reshaping of large tensors

I'm trying to construct a large matrix which is derived from some higher rank tensor (the rank of interest to me changes case by case, so it needs to be a general method). Currently, the process of ...
1
vote
1answer
40 views

When plot a list, how to Manipulate a sequence of defined functions at the same time?

I am trying to plot a sequence of functions, for example{(a+b)^i},{i,1,100}. All the expressions I have stored in the list. Now I want to plot them and see how their value would change if I change ...
0
votes
0answers
42 views

How can I make rows into columns? [on hold]

I want create new columns and rows from the following list of data using Mathematica: {{11, 12, 13}, {21, 22, 23}, {31, 32, 33}} I want the new for be like this: ...
2
votes
1answer
45 views

Problem with plotting data (.csv)

I have a problem with plotting the data of a recent experiment. I'm quite new to Mathematica, but searched the documentation and forums without solving my issue. My data is stored in a .csv document, ...
8
votes
2answers
146 views

Simple way to concatenate Dataset columns

Consider these two datasets: d1 = Transpose@Dataset[<|"a" -> Range[5]|>]; d2 = Transpose@Dataset[<|"b" -> Range[5, 1, -1]|>]; {d1, d2} What's ...
0
votes
0answers
22 views

To make a list from a For Loop [duplicate]

I have been working on a for loop and generating around 2500 integers from that. Now I am interested in calculating the Max or Min of those numbers. How to create the list of those numbers? So that ...
1
vote
0answers
48 views

Compilation of a function that needs to call Subsets

I'm working on a code that runs many (easy) operations on combinations (subsets) of different size (6, 7, 8, 9) taken from a big set of numbers (normally more that 40). So, this means the code has to ...
1
vote
3answers
87 views

How to map over the corresponding elements of matrices [on hold]

I'm working on some genetic algorithm code, and I'm seeking help to select the corresponding elements of a matrix in order to perform crossover on the chromosomes in population of individuals I want ...
2
votes
1answer
86 views

How can I run a summation numerous times?

I have been working on code for finding the Allan plot of generated white noise, however, I cannot figure out a way to automate it for a different range of numbers. My code is as follows: ...
2
votes
1answer
161 views

How to build a list of constraints for NMinimize

Let's say I have aset = {-1, 0, 2}. I would like to create a variable Var that takes values from that set, i.e. ...
3
votes
0answers
61 views

Map an Argument to a list of functions

I want to "map" an argument to a list of functions. Here is the concrete Problem. I generate a list "Messungfit" of functions: ...
0
votes
1answer
171 views

Making table and plotting results of NDSolve problem

I am trying to solve two equation to find /[Phi][x] and plot h vs. /[Phi][x] for different values of L.I tried by writing as: ...
0
votes
3answers
51 views

Apply every function from a list to an expression

I would like to apply a list of functions to an expression, like ApplyList[{Re, Im}, Exp[I x]] = {Cos[x], Sin[x]} How do I do that?
18
votes
8answers
1k views

Selecting a sublist based on Length

If you have a simple list of lists as follows: test = {{1, 2}, {4, 5, 6, 7}, {5, 4, 3}} How do you ask Mathematica to return the sublist of greatest length? ...
0
votes
1answer
61 views
3
votes
2answers
226 views

Binarizing a matrix

I have an image with a few bright pixels with the remaining ones very dark. The difference is in orders of magnitude. I want to binarize this matrix (corresponding to the image) making all values ...
10
votes
6answers
520 views

How to find all the positions of max value of a list efficiently?

For Example, list=RandomInteger[{1,100},2000]. Yes,I know Position[list,Max[list]] can do. But it's based on pattern ...
5
votes
4answers
182 views

How to multiply lists of data?

Let two lists of data, say lst1={{x1,y1},{x2,y2},...,{xn,yn}} lst2={{x1,z1},{x2,z2},...,{xn,zn}} I need to construct a third list ...
0
votes
3answers
97 views
2
votes
1answer
94 views

Approximation of definite integral by parabolas

This question is related to Trapezoid approximation to definite integral. As promised, I am now asking about how to draw approximation of integrals by parabolas. I tried to modify MarcoB's code, and I ...
5
votes
3answers
103 views

Handy / flexible directory tree operations

Is there any shorter / more handy / more flexible way to get directory tree as a nested Rules/Associations list? I tried to incorporate ...
0
votes
0answers
33 views

Standalone cdf with precalculated result

I'm wishing you a nice day. I needed some interactive plots so I used Manipulate. My function is function of several parameters, let's call it $f \left( L, \Gamma, ...
2
votes
1answer
73 views

Generating list of functions from list of expressions

I know how to create a function from concrete expression like Function[{x, y}, x^2 + y^2] But what if I have a list of expressions list1 and I know the set of ...
11
votes
2answers
181 views

Faster trimming of leading/trailing zeroes in rectangular array

Given a (large) rectangular array, e.g. (small for example case): ...
2
votes
2answers
269 views

Generating complete lists of polynomials

I would like to generate a list of all $3$-variable Laurent polynomials with non-negative integer coefficients using a looping construct so that I can, one-by-one, check them for specific ...
6
votes
2answers
159 views

Subsets or Outer?

How do I generate all possible subsets of a list of positive numbers (with at least 1 of them), given that each of these positive numbers subvariates itself on its input value and its multiplicative ...
2
votes
1answer
160 views

Match a sequence of integers

I would to match a pattern p1 = 0,0,1,0,0 to the elements in listA. The elements are a boolean sequence that may look like this ...
5
votes
5answers
162 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
112 views

Constructing lists in an efficient way

I have a list of functions and I want to separate them into two lists: a list that contains the functions that have at least one zero and a list that contains the functions that do not have ...
2
votes
1answer
41 views

how to manipulate indices in a table/vector

Perhaps I'm missing something very basic. Could somebody guide me how to manipulate indices of a list. For example, if I've u = Table[Subscript[u, i], {i, 1, lp + 1}]. I've these u in an expression, ...
25
votes
1answer
613 views

Undocumented form for Extract

Prompted by a comments conversation here, here's an interesting (and often performance enhancing) use of Extract: ...
0
votes
1answer
44 views

List operation list1 >= list2 should compare elements

I need a compare-operation for two lists of same length (usually > 100000) which does the following: {2,3,5,4,1,8,7} ...
13
votes
8answers
797 views

How to Map a subset of list elements to a function?

How would you, given a list {1, 2, 3, 4}, apply a function f to 1 and ...
8
votes
2answers
241 views

What does IndexBy do and how exactly does it work?

I just saw the function IndexBy in the autocomplete suggestions and I was curious to know exactly how it works. Unfortunately, there's no trace of it in the ...
3
votes
2answers
57 views

Select elements from list with given head

I would like to select elements from list by specifying their head. E.g. SelectWithHead[{1,2,3.5,x}, Symbol] = {x} SelectWithHead[{1,2,3.5,x}, Real] = {3.5} What ...
5
votes
4answers
201 views

Dynamic list in which the sum of the elements is invariant under changes to the elements

2nd Update Here's a snapshot of a graphical user interface I'm thinking. I hope this could be self-explanatory and demonstrate the functionalities I mentioned in the 1st update. Thank you all! ...
1
vote
1answer
83 views

How can Tally group elements that differ only by a sign together?

I have a list {{1,-2},{2,2},{-1,2},...} and I want to use Tally to count how often a given pattern appears in the list. This works perfectly, but in addition I ...
3
votes
2answers
93 views

Plot 2d-ItoProcess data in a plane

I am trying to simulate a simple 2d Ito SDE (randomly perturbed Hamiltonian system). Below is the code. ...
0
votes
0answers
37 views

What is the right way to remove head of a number? [duplicate]

I often have a number for which I want to remove its head, e.g. {1}. I know of two ways to remove the head: {1}[[1]] # & @@ {1} Neither of these methods seem ...
0
votes
1answer
34 views
0
votes
2answers
25 views