How to Manipulate List Elements in Mathematica?

  • Context: Mathematica 
  • Thread starter Thread starter mikezburke
  • Start date Start date
  • Tags Tags
    Mathematica
Click For Summary
SUMMARY

This discussion focuses on manipulating list elements in Mathematica version 6. The user successfully reads data from a text file using the command ReadList["where_the_file_is_located/Data.txt", {Number, Number}] and plots it with ListPlot. The main challenge addressed is how to manipulate individual members of the list, specifically multiplying all x-values (the first "Number") by a specified factor. The solution provided is to use list[[All, 2]] to access all second elements of the list.

PREREQUISITES
  • Basic understanding of Mathematica syntax and functions
  • Familiarity with data import methods in Mathematica
  • Knowledge of list manipulation techniques in Mathematica
  • Experience with plotting functions like ListPlot
NEXT STEPS
  • Explore Mathematica's list manipulation functions such as Map and ReplaceAll
  • Learn about data visualization techniques in Mathematica beyond ListPlot
  • Investigate advanced data import options in Mathematica for handling different file formats
  • Study the use of functional programming in Mathematica for more complex data transformations
USEFUL FOR

This discussion is beneficial for engineering students, data analysts, and anyone new to Mathematica who seeks to manipulate and visualize data effectively.

mikezburke
Messages
2
Reaction score
0
How to do this in Mathematica??

Hi - I am an engineering student who is quite new to Mathematica (v. 6) but I really enjoy it. Lots of examples, easy to just play and figure out how to do something for yourself. Makes beautiful output. However, I have not been able to figure this out...
I am using another program (COMSOL) which will export values from a graph as a text file - eg "Data.txt". I use list1 = ReadList["where_the_file_is_located/Data.txt", {Number, Number}] to read the date into a list. Then I use ListPlot[{list1}, PlotRange -> {0, as_big_as_I_need}] and it plots very nicely.
However, I cannot figure out how to manipulate individual members in my list (i.e. multiply all the x-values [the first "Number"] by something. How can I manipulate all the first or the second "Number(s)" in a list like this?

Thanks!
 
Physics news on Phys.org


list[[All,2]] would give a list of all of the second elements
 


Perfect thanks!
 

Similar threads

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