Re: [sage-support] Re: Extract only some elements from a set
Thank you very much. On 26 February 2013 18:52, Christophe BAL wrote: > Hello, > this is more a python question that a sympy question > > If L is the list [{x0:1, x1: 0, y0: 1}], then L[0] is the dictionnary > {x0:1, x1: 0, y0: 1}. Than you can try something like L[0]["x0"] or > L[0][x0]. > > Hoping that this will help you. > > Best regards. > Christophe. > > > 2013/2/26 Santanu Sarkar > >> Sorry, I can not understand the approach. >> >> Let I=[{x0:1, x1: 0, y0: 1}]. Suppose I want to find only x0 and x1. >> How is it possible? >> >> >> On 26 February 2013 16:37, akhil wrote: >> >>> >>> >>> On Tuesday, February 26, 2013 1:40:26 PM UTC+5:30, Santanu wrote: Dear all, I have a set non linear equations over Boolean variables x_1,..., x_{1}. Sat solver gives I=[{x1: 0, x100: 1, .}]. I am interested to see only the values of x1,.., x100. Will you kindly help me ? >>> >>> >>> Hello, >>> >>> Let d be the concerned dictionary, whose keys are x1 to x1, and >>> corresponding to each key, value is in {0,1}. >>> >>> One can do the following: >>> >>> l = [ ] >>> for i in range(1,101): >>> l.append('x' + str(i)) >>> >>> d1 = { } >>> >>> d1 = {keys:d[keys] for keys in l} >>> >>> The result will be the dictionary d1 containing only (key,value) pairs >>> corresponding to keys x1,x100. >>> >>> Regards, >>> >>> AKHIL. >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "sage-support" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to sage-support+unsubscr...@googlegroups.com. >>> To post to this group, send email to sage-support@googlegroups.com. >>> Visit this group at http://groups.google.com/group/sage-support?hl=en. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >>> >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "sage-support" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to sage-support+unsubscr...@googlegroups.com. >> To post to this group, send email to sage-support@googlegroups.com. >> Visit this group at http://groups.google.com/group/sage-support?hl=en. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > -- > You received this message because you are subscribed to the Google Groups > "sage-support" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-support+unsubscr...@googlegroups.com. > To post to this group, send email to sage-support@googlegroups.com. > Visit this group at http://groups.google.com/group/sage-support?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: [sage-support] Re: Extract only some elements from a set
Hello, this is more a python question that a sympy question If L is the list [{x0:1, x1: 0, y0: 1}], then L[0] is the dictionnary {x0:1, x1: 0, y0: 1}. Than you can try something like L[0]["x0"] or L[0][x0]. Hoping that this will help you. Best regards. Christophe. 2013/2/26 Santanu Sarkar > Sorry, I can not understand the approach. > > Let I=[{x0:1, x1: 0, y0: 1}]. Suppose I want to find only x0 and x1. > How is it possible? > > > On 26 February 2013 16:37, akhil wrote: > >> >> >> On Tuesday, February 26, 2013 1:40:26 PM UTC+5:30, Santanu wrote: >>> >>> Dear all, >>> I have a set non linear equations over Boolean variables x_1,..., >>> x_{1}. >>> Sat solver gives I=[{x1: 0, x100: 1, .}]. I am interested to see >>> only the values >>> of x1,.., x100. Will you kindly help me ? >>> >> >> >> Hello, >> >> Let d be the concerned dictionary, whose keys are x1 to x1, and >> corresponding to each key, value is in {0,1}. >> >> One can do the following: >> >> l = [ ] >> for i in range(1,101): >> l.append('x' + str(i)) >> >> d1 = { } >> >> d1 = {keys:d[keys] for keys in l} >> >> The result will be the dictionary d1 containing only (key,value) pairs >> corresponding to keys x1,x100. >> >> Regards, >> >> AKHIL. >> >>> >>> >>> >>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "sage-support" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to sage-support+unsubscr...@googlegroups.com. >> To post to this group, send email to sage-support@googlegroups.com. >> Visit this group at http://groups.google.com/group/sage-support?hl=en. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > -- > You received this message because you are subscribed to the Google Groups > "sage-support" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-support+unsubscr...@googlegroups.com. > To post to this group, send email to sage-support@googlegroups.com. > Visit this group at http://groups.google.com/group/sage-support?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: [sage-support] Re: Extract only some elements from a set
Sorry, I can not understand the approach. Let I=[{x0:1, x1: 0, y0: 1}]. Suppose I want to find only x0 and x1. How is it possible? On 26 February 2013 16:37, akhil wrote: > > > On Tuesday, February 26, 2013 1:40:26 PM UTC+5:30, Santanu wrote: >> >> Dear all, >> I have a set non linear equations over Boolean variables x_1,..., >> x_{1}. >> Sat solver gives I=[{x1: 0, x100: 1, .}]. I am interested to see only >> the values >> of x1,.., x100. Will you kindly help me ? >> > > > Hello, > > Let d be the concerned dictionary, whose keys are x1 to x1, and > corresponding to each key, value is in {0,1}. > > One can do the following: > > l = [ ] > for i in range(1,101): > l.append('x' + str(i)) > > d1 = { } > > d1 = {keys:d[keys] for keys in l} > > The result will be the dictionary d1 containing only (key,value) pairs > corresponding to keys x1,x100. > > Regards, > > AKHIL. > >> >> >> >> >> -- > You received this message because you are subscribed to the Google Groups > "sage-support" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-support+unsubscr...@googlegroups.com. > To post to this group, send email to sage-support@googlegroups.com. > Visit this group at http://groups.google.com/group/sage-support?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support?hl=en. For more options, visit https://groups.google.com/groups/opt_out.