I am trying to write a code in python that will display the trajectory of projectile on a 2D graph. The initial velocity and launch angle will be varying. Instead of calculating it every time, I was wondering if there is any way to create a data file which will store all the values of the coordinates for each of those different combinations of speed and launch angle. That is a 4 dimensional database. Is this even possible?
-
Take a look at [pandas](https://pandas.pydata.org) – tromgy Jan 29 '22 at 05:41
2 Answers
This sounds like a pretty ideal case for using CSV as your file format. It's not a "4 dimension" so much as a "4 column" database.
initial_velocity, launch_angle, end_x, end_y
which you can write out and read in easily - using either the standard library's csv
module, or pandas
' read_csv()

- 2,476
- 1
- 12
- 16
-
That would make the database way too big I have total 450k combinations of the velocity vs angle – MCUxDaredevil Jan 31 '22 at 07:23
i think that you should look at the HDF5 format, which has been specialized to work with big data in NASA and bulletproof in very large scale applications :
From the webside
HDF5 lets you store huge amounts of numerical data, and easily manipulate that data from NumPy. For example, you can slice into multi-terabyte datasets stored on disk, as if they were real NumPy arrays. Thousands of datasets can be stored in a single file, categorized and tagged however you want.
In addition from me is the point that NumPy has been developed to work with multidimensional array very efficiently. Good luck !

- 741
- 3
- 12
-
Numpy is useful for storing data within the memory (RAM) and so it will only remain while the code is running or until the device is turned off. But I need to store it in a file format so as to access it at any other time from any other device. But thanks for the HDF5 format, I'll check it out – MCUxDaredevil Jan 31 '22 at 07:26