1

What is the propper way to create the equivalent of a dictionary object in Mathematica?

For instance, say roughly that the desired dictionary has the form

truckWheel = 
  {"name":"wheel", "mass":5.7, "Ix":20.0, "Iy":1., "Iz":17., "center of mass":{0.,0.,0.}}

where a key/data pair is indicated by a colon ( : ).

Then individual elements would be accessed by their keys

truck_wheel["name"] (* would return "wheel" *)
truck_wheel["mass"] (* would return 5.7 *)

and new elements are added by creating a new key:

truck_wheel['Ixy'] = 0.0
m_goldberg
  • 107,779
  • 16
  • 103
  • 257
Dimitris
  • 4,794
  • 22
  • 50

0 Answers0