Thanks, your approach is the most convincing.

Martin

> On Jul 15, 2023, at 3:15 PM, Raul Miller <rauldmil...@gmail.com> wrote:
> 
> I think the approaches you described are fine.
> 
> That said, another approach would be to think of your dataset as a
> table -- one row for each atom, with each column having different
> significance. coordinate x,y, z; velocity x,y,z; force x,y,z,  So, if
> you had 42 atoms, your data would be a 42 by 9 matrix.
> 
> Or, perhaps it would be better to distinguish x,y,z from
> coordinate/velocity/force (the 42 atom example being represented with
> a 42 by 3 by 3 array or perhaps more conveniently a 3 by 42 by 3
> array).
> 
> This last approach might have an implementation something like:
> 
> do_step=: positions_update, velocities_update,: forces_update
> 
> where each of the update verbs obtains the requisite information from
> its y argument.
> 
> I hope this makes sense,
> 
> -- 
> Raul
> 
> 
> On Sat, Jul 15, 2023 at 8:18 AM Marcin Żołek
> <marcin.zo...@students.mimuw.edu.pl> wrote:
>> 
>> I am learning J and writing a program in this language to simulate a 
>> physical phenomenon of interactions between atoms (each atom is described by 
>> coordinates, velocities, forces, etc.). I am wondering how to store data in 
>> such a simulation.
>> 
>> The simulation involves applying a function that performs a single 
>> simulation step several times:
>> 
>> do_step^:42 initial_data
>> 
>> Simulation step consists of several substeps. Which storage option is better 
>> or is there other way than the ones listed below?
>> 
>> 1) Data stored in public nouns (one noun is a matrix of coordinates of 
>> atoms, another noun is a matrix of velocities of atoms, etc.). Then do_step 
>> calls substep functions that overwrites these public nouns:
>> 
>> do_step =: monad define
>>    velocities =: forces update_velocities velocities
>>    positions =: velocities update_positions positions
>>    ...
>> )
>> 
>> 2) Data stored in an array of boxes (in the first box an array of 
>> coordinates of atoms, in the second box an array of velocities of atoms, 
>> etc.). Then do_step is the composition of all substep functions and each 
>> substep function is a monad that creates modified array of boxes using m} :
>> 
>> do_step =: monad : 'do_substep_k ... do_substep_2 do_substep_1 y'
>> 
>> Martin
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to