Questions on the manipulation of List objects in Mathematica, and the functions used for these manipulations.

learn more… | top users | synonyms (5)

1
vote
2answers
75 views

Create an indexed list of functions [duplicate]

I am trying to use a Table to create the following object: {f[#,1]&,f[#,2],f[#,3]} The obvious doesn't work, ...
1
vote
1answer
46 views

How to create sublists of consecutive elements? [duplicate]

I have a list of elements, for example: myList={5, 12, 16, 18, 19, 24, 28, 29, 31, 32, 35, 42, 43, 47, 50, 53, 60, 61, 62, 64, 79, 82, 84, 92, 105, 128, 136, 153, 154, 155, 156, 158, 159, 160, 164} ...
0
votes
1answer
49 views

How to apply a user-defined function to a list [closed]

I'm using Wolfram | Alpha Pro; I have a function f[n] = 351n^(-0.7); How do I apply it to each element of a list like {2, 9, 22}? f/@{2, 9, 22} just results in ...
2
votes
1answer
108 views
5
votes
2answers
263 views

Max of imported numerical data will not work

I loaded a list with 400,000 values from a file. The list was loaded correctly as I can get it's length (by Length[]) and I can also plot it. Why can't I get the Max or Min of this list though? When ...
1
vote
0answers
22 views

Append in For loop doesn't work [duplicate]

I want to simulate a projectile motion under the effect of air resistance by using Append in a For loop, but there appeared to be no changes in the two lists I defined for storing horizontal and ...
4
votes
1answer
152 views

How do I disable that Mathematica orders terms in lexicographic order?

I have matrices with entries where the order of the entries is important. Unfortunately Mathematica resorts terms in products in a lexicographic order. For example, ...
2
votes
1answer
34 views

Encoding/Decoding matrices as integers, integers as matrices [closed]

I want to convert large binary matrices of m x n dimensions into integers, and then to convert these integers to the original matrices. I attempted the following: ...
0
votes
0answers
29 views

DeleteDuplicate from a list with {x == y, y == x} -> {x == y}; [duplicate]

How can I tell Mathematica that it should delete equal elements from a list, which aren't in the same order. For example list={x == y, y == x} ; should become <...
4
votes
0answers
68 views

Create an adequate 'training set' to train a ClassifierFunction which performs the role of the built-in `SubsetQ`

I am trying to "grow" my own SubsetQ function using Machine Learning methods. My cSubsetQ when given two lists (listA and listB)...
15
votes
3answers
485 views

Generating Tuples with restrictions

I am interested in a certain subset of all tuples. Generating all with Tuples and then filtering is wasteful, and will "blow up" very quickly. For a concrete ...
1
vote
1answer
65 views

Monitoring a matrix with changeable elements as Manipulate in plotting [closed]

If we remember, Mathematica has an ability to show a Psudo-window of plots for monitoring the effects of some changeable parameters in the functions. For example ...
2
votes
4answers
67 views

Partition list into sublists of decreasing length [duplicate]

For example, I would like to partition {1,2,3,4,5} into {1} {1,2} {1,2,3} {1,2,3,4} {1,2,3,4,5} with just one line of code. ...
2
votes
2answers
114 views

plotting eigenvalues with devoted level coloring

I am about to plot eigenvalues of a matrix versus varyingj's. ...
2
votes
2answers
111 views

Implementing an affine cipher

I am trying to create functions for encoding and decoding an affine cipher in Mathematica. I have written these two functions: ...
8
votes
1answer
101 views

Duplicate-free results of permutations + constant list

Given a constant list const, e.g. const = {-(15/2), -(13/2), -(17/2), -(15/2), -(13/2), -(11/2)} of length ...
4
votes
1answer
28 views

List of sound objects indexing

I am creating a list of sound objects: tones={}; For[j = 0, j <= 40, j++, tones = Append[tones, Play[Sin[2*Pi*t*500/Exp[-0.1*j/20]], {t, 0, 1}]]]; Each ...
3
votes
2answers
69 views

Assigning multiple solutions different replacement names

Let's say we are solving a homogeneous differential equation, such as $$y^{\prime\prime} + a y^{\prime} + b y = 0$$ with characteristic equation $$s^2 + a s+ b = 0.$$ Using the ...
9
votes
2answers
179 views

Position with test for list of lists [duplicate]

Why do I get this error message? It seems to me that the level specification should have done the job. ...
8
votes
9answers
366 views

Positions of elements in the initial flattened list in a split list

Say, we have a list: m1 = {2, 2, 7, 0, 7, 7, 2, 2, 2} It can be split easily: ...
2
votes
0answers
18 views

Plotting list of functions while some of them are undefined [duplicate]

I'm struggling with the following code ...
4
votes
2answers
162 views

Subset-type function construction

This is probably a very straightforward thing I am missing, and probably also a duplicate(!), but I can't for the life of me think how to do this cleaner. I want to achieve what ...
0
votes
1answer
34 views

Picking some elements of a matrix and generating another matrix [duplicate]

If we have a nested matrix as: start={ {{1, 2, 2, 3}, {1, 1, -2, 1}, {3, 2, 2, -I}, {1, 2, 0, -I}}, {{3, 4, 4, 0}, {1, 1, 4, 1}, {3, 3, 4, -1}, {1, 1, 2, I}} } ...
2
votes
1answer
37 views

wrong result of an iteration related to replacement and comparing

We have two nested matrix and a code for replacement following an equality as: ...
4
votes
2answers
98 views

replacement in a nested matrix

We have a nested matrix m1 = {{{1, 2, 2, I}, {1, 1, -2, 1}, {3, 2, 2, -I}}, {{3, 4, 4, I}, {1, 1, 4, 1}, {3, 3, 4, -1}}}; we must replace the first number of ...
0
votes
0answers
74 views

Make smooth plot from data

After some awesome tips from @qwerty I still have some doubts As I said, I´d Like to make a smooth function with some other colors, I plot the graph, there is a lot of data. The situation is this: I ...
0
votes
0answers
46 views

How to get x = 1.234 from {x -> 1.234}? [duplicate]

I'm a complete beginner in Mathematica (started a couple of days ago). I've solved a function using "Solve" and the result is this one: Out[1] = {x -> 0.000942939} How do I get the 0.000942939 ...
6
votes
1answer
324 views

Battery charge simulation not clipping properly as it iterates

My code for simulating a batterylevel-state throughout a year in 15min-steps doesn't work. There is a certain list-inputs which simulates the charge state and the batterylevel-state, additionally ...
9
votes
3answers
309 views

Implementation of a matrix formula

For the Bézier surface, which owns the following matrix definition: $$\begin{align*} S(u,v)&=\sum_{i=0}^m \sum_{j=0}^n P_{i,j} B_{m,i}(u) B_{n,j}(v)\\ &=\small \begin{pmatrix}B_{m,0}(u)&\...
0
votes
1answer
142 views

How to make smooth function from data [closed]

After some awesome tips from @qwerty I still have some doubts As I said, I´d Like to make a smooth function with some other colors, I plot the graph, there is a lot of data. The situation is this: I ...
16
votes
5answers
629 views

Easiest/most efficient way to delete duplicates from one list at the positions of another?

This question is somewhat related to How to efficiently find positions of duplicates? , although I'm interested in something a little bit simpler since I'm not really interested in a list of all the ...
1
vote
1answer
36 views

Choosing sets from Subsets[list] part 2

Piggybacking off of this question, say if I wanted to exclude sets which weren't the union of elements of the list of lists. For example: ...
6
votes
5answers
158 views

Choosing sets from Subset[list]

Say I have a set, S, and I take Subsets[S] (the power set of S). For example: S={a,b,c} Subsets[S]={{}, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}} How can ...
11
votes
1answer
192 views
0
votes
0answers
21 views

Adding a list up to a starting value [duplicate]

The code that i need has a starting value of 5. From this starting value on a list of numbers is added consecutively like this list {-0.1,-0,3,-0.1,0.1,-0.1} ...
2
votes
2answers
336 views

How to optimize this code?

I am implementing a code that works correctly but it takes too much time. I did not see how to optimize it to be run quickly. Here is my code: ...
3
votes
1answer
64 views

How to collect elements in one list with the constraints provided in a second list

I wish to collect the items in the first list provided the constraints in the second list. For example in the lists shown below the first list shows a bunch of strings and the second list shows the ...
0
votes
0answers
58 views

(Sparse Array) Can Mathematica delete some of the 0's from a list?

This question continues form Can Mathematica delete some of the 0's from a list? This time I want to delete zeros before the first positive integer. I have a list: ...
1
vote
2answers
91 views

Partial comparison between lists contained in larger matrices [closed]

Please presume we have two nested matrices m1 and m2: ...
3
votes
2answers
353 views

Mandelbrot set—efficiently iterate over a list of initial points

OP edit: This is a Mathematica-specific question about an approach it attempted for a fractal visualization problem described HERE. I'm using the Mandelbrot set there and here as an example, but the ...
0
votes
1answer
52 views

generation a nested matrix with a partly comparison of two other nested matrices [closed]

(this problem is maybe challenging because of its partly comparison) there are two nested matrices: mainmatrix1: ...
4
votes
3answers
215 views

Creating a nested matrix from two lists

I have a matrix and two lists: ...
1
vote
1answer
96 views

How to do this Function with compile

There is 4 lists, 3 of them are at same length (l0, l1 and l3). ...
11
votes
3answers
320 views

Partition a list based on specific elements? Grab the sublists beginning with a certain marker elements

Say I have the list {{a}, {0, 2, 5}, {5, 4, 1}, {a}, {1, 1, 0}, {1, 4, 2}, {3, 3, 0}, {a}, {3, 2, 0}, {1, 4, 1}} I would like to make sublists of everything ...
2
votes
2answers
60 views

Remove an element of a list [duplicate]

I want to check if any element of a list contains Missing["NotAvailable"] If so I want to delete the entire list. If I am correct I need to have some ...
6
votes
4answers
263 views

Average dataset with many repetitions?

I have a dataset where each item is of the form: <|"p1" -> x1, "p2" -> x2, "r1" -> y1, "r2" -> y2|> The interpretation is this: ...
5
votes
6answers
185 views

Replicate and expand a list

I have two lists a and b of the same length. And another list a2 which contains all elements ...
11
votes
1answer
248 views

Why does Outer sometimes return a packed array, and sometimes not?

For example In[342]:= test3 = Flatten[Outer[Plus, Range[1000], Range[1000]], 1]; // AbsoluteTiming Out[342]= {0.0198735, Null} returns PackedArray (...
1
vote
1answer
92 views

Manipulating Some Lists in Compile

Consider a list of lists, such as: Z={{1,4,3},{2,1,3},{3,1,4}} Z is an $n \times n$ matrix (here $3 \times 3$) which ...
2
votes
2answers
77 views

Multiplying a table with constants

I have a table with coordinates {{x1,y1},{x2,y2}} that I want to multiply with a separate constant for x and one for y so: ...