Maximizing Data Storage and Efficiency in Mathematica: A Beginner's Guide

Click For Summary

Discussion Overview

The discussion revolves around maximizing data storage and efficiency in Mathematica, particularly from the perspective of a beginner transitioning from MATLAB and Maple. Participants address questions related to data storage methods, indexing, and command execution within Mathematica.

Discussion Character

  • Exploratory
  • Technical explanation
  • Homework-related

Main Points Raised

  • One participant inquires about the best way to store data in Mathematica, questioning whether to use matrices like in MATLAB or if there are better alternatives.
  • Another participant mentions that Mathematica supports sparse matrices, which can significantly reduce data size if the matrix is sparse, and suggests using DumpSave for compressed storage of variables.
  • There is a discussion about indexing, with a participant noting that indexing access is faster and more compact than building arrays iteratively, and that arrays and matrices should be used when sizes are fixed and known in advance.
  • A participant expresses a desire for a separate window to execute commands, indicating they want to use the notebook for script writing and testing small code snippets.
  • Another participant suggests using the "Table" command to fill an array or matrix and explains how to access elements in an array using indexing.

Areas of Agreement / Disagreement

Participants generally agree on the utility of sparse matrices and the use of indexing for efficiency, but there is no consensus on the best method for executing commands outside of the notebook interface, as the initial poster expresses a specific need that remains unaddressed.

Contextual Notes

The discussion does not resolve the initial participant's request for a separate command execution window, and assumptions about the fixed size of data are not fully explored.

Who May Find This Useful

Beginners transitioning to Mathematica from other programming environments, particularly those with experience in MATLAB or Maple, may find this discussion relevant.

EngageEngage
Messages
203
Reaction score
0
Hi,
Im a pretty decent MATLAB and maple user and now I am starting to use mathematica, because I've heard good things about it. I had some simple questions about it that I was hoping someone could answer.

1.) What is the best way to store data in mathematica? Do people use matricies like in matlab, or is there some better way.
2.) How does indexing work?
3.) Is there some sort of way to get a 'command line' to try out commands before using them in your script?

If anyone could help me out with these questions I would appreciate it grealty. Also sorry if htese are bad questions, like i said, I am a beginner.
 
Physics news on Phys.org
I just realized that there is a math program section. If the mods could move it there I would appreciate it. Sorry about that!
 
Hi Engage²

Mathematica has sparse matrices, which can reduce the data size considerably if the matrix is reasonably sparse. Otherwise you can use DumpSave to get a reasonably compressed storage of all variables in memory. In general, indexing access is faster and more compact than iteratively building up an array. Typically you should use arrays and matrices primarily when the size is fixed and known in advance.

The notebook interface is essentially a command-line interface, so I am not sure what you are after.
 
Thank you for the quick reply! Yeah, I know it is just like a command line, i guess I was looking for another window to execute commands. It was my plan to use the notebook as a place to write scripts and try out little chunks in a separate area.

But my data will definitely have fixed size. Is there any easy way to call up a cell in an array or matrix? Right now I'm trying to write a loop that will fill up a fixed matrix or an array, cell by cell.
 
The command "Table" will fill an array or matrix. If x is an array then x[] will access the i'th element.
 
That is exactly what i was looking for. Thank you so much for the help!
 

Similar threads

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