Mathematica How to Manipulate List Elements in Mathematica?

  • Thread starter Thread starter mikezburke
  • Start date Start date
  • Tags Tags
    Mathematica
AI Thread Summary
The discussion focuses on using Mathematica for data manipulation and plotting. The user, an engineering student, successfully imports data from a text file generated by COMSOL using the ReadList function. They can plot the data using ListPlot but are struggling with how to manipulate individual elements in the list, specifically multiplying all x-values (the first element of each pair) by a certain factor. A solution is provided, indicating that using list[[All, 2]] allows access to all second elements of the list, which helps in manipulating the data as needed. The conversation highlights the ease of use and powerful output capabilities of Mathematica for engineering applications.
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
Views
2K
Replies
1
Views
2K
Replies
4
Views
2K
Replies
6
Views
4K
Replies
1
Views
2K
Replies
5
Views
2K
Back
Top