Questions tagged [indexing]

The tag has no usage guidance.

29 questions
Filter by
Sorted by
Tagged with
59 views

Generating a List of Indexed Variables with "=" sign [closed]

I want to generate variables in the form of: r1 = number, r2 = number, r3 = number, etc The 'numbers' are not necessarily the same and come form a previous calculation. This is what I have: ...
• 676
89 views

Symbolic Indexing on Symbolic Arrays

Is there a way to use symbolic indices on symbolic vectors? The most barebones example I can think of is the following: aV = Array[a,3]; aV[[m]] which evaluates to ...
• 121
251 views

Enumeration of a nested list

My problem is consisting of following: I have a nested list of following form: {{B, v ** v, b ** B}, {b, B ** b}, {b ** B, v ** v}, {}} And I want to enumerate ...
• 69
1 vote
74 views

Indexed array cannot be named by the name of its elements

Indexed Arrays or lists can be created by Array[k,3] (*{k[1], k[2], k[3]}*) However I would like to name this list also by k, i....
1 vote
83 views

Comparing two texts, looking for matching phrases

I would like to compare two human-language, user-supplied texts. Call them Text A and Text B. Each is the length of a fat novel, i.e., around 150,000 words. Is there a tool that can help me find all ...
• 11
248 views

Creating a list of conditions

I am trying to create a list of conditions using Table[] in the following way: ...
• 1,165
1 vote
147 views

How to index a Table of Lists? [closed]

SOLVED: Thanks to Daniel below, I should index as expected as [[All,All,1] for er etc. My mistake came as I was trying to index from 0, which Mathematica does not like! I've spent a while reading ...
• 304
106 views

Search speed of downvalues when indexing with strings

I'm writing a lot of print functions for different parts in a package and at the moment am using something like myprint[ identifierString_String ][ data_ ] := ... ...
• 1,470
117 views

How can I merge indices, such as converting a $4$-index list to $2$-index matrix, $C_{ijkl} \rightarrow D_{(ik); (jl)}$?

How can I merge indices, such as converting a $4$-index list to $2$-index matrix, $C_{ijkl} \rightarrow D_{(ik); (jl)}$? This example sometimes appears in physics applications. Here, I mean $(ik)$ as ...
• 225
345 views

Part::partd: Part specification is longer than depth of object (Simple list) [closed]

I know that this question has already been asked (I searched for answers), but in every thread I saw the code was much more complicated than what I'm trying to do, and I can't understand why this ...
375 views

Intelligent text search on large directories of notebooks?

I have a (deeply nested) directory containing 10s of thousands of wolfram files (mostly notebooks (nbs), but also scripts (.wls), packages (.m, .q wl), my and wxf data) and many subfolders each with a ...
• 31.2k
184 views

Selecting elements of sublists or reshaping a list of lists

I have this list ...
• 63
75 views

Reduction of nested association based on criteria

I have a nested association of the following form: ...
• 113
152 views

Summation variables aren't recognised as dummy variables

I'm trying to write this expression in Mathematica, and calculate the following quantity However, when I tried the following ...
• 229
1 vote
179 views

Index an array with condition

I have a list like the following: list = {{1, 11}, {2, 7}, {4, 2}, {7, 9}, {-2, 1}}; I would like to select those entries whose second elements are greater than 2, ...
19 views

Indexing list returned by a function [duplicate]

How do I access elements of a list that is returned by a function? My function that returns the list is: b[x_] := (Return[{x, x/2}];) Then when I try to reference ...
• 195
1 vote
70 views

Computing a Transformation then visualizing with TransformedRegion Function

I have some function $\psi$, I compute the transformation $T = \vec{x} - \nabla \psi$. I'd like to visualize the action of $T$ on a square centered at the origin. The mathematica website shows some ...
• 187
1 vote
101 views

Can you create an indexed list of all Wolfram functions within a notebook? [closed]

Can you create a summary list of all Wolfram functions used within a whole notebook? Searched long and hard- no clear documentation found.
266 views

Undefined Indexed Variable

I searched already a lot about indexed Variables, and it tends to be the most applicable way to use tensor notation. But I am having a hard time to solve for undefined indexed variables: Here my ...
• 187
127 views

Plot the indices of the background Matrix instead of the calculated values

I want to create a background 60*100 matrix and insert inside it the calculated values, for example ...
• 119
99 views

Is it possible to renumber a notebook without rerunning it?

When I prepare a notebook to share with others, I like the numbering of the code cells to start from 0 and to increment predictably to make them more readable, but the only way I know to do this is by ...
• 185
1 vote
88 views

How does Mathematica evaluate sums where the upper limit of the index is not an integer?

I am interested in the way Mathematica evaluates sums where the upper limit of the index is not an integer - i.e., sums that are some sense mathematically meaningless. For example: ...
• 2,141
79 views

How to identify index intervals that contain a value?

I have a really simple question but, sorry, I can't seem to find an elegant solution to other than iterating through. I have a list of indices, and a relative list of values, I would like to extract ...
330 views

How to create a nested list of variable depth with indexed elements

i want to obtain this definition of a nested list t = Table[C[i, j], {i, 3}, {j, 3}] with arbitrary depth, ...
• 794
484 views

Contracting indices in lists

Using an answer to this question (Working with Dirac Gamma Matrices using FeynCalc - A simple problem), I defined ...
• 73
337 views

how to add labels of points next to it based on index in ListPlot

I have a list of some points. I plotted each point and its closest surrounding points. ...
• 111
118 views

Replace pattern with the number of matches so far

I want to replace a n-th pattern match in an expression with n. This is a very simple task, though it appears very hard to find an elegant implementation. For example, with input ...
• 1,161
1 vote
74 views

Sum index in function collides with input variable

When I enter the following: Clear["Global`*"] Func[f_, xx_] := Sum[D[f, xx[[s]]], {s, 1, 2}] Func[x^2 + y^2, {x, y}] Func[x^2 + s^2, {x, s}] The first function ...
• 11