Questions tagged [list-manipulation]
Questions on the manipulation of List objects in Mathematica, and the functions used for these manipulations.
547
questions with no upvoted or accepted answers
1
vote
0
answers
47
views
Sortable Grid-like control for large data sets?
I've been using a roll-your-own function for a while that's a wrapper around Grid which adds a couple things I always use, like headers, dynamic sorting, filtering, and clipping (only showing the ...
1
vote
0
answers
75
views
How to create this list
Suppose I have two kinds of operators $a[i,j],a^\dagger[i,j]$ where i is a non-negative integer and $j=\pm 1$, I want to create a list containing all possible products of
$ a^{(\dagger)}[x_1,j_1]a^{(\...
1
vote
0
answers
39
views
What subsequences does SequenceReplace consider
Consider SequenceReplace[{a, b, x, x, a, c}, {a, e_} :> e].
What subsequences does SequenceReplace consider?
The ...
1
vote
0
answers
55
views
Error using list of discrete variables with WhenEvent
I came across an error when using a list of Discrete Variables with NDSolve and WhenEvent. As you can see in the minimal example, where I defined the 'testevent', when I use ...
1
vote
0
answers
112
views
"Total" function for a Boolean expression
I have a very long vector of the form
...
1
vote
0
answers
70
views
How does this FromDigit module work?
I am entering the following input:
...
1
vote
0
answers
86
views
What is "Flatten" doing to my elements?
Here's some of my code. x1 results in returning the position of a list in a {{{n1}},{{n2}}...}. Im trying to flatten it such that the list reads out as {n1,n2,n3....} some how it's adding elements.
...
1
vote
0
answers
66
views
Problem using KarhunenLoeveDecomposition
I have a matrix called stochasticData.mat which size is 211302*50 and I need to perform the Karhunen-Loève decomposition on it to calculate the uncorrelated random variables. Note that stochasticData....
1
vote
0
answers
86
views
Symbolic add of 32Bit Registers
I would like to perform multiple 32bit word register additions (mod 32 add. with variables of Boolean type shuffled with symbolic type).
For this task I implemented a ripple adder function:
...
1
vote
0
answers
34
views
Fastest way to do repeated subsample/Intersection calls over large set of vectors
In this answer I found I needed to calculate a bunch of intersections of subsets of vectors, like
...
1
vote
0
answers
46
views
Generation of nested list
Does anyone know a better way get the output generated by this code:
Table[Table[{b-a,b},{b,7}]{a,7}]
1
vote
0
answers
77
views
Custom Table, for iterating over permutations
It is common that I iterate over all permutations of 1,2...,n, either by making a table or performing a sum.
Instead of creating the set of all permutations, it would be better to iterate over them.
...
1
vote
0
answers
36
views
How can I create a ParallelTable with finer resolution at certain points?
For example, say I have a function testfunc already defined to take one argument $x$. This command would create a table of ...
1
vote
0
answers
45
views
How to confirm the list of plot unique
I have a list of plot in a list called modes. I am interested in knowing whether this list is unique or not, meaning all the plots are different from one another. ...
1
vote
0
answers
41
views
Using the Line command with a bound on distance between points
Suppose I use the Line command applied to a list (or more accurately apply Graphics[Line[list]] or ...
1
vote
0
answers
57
views
Long execution time using position
I have two lists, for example:
List1={2,4,6,8,10,12}
List2={4,10,12}
I want to find the positions in List1 such that the element at that position is equal to the ...
1
vote
0
answers
63
views
Evaluate For Loop for a fixed number of iterations
a = Table[Prime[n], {n, PrimePi[i]}]; b = Delete[a, 1]; p =
IntegerPartitions[i, 4, b]; Total[
Times @@ Values[1/Factorial@#] & /@ Counts /@ p];
I need to ...
1
vote
0
answers
63
views
finding primes using chebyshev bias
Using the problem from my previous question link. For each n, that is n= $10^3$ to $10^6$ with a ten-fold increase, how do I use Chebyshev Bias to display the number of primes (which are in the ...
1
vote
0
answers
60
views
1
vote
0
answers
37
views
Solving a system of differential equations whose one of the coefficients is imported data
Suppose we have a coupled system of differential equations:
\begin{equation}
\frac{db}{dt}=(- \gamma_b -i\omega_b)b-i\frac{g}{2}p;\quad
\frac{dp}{dt}=i\frac{g}{2}\Delta N(t) b-(\gamma_a+\gamma_b+2iJ)p....
1
vote
0
answers
62
views
Find parameter ranges of a function whose value is within a window by sampling points
Problem:
I want to find the ranges of the parameters for a function $f(x,y,z)$ when $0.9 < f(x,y,z) < 1.1$. All parameters are bounded $x , y, z \in [0,1]$. In the real problem the function ...
1
vote
0
answers
79
views
Problems with using Riffle, Grid and TableForm
I have the following Table:
...
1
vote
0
answers
69
views
Importing multiple files setting the name with tostring
I'm trying to import several matrices, which contain a pattern in the name. I create first their names in a table
...
1
vote
0
answers
55
views
Closest number between two lists within a given tolerance
If I have two large list with numbers such as:
list1={number1,number2,number3..........etc} list2={number1,number2,number3..........etc}
Question:
How can I find ...
1
vote
0
answers
66
views
Apply DateObject to a whole list
I'm trying to apply DataObject to a whole list.
It looks something like this.
...
1
vote
0
answers
40
views
Generating a list of the degree-$n$ Kronecker polynomials
A Kronecker polynomial is a polynomial such that
Its coefficients are integers,
Its roots are on the unit circle or $0$,
Its leading coefficient is $1$.
From here, there are finitely many Kronecker ...
1
vote
0
answers
105
views
List of arrays in Mathematica
How would I declare a list of arrays and treat them as single objects? For example, I may have the Pauli matrices:
$$
\sigma_0 = \begin{bmatrix}1 & 0 \\ 0 & 1\end{bmatrix}, \sigma_1 = \begin{...
1
vote
0
answers
41
views
Using Select for lattice points
I know how to use Select to generate a list of numbers which satisfy a certain condition. However, I am not sure how to do this for points (specifically 2-tuples) ...
1
vote
0
answers
69
views
Finding the domain in which a function is analytic with no imaginary part
I was wondering if it is easy to see if a given expression evaluates to a real number in a given domain? Let e.g. f(x,y,z) be some function depending on three ...
1
vote
0
answers
397
views
Thread::tdlen: Objects of unequal length in {{a,b,e},{c,d,f}} {x,y,z} cannot be combined
When I do the Times operation among list like this {{a, b, e}, {c, d, f}}*{x, y, z}, the error message is given as Thread::tdlen: Objects of unequal length in ...
1
vote
0
answers
74
views
Making Table with nested SetDelay functions is very slow
I am trying to write a function which returns a list of lists of eigenenergies available for a quantum well. The code is here:
...
1
vote
0
answers
46
views
Very large list with sublists of varying dimension
I have a very large list of events,Evin, grouped into sublists. All these sublists have 15 elements each and the large list has about 1 - 2 million of these sublists. I now want to regroup that large ...
1
vote
0
answers
59
views
How can I convert the Defer result to a String
I have created a package.wl where I am building a simple interface with input fields and buttons to generate and solve some simple integer logarithms.
There is a button [show solution] that explains ...
1
vote
0
answers
63
views
How to define more general boundary conditions for ConvolutionLayer?
In Mathematica 12, I only see the option to define "PaddingSize" for a ConvolutionLayer in order to get Dirichlet boundary ...
1
vote
0
answers
43
views
Remove braces from AppendTo output
If I have the following inside a loop:
tts={};
AppendTo[tts, p] where p is just a number at each iteration so that in the first iteration I get: ...
1
vote
0
answers
84
views
LeviCivitaTensor contraction indices
My computer has problems when I try to perform a calculation with TensorContract.
In particular, with the second answer to my previous question Contracting indices ...
1
vote
0
answers
55
views
ListPoinPlot3D works but ListPlot3D does not
I don't understand what is going on. The same table, plotted with the tool ListPointPlot3D gives the desired output. But plotted with ...
1
vote
0
answers
100
views
Faster methods for performing repeated list manipulations?
I've done my best to pore over the other posts on this site, and to the best of my ability I can't seem to find a good solution to my problem, so I apologize in advance if elements of my question are ...
1
vote
0
answers
116
views
Loop over variable sized arrays
I would like to build an Encoder/Decoder to export my Data from Mathematica to Julia. From Mathematica I get arrays of variable dimensions, these arrays contain variables that don't have a fixed value ...
1
vote
0
answers
172
views
How to delete random elements with RandomChoice?
I have a list of prices and a list of dates, but I have 154 more prices than dates. So I want to delete random prices to match both lists, however, every time I run the block of code I get a different ...
1
vote
0
answers
37
views
MapAT and GeoPosition
I just experienced a problem applying GeopPosition via MapAt. Here a MWE. Given a list of data:
...
1
vote
0
answers
50
views
Loss layer for vectors with component mixing or non-trainable number array in NN layer
Suppose we need to construct an unconventional loss function for my neural network: vector MSE but taking into account the "similarity" of variables.
My network takes data vectors ($m=40$ D) and ...
1
vote
0
answers
30
views
Distribute function - Limiting Possibilities
I have a very large list of lists of which I am applying the Distribute function to. Because of this, there are more than 10^9 combinations and my computer cannot handle that.
I was wondering if it ...
1
vote
0
answers
45
views
Coordinate transformation of a table of multi-variable function values
I've created a table in Mathematica for a function dependent on r and phi of the form
...
1
vote
0
answers
100
views
Measuring Degree Correlations of Networks
I'm trying to write a program that will measure the degree correlation of the network. The theory is here (page 8).
I've written something like this up to now:
...
1
vote
0
answers
200
views
How to compute the multiplicative order of an element in a finite field
I want to find the multiplicative order of say the element {0,1,0} in GF[8].
I made a list:
b = Map[GF[8][#] &, Tuples[{0, 1}, 3]]
I tried:
NestWhileList[b[[3]]*# &, b[[3]], # != b[[5]] &...
1
vote
0
answers
75
views
How to assign a nested list indices for later use
In an attempt to calculate a summation dependent upon a nested list it appears that a simple use of [[{n,k}]] does not yield the desired result. For example with ...
1
vote
0
answers
86
views
Correctly Evaluating the existence of Large Solutions
I'm trying to correctly evaluate
$$D(S\cap[a,b])=\lim_{n\to\infty}\frac{\left|S\cap{F_n\cap[a,b]}\right|}{\left|F_n\cap[a,b]\right|}$$
where $D$ is the density of $S\cap[a,b]$ (in $A\cap[a,b]$), $[...
1
vote
0
answers
39
views
Replacing factors that are only dependent on a single specific variable
I have expressions with terms that are products of factors. Some of the factors are expressions that depend on a single specific variable. I would like to replace those factors with constants and ...
1
vote
0
answers
77
views
Problems with the parametric Recurrence Table
I am trying to construct a minimization program where I have to minimize a function with respect to a matrix. This matrix enters into the optimization program in a convoluted manner together with data....