Questions on the manipulation of List objects in Mathematica, and the functions used for these manipulations.
5
votes
4answers
250 views
Any rule of thumb for converting a simple mathematical expression into a pure function?
By simple mathematical expression I mean one with a few functions and few variables copied into MMA in a mechanical way from a math book.
For example this one, giving the distance between two points ...
1
vote
1answer
63 views
Splitting list of sums into a sum of lists
I want to split a list of sums into a sum of lists For example, I'd like to turn
{{x + y + z}, {x}, {y}, {z}}
into
...
5
votes
1answer
117 views
Is there an equivalent of “shiftdim” of MATLAB?
Recently I'm spending my time implementing some computer vision algorithms, which usually handle a large amount of data.
The problem I'm facing now is that I have to reform my video data to pass it ...
6
votes
3answers
247 views
Replace “,” in a list with “.”
I have a list which consists of numbers which use comma (,) instead of dot (.) as their decimal point. I would like to replace the commas, but only those commas which are followed by more than five ...
1
vote
1answer
45 views
Partial row reduction of a matrix
I have an $m\times n$ matrix (presumably of full rank) with $m>n$, and I would like to row reduce it, but leave the last column unreduced; that is, I want to get output on the form
$\pmatrix{ 1 ...
0
votes
2answers
96 views
Convert *.txt file
I would like to Import and Convert a *.txt file which looks like:
https://docs.google.com/file/d/0Bw-308nJcF01Yl92RURCLUg4VzQ/edit?usp=sharing
and turn it into a Matrix which I can use to make ...
10
votes
4answers
415 views
Finding Local Minima / Maxima in Noisy Data
I'm trying to find local minima / maxima in noisy data, consisting of data values taken at certain time intervals. Ideally, the function should take a pair of lists (one containing time values and one ...
1
vote
3answers
96 views
How can I create a new tables out of a table and plot it
I have the following problem. I have a table, call it m, which is labelled by 3 indices (say i,j,k), each of them running from 1 up to 100.
I would like to be able to construct a new table which would ...
5
votes
1answer
117 views
nested use of Apply/Map/MapThread in pure functions
1. My main question
I have a function with two argument slots. I wan't to apply this function to 2 lists with different length's. I thought in this solution:
...
3
votes
3answers
220 views
How to sum over a List
list = {11.5575, 11.397, 5.52734, 4.0878, 2.54815, 1.86652, 2.55028,
2.14952, 1.6242, 1.34117}
I have a list of numbers. How do I make a function that creates a ...
1
vote
1answer
57 views
ReplacePart inside For loop
I am trying to replace the last column of the following expression (mat) by doing
...
2
votes
1answer
74 views
Plot several lines with different starting points on the x-axis
First of all, I would like to apologize in advance if I don't use the correct terms or if I express myself unclear but I just started to work with Mathematica.
I'm simulating electricity prices and ...
12
votes
6answers
775 views
Find continuous sequences inside a list
I have a list which is something like this:
{3,4,5,6,7,10,11,12,15,16,17,19,20,21,22,23,24,42,43,44,45,46}
What I'd like to to is get the intervals which are in ...
0
votes
1answer
82 views
Keeping axes fixed in an Animate of a 3D graphic
I am using the following code to animate a 20 3D ListPointPlots:
...
6
votes
2answers
173 views
How can I find if the number of subsets for a list is very large?
I'm trying to find the following;
Subsets[Range[2, 2300], {4}]
but my computer gave the following error:
...
13
votes
1answer
135 views
How can I make threading more flexible?
Threading automatically with Listable functions requires the argument expressions to have the same length (or for one of them to be atomic). For nested lists the ...
2
votes
3answers
122 views
Logical AND operation over several comparisons
Let x and y be arrays defined as Array[x, m], Array[y,n] respectively.
How to generate the following function of $x$ and $y$ for variable $k$:
...
2
votes
1answer
104 views
Including two ListLinePlots in a 3D graphic
I have two lists of data which I am plotting on two ListLinePlots. I would like to have these two plots appear perpendicular to each other on a 3D graphic. I have ...
0
votes
0answers
57 views
How to combine file data chronologically via reading numbers in a filename and put it in one list?
Say I have a bunch of files with nearly same filename, eg. data_timestep1, data_timestep2, ...
The data itself in one file is ({x1, y1, z1, absolute field value 1}, {x2, y2, z2, absolute field value ...
-4
votes
4answers
94 views
Extracting the integers from a list
I have a list where the elements are Reals and Integers. How can I extract the Integer? For example, if I have {1, 2, 3.4, 9.9}, how can I get ...
1
vote
3answers
144 views
Summation over 3 lists
I have three lists. As an example,
a = {10, 5, 6, 8, 7};
b = {4, 8, 9, 7, 9};
c = {7, 5, 12, 4, 1};
I want to get
$$x(i)=\sum ...
0
votes
0answers
26 views
Error in extracting a column [duplicate]
I imported excel data to Mathematica using this command.
kuruzD = Import[
"C:\\Users\\TMH\\Documents\\Problem Set 4\\kuruzData.xlsx"][[1]] //TableForm
I want to ...
0
votes
3answers
91 views
How to find intersection of multiple lists excluding empty ones?
I have lists like
list1={1, 1, 2, 3}; list2={3, 1, 4}; list3={};
I want to find the intersection of all list. I tried the following way, but it's not working.
...
1
vote
2answers
164 views
What ways are there to convert an Integer to a list of digits?
How can I convert an Integer to list of numbers? For example:
781049 ==> {7, 8, 1, 0, 4, 9}
What are the possible ways of ...
1
vote
1answer
175 views
0
votes
1answer
77 views
DataRange problem in a ListLinePlot within a Manipulate
I'm trying to create a simulation of a set of lists with Manipulate[] and ListLinePlot[]. However, as my simulation starts with ...
2
votes
5answers
122 views
Creating ordered triplets from an Excel sheet
I have an Excel sheet of the form:
" " a b c
1 R S T
2 U V W
3 X Y Z
Where every entry is a number (except the blank quotes, ...
0
votes
0answers
38 views
DeleteCases and Inequalities [duplicate]
I would like to remove cases from a list according to an inequality rule - e.g. remove all values less than x. I can do the following but this seems very clumsy:
...
2
votes
2answers
86 views
How to prevent errors in Manipulate with ListPlot when a result is an empty list?
I am trying to plot two lists, where one is the reference list, and the other is only used to select and highlight the first list. Basically, I want to use the selection list ...
4
votes
5answers
215 views
Removing zero values from ordered pairs
I have some processed data, which are basically a collection of ordered pairs in the form:
{{x1, y1}, {x2, y2}, ..., {xn, yn}}
Ordered pairs which have either a ...
14
votes
6answers
359 views
Matrix Rotation
If I have a matrix of any size, say
$\begin{pmatrix}
72 & 32 & 64 \\
18 & 8 & 16 \\
63 & 28 & 56 \\
\end{pmatrix}$
$\begin{pmatrix}
72 & 32 \\
18 & 8 \\
63 ...
1
vote
2answers
92 views
Speeding up a simple simulation with random extractions
I wonder if anybody can help, I need a hand with a simple simulation I am writing with Mathematica (I am using version 8). Basically it creates a list (called l) with numbers from 1 to n and a random ...
3
votes
2answers
114 views
1
vote
2answers
55 views
How to construct a new list made from a function that operates on two lists
I need to take two lists (each list contains the number of moles of a chemical). I have a function calledFraction that takes the each entry of the list and then calculates the mole fraction of ...
1
vote
2answers
80 views
List of numbers without common factors with a certain number
Is there any function in Mathematica which directly gives an array of integer numbers with no common factor with a certain integer number?
For example, all the integer numbers between 0 and 1728, ...
-1
votes
2answers
84 views
Convenient methods to sum select rows (or cols) of a matrix? [duplicate]
What are some convenient methods to sum selected rows or columns in a matrix? This question Summing along rows or columns of a matrix only addresses how to sun entire rows or columns ie, by level.
...
5
votes
1answer
95 views
Trouble with Flatten[]
I made this function:
f[g_] := Table[{ToExpression[ToString[x] <> ToString[n]], 1, 3}, {n, 1, g}]
When I evaluate the function with some g (say 8), I'll ...
1
vote
2answers
106 views
How to blend some colors on a curve
I need to define a color gradient on a 3D curve, but I'm having some problems with this.
Suppose we have a 3D curve defined as a parametric function of some real variable ...
12
votes
3answers
253 views
Accessing list elements by name
First, a bit of a long introduction to my problem:
I only have a few weeks of Mathematica experience. I am creating a mathematica application that calculates some material properties of steel based ...
3
votes
0answers
74 views
Can the elements of a list always be sorted into a canonical order?
As the title states - does a unique order exist for any Mathematica list to be sorted by the Sort[] function (or as returned by a function that treats lists as sets)?
While I'm pretty sure the answer ...
4
votes
1answer
72 views
How do I group a nested list further according to a rule, and average selected elements?
I have a nested list of numbers like { {36, -244}, {37, -225}, {38, -197}, {48, -200}, {49, -181}, {50, -133} } which needs to be further nested into "bins" according to a rule. I would describe the ...
-1
votes
1answer
102 views
How to change the value of an array that is outside the For loop, from inside the For loop [closed]
H is a square matrix which depends on the vector d which I define below.
I redefine d in each iteration but I need to plug it in H in each iteration aswell. It is easy if I define H inside the For ...
7
votes
3answers
164 views
How to add lists with unequal length?
Given lists of unequal lengths, I want to add them together element-wise, treating missing elements as zero. For example, {1, 2, 3} + {a, b} + {x} should give ...
3
votes
2answers
115 views
Creating a list from other lists and varying the number of elements that get added
Suppose I have
listA = {M, F}
and
ListB = {a,b,c}
I want to make a new
...
0
votes
1answer
76 views
Using a loop to make a new list by taking elements from multiple lists [closed]
I have defined three lists and I need to be able to take elements from them periodically and put them in a new list. I know I need to use some form of a loop but I am at a loss. Any suggestions?
0
votes
1answer
55 views
How to extract data from a list? [duplicate]
I have a long list of coordinates defined in some 8D space. I need to extract the first three coordinates only. How ?
For example :
...
4
votes
2answers
282 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: ...
2
votes
1answer
126 views
How to store values indexed by integer partitions for fast access?
I have a huge list of values indexed by integer partitions. If I store them simply in a list, then, when I want to access the value corresponding to some particular integer partition, I have to find ...
-7
votes
5answers
213 views
Translating MATLAB's cell2mat into Mathematica
How I can define a function in Mathematica such that it acts same as the cell2mat command in MATLAB?
Example (in MATLAB):
...
1
vote
2answers
93 views
How do I divide the columns of a matrix by the sum of its elements?
I am trying to create a transition matrix for a network. In order to do this, I need to sum down the column (the out degree), and then divide the column by the out degree in order to normalize it.
...



