Questions on the manipulation of List objects in Mathematica, and the functions used for these manipulations.
5
votes
5answers
197 views
Performing Computations on Sets
I would like to find the permutation of $S=\{\frac{1}{10}, \frac{1}{2}, \frac{4}{7}, \frac{3}{5}, \frac{2}{3} \}$ that maximizes the sum of theses elements raised to unique powers $\{0,1,2,3,4\}$. I ...
0
votes
0answers
99 views
How can I revise my program to avoid “No more memory available”? [duplicate]
I have a program for calculating a type of list.
...
2
votes
0answers
59 views
How to efficiently count occurrence of some element in a list? [closed]
I have a list of numbers, for example:
list = {1,2,3,4,2,1,3};
what would be efficient way to count all occurrences of some number?
I tried so far:
...
0
votes
1answer
53 views
Forming product of function of prime factors
Given a list of numbers each containing 2 prime factors, I wish to make a list of the products of the logs of each factor. For example, given
L = {4,6,9}, I would like to form P = ...
1
vote
1answer
77 views
Find elements of a list which are empty
Sorry for the most basic of questions. How would I find the positions of a list of elements which are empty, for example I have the list
...
0
votes
0answers
45 views
Simpson's rule with ListConvolve or ListCorrelate
I have a function that's represented as a long list of values that I want to integrate. I can do it procedurally with Simpson's rule. ListConvolve generally runs faster then procedural code, so i ...
3
votes
1answer
134 views
Little problem with Through
list = Partition[Range[20], 5, 5, 1, {}]
{{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}, {16, 17, 18, 19, 20}}
...
1
vote
1answer
76 views
Equating two lists, element by element
Say you have two lists:
listA = {a, b, c}
listB = {d, e, f}
How would you produce a listC that equates each of the two's ...
0
votes
0answers
51 views
Optimized subset algorithm implementation
I was reading a paper from Mathematica Journal.It mentions a code for calculating subsets.
...
5
votes
3answers
133 views
How do I find the intersection of a closed 3D curve given by numerical data with a specified plane?
I have a list of 3D data points which form a closed curve. My own data can't be easily generated analytically, but the qualitative behaviour is well represented by a parametric curve families such as ...
1
vote
0answers
104 views
Why doesn't ParallelMap improve the performance of FoldList?
This question arose during my analysis of the following problem: filling gaps. (The code used here is Simon Woods's work.)
FoldList seems to not cooperate with ...
2
votes
4answers
119 views
How to improve the quality of the ListPlot output
I need to plot massive data stored in external ASCII files. Below is the Mathematica code I use for this job:
...
11
votes
10answers
457 views
How can I generate a nested array like this one?
Well, this is how the array looks like:
I came up with this code:
n = 10;
Nest[ArrayPad[#, 1, 1 - #[[1, 1]]] &, {{1}}, n] /. {1 -> "*"}
Any better ...
2
votes
2answers
89 views
Modify all the second elements of every pair in a list of pairs
I have a list in the form {{a, 1}, {b, 2}, {c, 3}}.
Let's say I want to operate a transformation on all the second elements of each sublist, but this transformation is a function of them all ...
15
votes
6answers
457 views
How do I replace a missing value in a column with the value immediately above throughout a table?
I have a large table (7000 rows × 17 columns) of terse textual data.
In many of the columns, empty entries have been replaced with "." as a marker.
Working from the top of the columns downward, I want ...
14
votes
7answers
463 views
A function that accepts a pair or a list of pairs
Probably a duplicate, but it's not easy to search on "lists".
I have a function that accepts a list of lists, say {{a1, b1}, {a2, b2}, {a3, b3}} and performs some ...
8
votes
5answers
194 views
Wrapping a function in count
I am working through the Programming Paradigms via Mathematica (A First Course) and am attempting to answer the following:
Use recursion to count how many times the argument can have its square
...
19
votes
15answers
670 views
How do I extract the middle element(s) of a given list?
How do I extract the middle element(s) of a given list?
Here is some code that works, but seems a little too long:
...
4
votes
0answers
80 views
What is the fastest way to maintain a large set of expressions?
In my algorithm I need to maintain a set (an unordered list of distinct elements) of expressions supporting two operations:
Test an expression for membership in the set
Adding a new expression to ...
2
votes
1answer
58 views
Adjust the results of evaluating Table so it can be used as a argument to Point
I have a list generated by Table as below.
...
0
votes
1answer
53 views
Displaying Values of Fuction at end of Period by Grid
My intention is to place the values of two function into a small box within my chart. To be more precise I have two vectors.
A meanvector which shows the average value of all simulated stochastic ...
0
votes
1answer
85 views
Scatterplots for subsets of multivariate data
I have a series of multivariate datasets, grouped as subsets within a nested list, that I want to visualise in a scatter plot array.
@0x4A4D's answer to this question: "Creating a data1 versus data2 ...
6
votes
4answers
233 views
Partitioning a list by recursion (Programming Paradigms via Mathematica (A First Course))
I am working through the course Programming Paradigms via Mathematica. One of the homework exercises for the section Recursion I: Passing the Buck is as follows:
Use recursion to partition a ...
4
votes
3answers
119 views
Combining the second elements of a set of ordered pairs based on their first element
I have a large set of ordered pairs and I am trying to add the second elements together for any group of pairs that has the same first element.
For example my data looks like:
...
0
votes
1answer
62 views
Stopping- threshold and stopping- time of stochastic processes.
Rod Lm helped me to generate the following code, which I want to extend a little bit. So my intention is to use the threshold (the green line) as boundary in the following way: as soon as the process ...
0
votes
1answer
54 views
WeatherData acquirement in ListStreamPlot
I am trying to show the wind streams in a geographic area as following code for a range of time.Even if it works for realtime data but it doesn't work for range of time.I am filtering and also taking ...
0
votes
1answer
134 views
Brownian Motion with stopping threshold
I just want to generate one stochastic process, whereas I want to be able to manipulate the start value and the volatility. Furthermore, the process should stop when it reaches 5
However, as soon as ...
-1
votes
0answers
59 views
ArrayFlatten not flattening array
I am having a problem joining a few matrices. I created matrices A B C D E F through the Table[] command. For example (L is a previously defined function):
...
0
votes
1answer
63 views
3
votes
1answer
72 views
Why does MemberQ need {} around the expression? [closed]
Suppose I was trying to find out if the sequence 34 appeared in the digits of 344444. I tried to do this with MemberQ and get:
...
1
vote
2answers
48 views
Select elements in a list when the firsts two items are the same (no matter order) and its third element is lower
I'm trying to solve a heuristic search in Mathematica 9. I get a list of succesor nodes called open with two nodes and a heuristic value, e.g.,
...
1
vote
1answer
55 views
Expand list of {{t1,x1},…} with new set of t's
I have a list of the form data={{t1,x1}, {t2,x2},...} and a list newt = {nt1,nt2,...} and I want to expand ...
0
votes
1answer
69 views
ListVectorPlot3D
I try to plot a 3D Vector plot. All Vectors start at (0,0,0) and point in directions given in spherical coordinates:
...
0
votes
1answer
53 views
Problem with importing format of data from Excel?
I am trying to import data from Excel. It is located in a single column of the Excel file but each cell contains a comma separated pair of two values as a,b. When I am importing them I have this ...
2
votes
3answers
92 views
Introduction of straight Line into Manipulate function
Introduction of straight Line into Manipulate function
I just want to implement a line within my chart that starts from time point 0 to time point T and whose y-coordinates can be manipulated, which ...
0
votes
1answer
60 views
Sublist inside simple list
I have a doubt to confirm. Let there is a list
f = {{l}, {c}, {d}, {e}, {1, 2, 3}, {3, 4, 5}}
And I expect it to be traversed as a normal list which I can do ...
4
votes
2answers
56 views
Specific rearrangement of elements in list
I have an $n\times n$ matrix G with elements g[i,j] that I construct with
...
0
votes
1answer
72 views
Making a list from equations
I want to make a list (efficiently) which is the set of lattice solutions of the following equations (depends on $k$):
$x_0\geq 0$ and $x_i\in [0,4k]$ for $i=1,\ldots,4$ satisfies
$x_0+x_3\leq k+3$, ...
0
votes
1answer
67 views
Problem with ListContourPlot feeding data format and WeatherData
With following code I am trying to show the mean wind speed patterns for a few geographic locations.
...
0
votes
1answer
129 views
How to give the position of non consecutive numbers?
Give the position of non consecutive numbers
in the first column of a sorted table.
list = {{1, 3, 5}, {3, 3, 5}, {4, 3, 5}, {5, 3, 5}, {7, 3, 5}}//MatrixForm
...
3
votes
1answer
80 views
Removing sublists containing elements from another list's sublist
Let there be two lists that have sublists:
a[] = {{1, 2}, {1, 2, 3}, {2, 3, 4, 4}, {3, 4, 4, 5}}
and
...
4
votes
3answers
126 views
Renaming and indexing list of rules
I have a list of rules that represents a list of parameters to be applied to a circuit model (Wolfram SystemModeler model):
...
0
votes
0answers
52 views
Using NDSolve over a list of functions
I apologize for how messy this explanation will be.
I would like to take a differential equation and iterate that solution over a range of coefficient values. The second part of this is that the ...
7
votes
2answers
196 views
Programatically adding/retaining comments within a nested list
Is it possible to convert the following list of strings to computable numbers with the comments preserved?
...
5
votes
6answers
102 views
Selective thinning of string elements in nested lists
I have a nested list similar to this example list (but much bigger and more messy):
...
0
votes
1answer
67 views
How to calculate the area of a listplot [duplicate]
I need to calculate the area enclosed in a two-dimensional listplot and following an answer to a similar question I tried this way:
...
1
vote
1answer
117 views
How do I sort complex numbers?
Okay, so I posted something about sorting, and it was linked as a duplicate to This post
However, I am having problems trying to sort a list that contains both real and complex numbers. I put them ...
1
vote
3answers
93 views
How to convert a spaceless data into tab delimited
I have a data set in form of:(this is just an example)
1324501020
3241030205
4332020134
the data are stored in a text file (e.g. data.txt) but I need to convert ...
7
votes
3answers
152 views
Numbering nested list according with Depth (or Level)
(This question is slightly similar with Sequentially numbering a nested list, but not exactly the same.)
What I want
Say I have a nested list
...
1
vote
2answers
119 views
Indicating the probability that a weather datum is above/below some given value on a geographic map
With help of the previous questions here, I am analyzing weather data as daily MeanWindSpeed of some cities with the following code:
...








