Referring to elements of a table in Mathematica

Click For Summary
SUMMARY

The discussion focuses on calculating the change in values of a table named B in Mathematica. The user aims to create a new table C where each element is defined as the difference between consecutive elements of B, specifically using the notation c_i = b_{i+1} - b_i. The suggested Mathematica syntax for this operation is C = B[[2;;100]] - B[[1;;99]], although the user is unable to test it. Additionally, the user mentions that using a loop is a viable alternative for this task.

PREREQUISITES
  • Familiarity with Mathematica syntax and functions
  • Understanding of list indexing in Mathematica
  • Basic knowledge of mathematical notation for sequences
  • Experience with loops in programming
NEXT STEPS
  • Explore Mathematica's list manipulation functions
  • Learn about using loops in Mathematica for iterative calculations
  • Research advanced indexing techniques in Mathematica
  • Study the use of built-in functions for calculating differences in lists
USEFUL FOR

Mathematica users, data analysts, and anyone interested in performing calculations on lists and tables within the Mathematica environment.

MostlyHarmless
Messages
344
Reaction score
15
See title.

I have a table that I've named B. And I want to create table that is essentially the change in values of B. If I was writing this on paper I would say: Let ##b_i \in B##, for ##0\leq i\leq100##. Then let ##c_i \in C## such that ##c_i= b_{i+1}-b_{i}##. I don't know how to say that in Mathematica's language though.

Another option I guess would be to find a way to assign an indexed variable to each value of the table. With the indexing variable being the same.
 
Last edited:
Physics news on Phys.org
The help page suggests something along the line of C=B[[2;;100]]-B[[1;;99]], but I cannot test it here.
Something that certainly works is a loop.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
7K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
5K
  • · Replies 6 ·
Replies
6
Views
10K
  • · Replies 3 ·
Replies
3
Views
2K