Ask Your Question

mf's profile - activity

2022-04-26 16:06:16 +0200 received badge  Notable Question (source)
2022-04-26 16:06:16 +0200 received badge  Popular Question (source)
2021-04-13 04:20:22 +0200 received badge  Famous Question (source)
2020-11-10 10:32:18 +0200 received badge  Famous Question (source)
2020-07-12 23:07:32 +0200 received badge  Notable Question (source)
2020-04-23 09:53:26 +0200 received badge  Famous Question (source)
2019-11-25 22:39:13 +0200 received badge  Famous Question (source)
2019-10-26 13:25:38 +0200 received badge  Nice Question (source)
2019-10-26 13:21:28 +0200 received badge  Good Question (source)
2018-06-26 17:30:17 +0200 received badge  Popular Question (source)
2017-10-09 14:07:10 +0200 received badge  Notable Question (source)
2017-09-23 22:12:20 +0200 received badge  Notable Question (source)
2017-07-07 22:16:16 +0200 received badge  Notable Question (source)
2017-04-20 07:15:56 +0200 received badge  Popular Question (source)
2017-01-03 23:32:50 +0200 commented question get short name for QQ, RDF, AA etc

thanks for the explanation!

2017-01-03 21:15:23 +0200 asked a question get short name for QQ, RDF, AA etc

I wonder whether there is a way to get back the short name of the function of the various rings and fields like QQ, RDF, AA, RLF, RR, etc. as a string.

For example

sage: a=QQ
sage: str(a)
'Rational Field'

But I am looking for something like:

sage: function_I_want(a)
'QQ'

I guess I could predefine a dictionary like this:

shortnames={eval(name):name for name in ['QQ', 'RDF', 'AA', 'RLF', 'RR']}

and then have a function

def function_I_want(a):
    return shortnames[a]

But this seems a bit clumsy. Is there a better way to do this; or is there somewhere in the sage code such a dictionary already defined?

The reason I am thinking about this is the following tiny bug: https://trac.sagemath.org/ticket/22132

2016-12-09 13:28:53 +0200 received badge  Nice Question (source)
2016-12-09 12:00:48 +0200 asked a question Issues with .99999999999...

Here is a result that I found surprising and I don't understand completely what corercian is causing it.

sage: int(.9999999999999999)
0
sage: int(.99999999999999999)
1
sage: int(0.99999999999999999)
0
sage: int(0.9999999999999999)
0
sage: int(0.999999999999999999999999999999999)
0

What is going on?

More to play with:

sage: a=.99999999999999999; b=0.999999999999999999999999999999999
sage: a<b
False
sage: int(a)<int(b)
False

and

sage: a=.999999999999999990; b=0.999999999999999999999999999999999
sage: int(a)<int(b)
False
sage: a<b
True
sage: a=.999999999999999997
sage: a<b
False
sage: a=.999999999999999996
sage: a<b
True
2016-08-17 17:09:56 +0200 received badge  Popular Question (source)
2016-08-16 21:42:58 +0200 received badge  Notable Question (source)
2016-08-16 21:42:58 +0200 received badge  Popular Question (source)
2016-07-16 21:06:11 +0200 received badge  Popular Question (source)
2016-05-10 23:50:24 +0200 received badge  Notable Question (source)
2016-05-10 19:57:39 +0200 received badge  Popular Question (source)
2016-05-10 19:57:39 +0200 received badge  Notable Question (source)
2015-12-30 02:57:02 +0200 received badge  Popular Question (source)
2015-03-27 04:12:32 +0200 marked best answer Combinatorial data for planar graph

I am trying to get sage working with planar embedded graphs. The answer here was quite helpful, but I have a few more questions.

  1. Is there a way to get represention of the embedding into sage? The graph6 format forgets the embedding (see the documentation of plantri).

  2. Can I presribe the outer face of my embedding when I plot a Graph in sage using .plot(layout='planar')?

Ideally, for an embedded graph, I would like to obtain something like an oriented outer face and a list of oriented inner faces. For example for the graph below I want to have

inner_faces=[[2,0,3],[0,1,4,5,3],[1,2,4],[2,3,5],[2,5,4]]
outer_face=[0,1,2]

graph

2015-03-27 04:12:31 +0200 marked best answer access to printed output

Maybe relating to this question: Access output from previous cells

Assume I defined a function that takes a string and prints it:

def f(s):
    print s
    return

Now the output of the cell

f('hello')

is just the word 'hello'.

Is there any way to access this output, for example read it as a variable?

The problem occurs when I have a MixedIntegerLinearProgram p and access it with p.show(). I then want to do something with the printed output of this command, e.g. write it to a file.

2015-03-27 04:12:20 +0200 marked best answer frozenset error when plotting polytopes: bug?

I am having trouble understanding an error I get, when i try the following:

ngon=polytopes.regular_polygon(122).dilation(18.1)
ngon.plot()

It says: KeyError: (frozenset([60]), frozenset([60])) The following works:

ngon=polytopes.regular_polygon(122).dilation(17.9)
ngon.plot()

What is going on? Is this a bug?

2014-07-04 15:10:35 +0200 received badge  Nice Question (source)
2014-07-03 16:44:54 +0200 received badge  Nice Question (source)
2014-07-03 14:20:21 +0200 marked best answer newton's method for multiple variables / arbitrary precision

I am trying to find a numerical approximation with arbitrary precision to a real solution to a system of multivariate polynomial equations. I start out with an approximation which is somewhat close to solving the system, up to an precision of about 1e-05. (Meaning that the equations that I try to evaluate are not zero, but smaller than 1e-05 for my starting value)

In this question is it recommended to use scipy's fmin_tnc method, which is what I did. This works out very nicely and it quickly gave a new solution which now solves my system with precision 1e-07. In the Scipy doc it is stated that one can set the "epsilon" parameter, but not smaller than machine precision. So it seems like I can't get much more precision with this method?!

Let's say I want to solve my system with precision 1e-250. My questions are:

  1. Can I use the fmin_tnc function to find solutions with higher precision?
  2. I there another way in sage to find real solutions to polynomial systems locally (e.g. with the pari/gp)?
2014-07-03 14:20:21 +0200 received badge  Nice Answer (source)
2014-07-03 11:18:13 +0200 received badge  Self-Learner (source)
2014-07-03 11:18:13 +0200 received badge  Necromancer (source)
2014-07-03 11:18:13 +0200 received badge  Teacher (source)
2014-07-03 11:04:16 +0200 commented answer combinatorial equivalence for Polyhedra / isomorphism for lattices

perfect, thanks! I don't know how i missed this..

2014-07-03 10:20:12 +0200 asked a question combinatorial equivalence for Polyhedra / isomorphism for lattices

Is there an easy way to check whether two polyhedra are combinatorial equivalent, i.e. have have isomorphic face lattices.

this does not work:

Poly1=Polyhedron(vertices=[[0,1],[1,0],[1,1]], base_ring=QQ)
Poly2=Polyhedron(vertices=[[2,0],[2,2],[0,2]], base_ring=QQ)
Poly1.face_lattice()==Poly2.face_lattice()

In this case this would work:

str(Poly1.faces(1))==str(Poly2.faces(1))

but what would be a good way to check this in general?

2014-07-03 10:14:08 +0200 commented question newton's method for multiple variables / arbitrary precision

@vdelecroix: will do as soon as I have enough karma to do so..

2014-07-03 09:07:10 +0200 commented question newton's method for multiple variables / arbitrary precision

@vdelecroix: I figured out how to do this, see my answer below