ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 21 Aug 2018 06:01:42 -0500How can I compute the minimal fixing set?http://ask.sagemath.org/question/43433/how-can-i-compute-the-minimal-fixing-set/Having the automorphism group Aut(G) of graph G, what is the minimal set of nodes S where each automporphism in Aut(G) contains at least one of the nodes in a set S?
For small graphs it could be computed without using Sage or any other programming. However, for large graphs, writing a piece of code is necessary.ASHTue, 21 Aug 2018 06:01:42 -0500http://ask.sagemath.org/question/43433/Rekursive Generator which fetches a subset of elements on demandhttp://ask.sagemath.org/question/40850/rekursive-generator-which-fetches-a-subset-of-elements-on-demand/i have following Task to solve; write a generator which outputs a Set (M) of Sets(S) with subsets of M from S \ {s] and M and {s} .. sounds weird.
what i wrote is:
def getSubsets(S):
if(sage.sets.set.is_Set(S)):
s=Set(S.subsets())
for sub in s:
yield [sub]
else:
if(S.is_empty() == false):
yield [S]
else:
yield []
with following test, i can mySet.next() fetch a Set from the Pool of Sets.
var('a','b','c','d')
a=Set([3,4])
b=Set([a,c,d])
d=Set([])
mySet = Set([a,b,1,2])
print(mySet)
myGen = getSubsets(mySet)
Now i have a Problem, rewriting that as recursive function. Is that even possible?
Please dont send in "perfect solutions", i want to learn how to solve that puzzle by myself.
Thank you!
SageIsABummerMon, 29 Jan 2018 09:19:21 -0600http://ask.sagemath.org/question/40850/Set Covering Algorithmhttp://ask.sagemath.org/question/38764/set-covering-algorithm/ Is there a Sage implementation of the Set Covering Algorithm?
Thanks in advanceAntonioFri, 08 Sep 2017 18:02:27 -0500http://ask.sagemath.org/question/38764/comparing sets of roots of charpolyhttp://ask.sagemath.org/question/35729/comparing-sets-of-roots-of-charpoly/ I am missing something about how to compare list of roots.
During a small algorithm I need to know wether a matrix has or not complex eigenvalues. I did the following
A=matrix(QQ,[[1,2,1],[6,-1,0],[-1,-2,-1]])
a=(B.charpoly()).roots(ring= QQ, multiplicities=False)
b=(B.charpoly()).roots(ring= QQbar, multiplicities=False)
then a is the list [-4,0,3] and b is the list [3,0,-4].
I don't get the following :
set(a)==set(b)
return false while
set([-4,0,3])==set([3,0,-4])
return true.
Any help, either on the first pb (knowing that a QQ matrix has complex eigenvalues) or on the second would be greatly appreciated.
Cheers.Laurent BThu, 24 Nov 2016 14:15:42 -0600http://ask.sagemath.org/question/35729/Can I show ordered sets in order?http://ask.sagemath.org/question/34369/can-i-show-ordered-sets-in-order/ I'm using SageTex to generate random algebra tests, with an answer key at the end. To have my students show they understand roster notation for sets, I'm having them write the set of all two-digit multiples of n for some number n in {2, 3, 4, ... 9}. Asking the question isn't hard. But in generating the answer key, the set shows up in random order. I know it's still the same set, of course, but it's less intuitive to interpret. It seems like Sage is going out of it's way to randomize the set. Here's some minimal working code:
n = Set(range(2, 10)).random_element()
X = Set()
for i in range(10, 100):
if i % n == 0:
X = X.union(Set([i]))
show(n)
show(X)
This shows, for example:
8
{32, 64, 48, 40, 80, 96, 16, 24, 56, 72, 88}
Is there some way to have Sage show the elements of the set in order?mathochistSun, 07 Aug 2016 19:13:27 -0500http://ask.sagemath.org/question/34369/Smart set (database?)http://ask.sagemath.org/question/32217/smart-set-database/Hi,
What I would like is to define a smart hierarchical set (or database) like:
example_set={(0,0,0):[4,[7,11,0]], (0,0,1):[-5,[8,-3,6]], (0,1,0):[4,[7,11,-1]]}
The lefthand side is an hierarchy (a,b,c,d,e,...); the righthand side is some structure [*, [*,*,*,...]] consisting of nested lists. How can I quickly -via a smart design- determine for instance the sum for a higher level? For instance example_set.sum[(0,0)] would yield [4-5, [7,11,0] + [8,-3,6]] and example_set.sum[(0,)] yields [4-5+4, [7,11,0] + [8,-3,6] + [7,11,-1]].
The setting is that we have a few thousand hierarchical elements with unknown depth, but always the same structure on the righthand side. The structure could contain many nested lists with in total several hunderd values (flattened). I like to have (fast) basic operators for the lists within the structure such as addition and index.
Another example.
next_example={(0,0,0):[(5,6)], (0,0,1):[(8,9),(3,4)], (0,1,0):[(2,6)], (0,1,1):[(8,16)]}
(wanted) print next_example.sum[(0, 0)]
[(5, 6), (8, 9), (3, 4)]
I considered to define a class and I looked at [database](http://doc.sagemath.org/html/en/reference/databases/index.html). But that didn't help me much :(
To complicate matters, I would also like to connect hierarchical levels (one-direction). For instance in the first example assume (0,0,0) is connected to (0,1,1). How to store and display such a connection? For connections I looked for instance at [igraph](http://doc.sagemath.org/html/en/reference/graphs/sage/graphs/generic_graph.html#sage.graphs.generic_graph.GenericGraph.igraph_graph). But it isn't clear to me whether it would be helpful in combination with the above mentioned set design.
To summarize: it would be awesome if a routine 'smart_set(n, structure)' would define a n-level hierarchy whereby operations like .sum(input) and .sum.connected(input) and .show_graph() would work.
Suggestions how to move forward in Sage are much appreciated!
Roland
RolandbFri, 15 Jan 2016 14:46:28 -0600http://ask.sagemath.org/question/32217/Set vs sethttp://ask.sagemath.org/question/9502/set-vs-set/I am trying to create a class deriving from set or Set because I would like to tack on various attributes to this set based on its elements.
What is the best way to do this? What is the difference between Set and set?
I've posted another question asking how to make a ring of sets.
I understand how to make a ring, but when I try to make a Ring Element I get a base class issue.
Any help in this area is appreciated.SLOtoSFThu, 08 Nov 2012 08:42:47 -0600http://ask.sagemath.org/question/9502/Infimum of a sethttp://ask.sagemath.org/question/9468/infimum-of-a-set/Is it possible to find the infimum of a set using sage ?
[Definition of infimum ](http://en.wikipedia.org/wiki/Infimum)koukourikosWed, 24 Oct 2012 23:17:20 -0500http://ask.sagemath.org/question/9468/How to change the default program which open the 2D picture which the plot producted?http://ask.sagemath.org/question/8516/how-to-change-the-default-program-which-open-the-2d-picture-which-the-plot-producted/I'm using SageMath4.7.2 in Ubuntu10.04. When I called the plot() to draw the 2D picture of some functions in command line of SageMath(not the GUI session in web browser), SageMath show the pictures in evince,which is my PDF files reader. My default picture viewer in Ubuntu is set to gpicview, not evince. When I delete the evince?SageMath call the ImageMagic to display the result. But I need evince to read ebooks, so I installed the evince again. After that the SageMath still call evince to display the 2D pictures. I wonder are there any method to change the default program to open the 2D pictures in SageMath? PS: My mother language is Chinese, not English, so please forgive me for my language errors. Thanks!zwdnetTue, 29 Nov 2011 02:04:10 -0600http://ask.sagemath.org/question/8516/Enumerate elements of a set built using propertieshttp://ask.sagemath.org/question/8396/enumerate-elements-of-a-set-built-using-properties/How can I enumerate all the elements of a set?
For example (I'll use latex to describe the desired set) if the set is:
$$ W = \{ u_{i}[j], \overline{u}_{i}[j]: 1 \leq i \leq n, 1 \leq j \leq m \} $$
oscarvartoTue, 18 Oct 2011 10:54:26 -0500http://ask.sagemath.org/question/8396/