Ask Your Question

# grobber's profile - activity

 2020-03-10 18:02:11 +0200 received badge ● Self-Learner (source) 2020-03-10 14:49:08 +0200 commented answer getting RESetMapReduce to use multiple cores Oh, and by the way, I tried this just now: if you run this as a sage script (I name mine .sage, make them executable, and put the shebang line #!/usr/bin/env sage at the top), then you don't actually need to import os: it just works. Maybe sage imports it automatically? I don't know, but I know the explicit import isn't needed. 2020-03-10 14:23:56 +0200 commented answer getting RESetMapReduce to use multiple cores Absolutely, that would help! The environment variable is mentioned in passing (twice) on the page I linked, which tipped me off to try to set it, but it's not made clear there that one needs it.. 2020-03-10 12:00:48 +0200 commented answer getting RESetMapReduce to use multiple cores Thanks! I should perhaps have searched more thoroughly; this thread parallels that other one.. 2020-03-10 04:16:48 +0200 answered a question getting RESetMapReduce to use multiple cores Actually, this worked: I ran the same computation in a terminal after setting the environment variable SAGE_NUM_THREADS to whatever was desired (8 in my case). All cores are used in that case. 2020-03-10 04:05:58 +0200 asked a question getting RESetMapReduce to use multiple cores I am reading the documentation on how to parallelize recursive-enumeration computations, and I cannot for the life of me get RESetMapReduce to use more than one core of my machine. I am using the example immediately before the bulleted item titled Generating series on that page, with a minor modification: sage: from sage.parallel.map_reduce import RESetMapReduce sage: S = RESetMapReduce( ....: roots=[[]], ....: children=lambda l: [l + [0], l + [1]] if len(l) < 32 else [], ....: map_function=lambda x: 1, ....: reduce_function=lambda x, y: x + y, ....: reduce_init=0) sage: S.run()  I changed the length to 32 to make the computation heftier. If I run this and watch the process with htop I can see it using only one of my 8 cores to 100% capacity, ignoring the others. I have even tried passing the argument max_proc=8 to the .run() method, to no effect. 2020-03-07 09:46:01 +0200 received badge ● Self-Learner (source) 2020-03-07 08:30:56 +0200 answered a question retrieving word for free group with custom set of generators What ended up working: once I have the list of symbols, as in sage: lst=tuple(f'a{j}' for j in range(5,10))  the free group can be constructed by passing the list via the key word argument names rather than directly: sage: Frgp=Groups().free(names=lst)  Then: sage: Frgp([1,2]) a5*a6  tuple() isn't crucial in the definition of lst: list() works just as well. The point is there's a difference between Groups().free(names=lst) and Groups().free(lst) that I don't quite fully grok at the moment, but the former will do what I want whereas the latter wasn't: sage: Groups().free([var('a')]) Free group indexed by {a} sage: Groups().free(names=[var('a')]) Free Group on generators {a}  As you can see, sage reports slightly different output depending on whether the list is passed via names= or directly. 2020-03-06 23:36:47 +0200 asked a question retrieving word for free group with custom set of generators I would like to define a free group on a custom ordered list of symbols, like say Frgp=Groups().free([f'a{j}' for j in range (5,10)])  i.e. a5 up to a9 (say). It's important that the list be defined programmatically as above, as the number of generators changes throughout the program run (their labels also need to change). I would then like to recover elements of the group by evaluating at numbered lists, as in Frgp([1,2]) to get back a5*a6, say, as suggested in the docs. This syntax of Frgp(), however, only works when I define the group via one of the methods Frgp. = Groups().free()  or Frgp=Groups().free(3,'t')  which are not flexible enough to allow me to interpolate strings in variable names (or are they? I have tried all sorts of eval/exec trickery to no avail). If I define the group in my preferred style (first code display above), then sage: Frgp=Groups().free([f'a{j}' for j in range (5,10)]) sage: Frgp([1,2])  results in an error: TypeError: 'sage.rings.integer.Integer' object is not iterable  Edit: To clarify, I am aware that the goal I alluded to above can be achieved by other means. For instance, I can do sage: Frgp=Groups().free(5,'t') sage: Frgp([1,2])([var(f'a{j}') for j in range (5,10)]) a5*a6  So in other words, I can create a list of symbolic variables and apply a free-group word to that. But this seems like a clumsy workaround. It would be preferable to work in the free group on the desired set of symbolic variables to begin with. 2020-02-16 16:40:59 +0200 received badge ● Teacher (source) 2020-02-16 16:40:59 +0200 received badge ● Self-Learner (source) 2020-02-16 16:14:13 +0200 received badge ● Supporter (source) 2020-02-16 16:14:09 +0200 commented answer meta-question: post formatting Apologies for this: our posts crossed, and hence I duplicated some of the info in yours. I will accept the answer, as it settles my issue. Thank you! 2020-02-16 16:10:11 +0200 answered a question meta-question: post formatting Some progress: though the triple-backtick syntax for block code does not seem to work, the four-space syntax does. So if I prepend four spaces in front of every line below, I get #!/bin/bash echo 'this is code'  The shortcut CTRL-K also apparently works for the same purpose. Block quotes are just plain markdown, prepending > symbols in front of every line one wants to quote, as in first quoted line and the second The question stands of whether it is possible to peek at others' post formatting by quoting the posts via this board's interface; I still do not see how to do that.. 2020-02-16 16:03:24 +0200 received badge ● Student (source) 2020-02-16 15:53:17 +0200 received badge ● Editor (source) 2020-02-16 15:43:32 +0200 asked a question meta-question: post formatting I am new to this board and having some trouble finding documentation for how to format posts. I am familiar with markdown and have posted on the various Stack Exchange forums before, but I find the triple-backtick convention for block code does not work as expected here. How would I produce, for instance, paragraphs of code set out with different background as seen in numerous posts on the board which I unfortunately do not have enough "karma" to link to.. The Markdown basics "cheatsheet" I can see on the right hand side of the present text-entry form says nothing about such matters, and for the life of me I cannot see a quote button on others' posts so I can examine the "source code" myself. Nor do the help and faq sections seem to shed any light on this. Edit: More than anything, the issue is the inability to (easily?) quote someone's post. A clickable quote button on some of the many posts containing the type of formatting I want to do would show me anything I need to learn. Am I missing any obvious quoting options here? 2nd Edit: With enough karma, I believe I can now post the link to this related question for completeness. 2020-02-16 15:21:21 +0200 received badge ● Scholar (source) 2020-02-16 15:20:48 +0200 commented answer .simplify_rational() accepts no keywords? Perfect, thank you! The nomenclature clash confused me.. Indeed, I can confirm a,b=var('a,b'); m=matrix(SR,2,[[(a*b-a)/a,0],[0,1]]).apply_map(lambda z: z.simplify_rational(algorithm='simple')); m returns the same output you displayed (i.e. what was expected). 2020-02-15 20:23:20 +0200 asked a question .simplify_rational() accepts no keywords? I have a symbolic matrix whose entries I would like to simplify for display. Minimal working example (in the sage REPL):  a,b=var('a,b'); m=matrix(SR,2,[[(a*b-a)/a,0],[0,1]]).simplify_rational()  works fine and upon calling m produces [b - 1 0] [ 0 1]  as expected. On the other hand, running  a,b=var('a,b'); m=matrix(SR,2,[[(a*b-a)/a,0],[0,1]]).simplify_rational(algorithm='simple')  as per the documentation produces TypeError Traceback (most recent call last) in () ----> 1 a,b=var('a,b'); m=matrix(SR,Integer(2),[[(a*b-a)/a,Integer(0)],[Integer(0),Integer(1)]]).simplify_rational(algorithm='simple') TypeError: simplify_rational() takes no keyword argument If I apply the method to a single expression it works fine:  ((a*b-a)/a).simplify_rational(algorithm='simple')  gives back b-1.