0
votes
0answers
2 views

Convert matrix rows into variables

Can anyone show me how to set all matrix rows to variables. For example, I have matrix w={{1,2,3},{3,2,1},{0,0,0}} and I need to set each matrix row to be separate variable that contains the row ...
1
vote
1answer
28 views

Find maxima and minima of data like {time,value}

I have a list of time and values of the charge and discharge of a capacitor, and i want to separate in two list of {time,value of charge} , {time, value of discharge} I know there is a lot of the ...
2
votes
4answers
207 views

Get 'new' list of data by manipulation 'old' list

Assume I have the the following list of data: valuesOld = {5, 10, 15, 20, 25, 35, 40, 45, 55, 65, 80}; I would like to construct the following list: ...
1
vote
3answers
71 views

Remove all “not equal” clauses from an expression

I am banging my head against the following question: how can I have Mathematica take cond = 2 a >= 3 b && 70 a >= 19 && 20 a != 13; and ...
0
votes
1answer
78 views

Creating and handling really large matrices [on hold]

I use Mathematica for a long-time to program physics simulation and I love Mathematicas programming style, but recently I am using fortran because it can do my calculations faster. I am doing some ...
3
votes
3answers
225 views

Faster Integer Approximation of pi

I'd like to speed up this calculation: First[Sort[Table[{k,Abs[Round[k/Pi]Pi - k]1.{k,1,100000}],#1[[2]]<#2[[2]] &]] The code above generates a list of ...
4
votes
5answers
123 views

getting at the right parts of a list

I have a way to solve my problem, but it seems like there should be something better. Also I realize that I probably don't have a good enough handle on how to get at parts of lists the way I need to. ...
14
votes
12answers
516 views

Join lists with nested list

Is there a way of smarter way of joining list of the form l1 = {a,{b,c}}; l2 = {d,{e,f}}; l3 = {g,{h,i}}; To obtain ...
0
votes
0answers
50 views

ListPlot and ListLinePlot, show nothing, how can I plot correctly? [closed]

I'm trying to plot a graphic using a list of pairs, i.e., {{x1,y1},...,{xn,yn}} but nothing appears in mathematica notebook. I used the following commands and list: Does anyone can help me please, ...
6
votes
3answers
143 views

Remove Successive Duplicate From A Large List (200k by 4 matrix)

I am interested in removing successive duplicate rows from a very large list (~200k rows by 4 columns) using Mathematica.The built-in 'DeleteDuplicates' seems to remove all duplicates, I am interested ...
0
votes
0answers
41 views

Convergence Problem using FindFit

I have the following input where there is a convergence problem in the FindFit as shown in the attached figure.The figure shows 2 plots: one of the real data and the other of the fitted line. Any ...
0
votes
0answers
61 views

list numbering problem

I have a list that is generated from a unparsed matrix, and another list that is generated by a parsed matrix. However, since the second one is parsed, the numbering of the elements in the list have ...
2
votes
2answers
45 views

parsing a list or vector

I have a table of elements that generate a list q[i_]=i; B=Table[q[i],{i,1,50}] I would like to parse the list meaning, take the first 10 elements, then take ...
0
votes
0answers
36 views

Not getting proper x-values in a ListPlot [closed]

I have a table of data points to be subtracted by another table of data points. I have succeeded in subtracting the y values of each data point successfully, but it is the x values of each data point ...
5
votes
3answers
232 views

Element-wise list operation on list of lists [closed]

Suppose a function F operates on list A: $$A=\{a_1, a_2,\cdots, a_n\}$$ I have a list of lists, B: $$B=\{A_1, A_2,\cdots,A_m\}$$ Is there a syntax to specify that F should operate on members of B, ...
3
votes
2answers
45 views

Read off entries of UndirectedEdge [closed]

Suppose I have an undirected edge e=UndirectedEdge[a,b]. How do I extract one of the entries a,b of e? I tried accessing e like a list, but that didn't work (...
8
votes
2answers
156 views

How to partition a list according to a value in the list

I have a list of the form $\{\{d_1,c_1\},\{d_2,c_2\},\ldots,\{d_n,c_n\}\}$. The values c_i take values between $1,\ldots,k$. I want to partition the data into $k$ lists according to the values $c_i$. ...
4
votes
2answers
100 views

Sorting out atom types in an XYZ file

I am trying to rewrite the output of "VertexCoordinates" such that instead of a hybrid list of atoms and coordinates that result from using the following input program, I want all coordinates of the ...
3
votes
3answers
101 views

Working with calculations that depend on the previous value in a list

I'm trying to make calculations on a list that depend on the previous value. In my case I'm doing event detection - detecting the point where a value rises above some threshold for the first time ...
3
votes
2answers
121 views

How to define even permutations correctly?

I define even permutations as following, but there may be some error. I use it in two different way and get different output. ...
3
votes
4answers
154 views

One to Many Lists Merge

I have two lists: ...
2
votes
1answer
51 views

Compare some lists, if elements are almost equal

I've got the solutions of three systems on two variables (a and b) that gives results sometimes almost equal. The three list are not of equal length! For example: ...
3
votes
1answer
59 views

How can I create a set (list) provide a kind of rule/algorithm?

Example: S = {r ∈ Q : r² < 2} Let S be the set of all rational numbers whose squares are less than 2. It follows that 1 ∈ S, 4/3 ∈ S, but 3/2 doesn't ∈ S because 9/4 ≥ 2. Thank you.
2
votes
3answers
108 views

How to multiply specific columns in a matrix of data?

So I need to make a plot of some ~2000 data points I have from a spreadsheet. I'm able to import the data just fine, it stores it like so sundat ...
3
votes
1answer
61 views

Remove values from list element, and add to other element

Basically what I need is to make a list of 400 elements, all have value 1. The next step is to create a function, that subtracts value (-1) from an element, and adds that to another element. So: ...
9
votes
5answers
701 views

Coalition Games

Suppose an election produces the following result: result = {{"a", 120}, {"b", 80}, {"c", 50}, {"d", 30}}; Letters are parties and numbers seats. To form a ...
4
votes
1answer
91 views

Random symmetric matrix

Suppose first that I want to generate a matrix whose elements are i.i.d. with distribution dist. This is easy: ...
6
votes
3answers
204 views

How to count number of observations/rows within each group

I have a huge unbalanced panel data. I want to count number of rows within each group. For example, I have the following data: ...
4
votes
3answers
123 views

Combining more than two lists by first column as index

Please bear with me. It might be easy but its been hard for me. I have say three lists: ...
2
votes
2answers
42 views

Column Operation - Subtract part of nested list from part of another nested list [duplicate]

I have two lists with x- and y-coordinates with different z-coordinates of the form {{x0, y0, z0_1}, {x1, y1, z1_1}, ..., {xn, yn, zn_1}} and ...
3
votes
2answers
87 views

Sublists of Random Permutations

What is an efficient way to create a list of (psudo)randomly chosen permutations? I'm trying to create a list like below: ...
1
vote
2answers
54 views

How to append to a list of lists elegantly [duplicate]

I have have list of lists and I would like to be able to append an element to the start of each list. I am sure there must be an elegant solution. EG: a and ...
1
vote
1answer
45 views

ListLinePlot of data imported from an Excel file [duplicate]

This is a continuation of another very similar question about how to plot structured data using ListLinePlot. Here is a sample data imported from an Excel file: ...
7
votes
3answers
206 views

Issue with very large lists in Mathematica

I have a need to work with very large arrays of data in Mathematica. The length of the list is not known upfront. The typical size is a few hundred thousands elements and could easily go beyond a ...
3
votes
1answer
72 views

How to efficiently select elements from a Hash?

How can I write an efficient version of the following selection statement: Keys[Select[hash, # < constant &]]; // AbsoluteTiming hash can be made from: ...
3
votes
2answers
82 views

Wrapping Interval Notation for Take

I'm trying to implement the solution to a math problem in Mathematica, but my code can't handle a particular boundary case. I think that I could implement a function that would do what I want it to, ...
0
votes
3answers
99 views

How to manipulate with external data?

I have a .txt file which contains a lot of triples (a, b, c) (one per row) which should be coefficients of my equation ax^2+bx+c=0. I want to include each triple in .nb file and solve each equation. ...
-2
votes
1answer
100 views

How can I produce a list of solutions for a function which is updated with updated variables using for loop?

I need to loop over a set of equations, solving for X and adding the new X value to the old X value at each step. The output I need is a list ...
10
votes
3answers
168 views

Pick with nested list

I have a list of pairs of values. Some of those pairs are invalid based on another list. I would like to select only the valid pairs. ...
6
votes
3answers
147 views

Mapping a function over the parts of a deeply nested Array

I have two tensors: tensorS = Array[Subscript[s, #1, #2, #3, #4] &, {2, 16, 16, 19}]; tensorR = Array[Subscript[r, #1, #2, #3] &, {2, 16, 19}]; ...
7
votes
4answers
385 views

Is there a way to riffle more than two lists?

I thought Riffle would generalize such that Riffle[{a,b,c},{1,2,3},{x,y,z}] would return ...
2
votes
2answers
82 views

How to make functions from datasets

I have a csv that encodes the results of plugging certain parameters (say, A and B) into certain functions (say, ...
2
votes
1answer
56 views

Manipulating lists with uneven amounts of entries

So I have a list like so list={{a},{b,c},{d,e,f},{g,h}} and the basic logic I want is to be able to manipulate each of the nested lists individually. So If I ...
6
votes
2answers
251 views

Finding the coefficient of a certain power in a generating function

I want to compute $(t^1+\dots +t^5)(t^2+\dots+ t^6)(t^3+\dots +t^9)$ and find the coefficient of $t^{15}$ for example. $t$ is an indeterminate Now in Maple this is simply as ...
0
votes
2answers
146 views

Indirect transformation based on a list of data points

I have a set of data which describes the Intensity function $Int(q)$ as a function of $q$. The data list provided below provides the shape of $Int(q)$ versus $q$.How can I use this information to ...
5
votes
1answer
119 views

How to efficiently select element in a list of lists?

How can I write an efficient version of the following statement? Cases[list, {_, feature_} /; feature < constant]; // AbsoluteTiming List is of the form, list ...
3
votes
3answers
155 views

Breaking up combined data into several smaller data sets

I have one combined data with first number as the x-value and the remaining as different y-axis values (y1,y2,y3...). How do I break this combined list, data= (x,y1,y2,y3...) into smaller lists, such ...
6
votes
2answers
204 views

Is there a bug in the Part function of Mathematica 10?

I am using Mathematica 10 now. I typed code below {{1, 2}, {2, 4}, {3, 6}, {4, 8}}[[;; , 1]][[1]] and this gives result 1 ...
2
votes
1answer
59 views

How to select elements with a specific style of a list?

Suppose I have a list: where 3 'up's of the list are red(I've made it to Cell Expression as follows). ...
3
votes
2answers
198 views

Why does a certain CSV file import properly into LibreOffice but not into Mathematica 10.0?

I'm working on a project involving data manipulation and it involves working with CSV files. I know that the files are properly formatted as when I import them into LibreOffice, all of the columns ...