Are there dictionaries in math?

Consider the following dictionary in the programming language Python:

D = {'A': 1, 'B': 2, 'C': 3}

It is saying that the value of A is 1, the value of B is 2, and the value of C is 3. It also has the property that D[‘A’] = 1 etc.

How would I write such thing in math? I was thinking about

D={A=1,B=2,C=3}.

However, I am not sure if this is the right or best way to do such thing.

I would like to use the structure for taking sums: e.g. ‘AAAA’ is interpreted as 1+1+1+1 etc. What kind of notation should I use?

Answer

A dictionary is just a function Dict:KeysValues{ϵ} where ϵ is a “null character” with the understanding that ϵValues.

For example, let Keys={A,B,C,...,Z}, and Values=Z. Then, in your case,

Dict(x)={1if x=A2if x=B3if x=Cϵotherwise

Attribution
Source : Link , Question Author : user356363 , Answer Author : parsiad

Leave a Comment