1
vote
1answer
38 views

How to set the values into some variables from different lists [closed]

I have a list of Values and a list of variables. I want to set the Values into Variables. Assume the following code: ...
1
vote
1answer
203 views

Compile with array operations

When I use the function f with only the Module ...
1
vote
2answers
133 views

MapThread with List Manupulation

I have the following three lists: ...
0
votes
1answer
83 views

Populating an array with outputs of a function [closed]

I have searched, but didn't find much help on my issue. I have an optical physics problem that I'm working on .. ...
2
votes
1answer
81 views

MapThread over a nested list

This may be a simple question. Please close it if it is already answered. I have a nested list kr = {{35, 32, 27, 20}, {36, 33, 28, 21}, {37, 34, 29, 22}} I ...
3
votes
1answer
165 views

Levels and slots

I am struggling with levels and #, if I understand this I think I will be able to grasp the entire concept. ...
4
votes
2answers
185 views

Can someone explain this code for joining two lists by the first element of each sublist?

Background (which may be skipped, unless context is needed) I've recently begun learning Mathematica (and only up to chapter 3 of Wellin), but wanted to write some code to get a better feel for ...
-5
votes
1answer
174 views

Split dataset based on the first column [duplicate]

I have a dataset which I want to split based on the first column. The data looks like this ...
2
votes
2answers
137 views

Extracting counts of contiguous zeros and ones from a binary array

I'm a novice with Mathematica, but you guys have been very helpful to me in the past. I have a binary array [100, J repetitions] consisting of zeroes and ones. I'd like to extract a histogram of the ...
1
vote
1answer
165 views

Bincounting a list

I'm a Mathematica novice here. I'm trying to execute the following code to add random 1's into a zero matrix, repeat this many times, and then bin/histogram the number of nearest neighbor 1s. Can ...
3
votes
1answer
127 views

Filtering the elements of an array to split them into two categories

So, I am new to Mathematica, and I am trying to write something that involves taking values from one array and separating them into two different arrays. My code for doing this is: ...
4
votes
2answers
349 views

List reversion inspired by Python

In python, if you wish to reverse a list, here is the trick: range(10)[::-1] => [9, 8, 7, 6, 5, 4, 3, 2, 1, 0] Note: ...
1
vote
1answer
168 views

Syntax for integrating over limits specified by a Table

I wish to use NIntegrate to compute multidimensional integrals. However, I don't want to manually input the limits for the dimensions. I want to store the ...
11
votes
3answers
175 views

Why can't I use Sequence to perform a Select like task?

Suppose I wanted to write down a list of $p^2$, for $p$ a prime between $1$ and $20$. I would expect Table[If[PrimeQ[k], k^2, Sequence[]], {k, 1, 20}] to work. ...
6
votes
2answers
319 views
2
votes
1answer
557 views

Indices and variable definitions in Mathematica

Does anyone know how I can do this in Mathematica? Just an example.. Defining indices and variables (defined over indices), "mapping" variables and indices: ...
4
votes
1answer
298 views

Path queries for tree-structured data

Can anyone suggest documentation or tutorials for developing path queries and indices for (XML-like) tree-structured data? Suppose data is organized hierarchically in key->value pairs, eg: ...
12
votes
7answers
644 views

Equating matrices (or higher order tensors) element-wise

Say I have two matrices (or, as in my case, higher order tensors) $A,B$, and I want to solve the equation $A=B$. To do so , I need a list of equations that equate entry-wise the elements of $A$ and ...
9
votes
2answers
630 views

Flatten at a certain level

In an earlier question the brainteasing fourth syntax variant of Flatten was discussed. I see that with ...