The tag has no wiki summary.

learn more… | top users | synonyms

21
votes
2answers
1k views

Why do Mathematica list indices start at 1? [closed]

In most programming languages, container indices start at 0. This is not random or hardware-related; for example Dijkstra's article explains why zero-based indices make sense. What are the reasons ...
1
vote
1answer
68 views

Tiny question about Indexed[x,n]

Maybe I should apologize for this silly question, but the documentation for Indexed is very short and not explicit. I have an equation with variables ...
1
vote
1answer
48 views

How to swap tensor indices without permutation?

Say I have a tensor of rank R, How to swap $i^{th}$ and $j^{th}$ tensor index? I do not want to use TensorTranspose because it requires to write down the entire permutation, i.e. ...
0
votes
1answer
69 views

Minimizing using indices, error: Part::pkspec1: The expression cannot be used as a part specification

I want to use Minimize where the variables to minimize are indices pointing into an array. Here a MWE that hopefully shows what my problem is. ...
1
vote
1answer
50 views

Summation notation

I have the current setup for calculating Allan Deviation: which was coded as: Sqrt[Total[Differences[y]^2]/(2 (M - 1))] However, after doing some research, ...
1
vote
1answer
75 views

How to evaluate sum with different coefficient in each term?

I would like to know if there is a syntax that allows me to enter a sum that has coefficients that vary for every term? I have no interest in evaluating them numerically, but rather to keep them as ...
0
votes
0answers
51 views

Iteration variable in Sum gets assigned the final iteration value

I've got a function which is defined iteratively via ...
-1
votes
1answer
57 views

Beginner Question: Assigning an indexed Variable to a given list

I am pretty new to the game and have a problem, which i am sitting on for hours. 1) I created a random Matrix 5x5 ...
3
votes
0answers
47 views

Using indexed array elements as integration dummy variables with EvaluationMonitor. Bug?

As part of a routine that must cope with integration of varying numbers of dimensions, I would like to use indexed variable names (e.g., x[0], x[1],...) as dummy integration variables. However, it ...
0
votes
0answers
57 views

How to handle substrings of a matrix by a named index

I am using open source code to run stochastic simulations. The output looks like this: ...
2
votes
3answers
63 views

Referring to the components of a vector within a sum

I feel like I'm missing something obvious here, but.... I'm playing around, trying to do the standard deviation for my stats homework (don't worry, I already worked out the answer by hand), and I ...
-2
votes
1answer
87 views

Recreating in Mathematica a matrix created in Python [closed]

I need to recreate in Mathematica this matrix that I created in Python: ...
1
vote
0answers
38 views

Index change in a recursive definition

Assume I have the following recursive definition: ...
0
votes
1answer
46 views

Finding Coordinates of a Peak on a Pot - Problem with Position[…]

I have plotted a graph from a CSV file which consists of two columns of data Time and Intensity. I simply want to find the time where the intensity is largest. ...
24
votes
7answers
694 views

Faster position list construction from a “take instructions” list

Take some list, e.g., {1,2,3,4,5}, and a "take instructions" list, say {1,1,2,1,1}. The latter is read as "take the first ...
0
votes
1answer
42 views

Recurrence evaluation at specific index

I have the following set of equations. I want to solve a[n] and f[n] for the indices n=1:5. Note that the relation a[2n+2] involves the derivative of f[2n] and the relation for f[2n+2] involves the ...
0
votes
1answer
52 views

Loops over multiple variables (negative i_min)

Can someone explain why i ranges from -3 to 3 in the output of Do[Print[{i, j}], {i, -3, 3}], but not in Do[Print[{i, j}], {i, -3, 3},{j,-i,i}]? I was thinking for the second input I would get ...
0
votes
1answer
95 views

Array element problem in optimization

I have the following piece of code in Mathematica: ...
2
votes
4answers
273 views

How do I find the position of the maximum value in each column of a table?

Given a table of values, I know how to find find maximum values, but how do I find the position of the maximum value in each column. For example, given ...
1
vote
1answer
186 views

Define a Recurrence Table involving other tables

I'm relatively new to using Mathematica. Previously I used Matlab, but lately I noticed that the numbers i got in both of them do not match (mostly it seems that Matlab lacks precision...). The ...
4
votes
0answers
82 views

Unexpected behavior from Indexed

I was going to include Indexed in this answer, thinking that it operated much as a List-only ...
3
votes
1answer
150 views

Collect terms in a sum

Suppose I have this expression ...
8
votes
3answers
319 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 ...
8
votes
5answers
417 views

Efficiently finding the positions of a large list of targets in another, even larger list

I have a big list. It contains nearly 60,000 sub-lists. It's structured like bigList = {{x1,y1,z1},{x2,y2,z2},{x3,y3,z3},.....,{x60000,y60000,z60000}}; I have ...
29
votes
9answers
740 views

Sequentially numbering a nested list

I've got a nested list {a, b, {c, d}, e, {f, {g, h}}} which I want to magically transmogrify to ...