Hi Alexander,
I figure out how to edit value of dictionary which is a list.I notice that it
can overwrite the original value, make use of this property and use union can
solve this.
AddDictionary(d,x^2+2*x,
[]);AddDictionary(d,x^2+2*x,Union(LookupDictionary(d,x^2+2*x),
[y+1]));AddDictionary(d,x^2+2*x,Union(LookupDictionary(d,x^2+2*x), [y+x]));aa
:= LookupDictionary(d,x^2+2*x);
Regards,
Martin
> From: tesl...@hotmail.com
> To: hul...@math.colostate.edu
> Date: Thu, 25 Sep 2014 15:27:54 +0800
> CC: fo...@gap-system.org
> Subject: Re: [GAP Forum] which function of dictionary can use polynomial or
> function as key
>
> Hi Alexander,
> How to edit the value of dictionary?How to append a function to a list which
> is a value of dictionary?
> Regards,
> Martin
> > Subject: Re: [GAP Forum] which function of dictionary can use polynomial or
> > function as key
> > From: hul...@math.colostate.edu
> > Date: Wed, 24 Sep 2014 09:27:04 -0600
> > CC: fo...@gap-system.org
> > To: tesl...@hotmail.com
> >
> > Dear Forum,
> >
> > On Sep 24, 2014, at 9/24/14 3:21, Lee Martin CCNP <tesl...@hotmail.com>
> > wrote:
> >
> > > would like to use rational function as key in dictionary like table
> > > function in maple
> > > which function is a dictionary can use function as key and value as list
> > > to store ideals.
> >
> > Lookup dictionaries currently work with rational functions, e.g:
> >
> > gap>
> > R:=PolynomialRing(Rationals,["x","y","z"]);AssignGeneratorVariables(R);
> > Rationals[x,y,z]
> > #I Assigned the global variables [ x, y, z ]
> >
> > gap> d:=NewDictionary(x,true);
> > <object>
> > gap> AddDictionary(d,x,1);
> > gap> AddDictionary(d,y,2);
> > gap> LookupDictionary(d,x);
> > 1
> > gap> LookupDictionary(d,z);
> > fail
> > gap> AddDictionary(d,x/y,2);
> > gap> LookupDictionary(d,z);
> > fail
> > gap> LookupDictionary(d,x/y);
> > 2
> >
> > Instead of numbers you should be able to store arbitrary associated
> > information. However internally lists will be made immutable, so if your
> > ideal list is expected to grow you would need to keep a separate (mutable)
> > list of the ideal lists, storing only an index in the dictionary.
> >
> > I note that
> >
> > gap> RepresentationsOfObject(d);
> > [ "IsComponentObjectRep", "IsDictionaryDefaultRep", "IsListDictionary",
> > "IsListLookupDictionary", "IsSortDictionary", "IsSortLookupDictionary" ]
> >
> > this currently uses sorted lists internally and not yet hashing. To enable
> > hashing, one would have to add a method for SparseHashKey for rational
> > functions, which currently is not on the list of features.
> >
> > Best,
> >
> > Alexander Hulpke
> >
> >
> > > Regards,
> > > Martin
> > > _______________________________________________
> > > Forum mailing list
> > > Forum@mail.gap-system.org
> > > http://mail.gap-system.org/mailman/listinfo/forum
> >
>
> _______________________________________________
> Forum mailing list
> Forum@mail.gap-system.org
> http://mail.gap-system.org/mailman/listinfo/forum
_______________________________________________
Forum mailing list
Forum@mail.gap-system.org
http://mail.gap-system.org/mailman/listinfo/forum