Ask Your Question

projection_direction broken for polytopes?

asked 2014-07-05 15:43:45 +0200

smbelcas gravatar image

updated 2014-07-05 23:31:00 +0200

kcrisman gravatar image

Some years back (probably 2 or 3) Marshall very kindly sent me a notebook of polytope commands. In that notebook there were the following:

poly = polytopes.twenty_four_cell()[2,5,11,17])

These last two commands produced different green diagrams... two years ago. Today, they produce identical blue diagrams.

I search "sage projection_direction" and seems to indicate that the projection_direction option is still valid (not deprecated? should work? what's the correct phrasing here?).

Anyone know what's up with that?

edit retag flag offensive close merge delete


Update: now has a fix (and then some!) for this issue. Reviewers needed!

kcrisman gravatar imagekcrisman ( 2014-07-09 14:46:20 +0200 )edit

And has positive review, thanks Andrey.

kcrisman gravatar imagekcrisman ( 2014-07-17 04:48:43 +0200 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2014-07-08 18:25:40 +0200

Volker Braun gravatar image

updated 2014-07-08 18:28:41 +0200

This works for me:

sage: P8.schlegel_projection([2,5,11,17]).show()

The polyhedron show() method does not support a projection_direction optional argument. The reference manual link that you gave points to the internally-used Projection class, not the Polyhedron class which is the user interface.

edit flag offensive delete link more


And they are different, yay! Is it possible that in the past `show` did accept this argument?

kcrisman gravatar imagekcrisman ( 2014-07-08 18:30:44 +0200 )edit

Indeed, the example smbelcas gives is essentially identical to one in the documentation, so at the very least that would have to be updated.

kcrisman gravatar imagekcrisman ( 2014-07-08 18:34:32 +0200 )edit

Well, it's *certain* that 'show' used to take the argument, as it worked when Marshall sent me the code way back when. (And yes, it would be good to update the documentation so that people aren't confused.)

smbelcas gravatar imagesmbelcas ( 2014-07-08 21:44:38 +0200 )edit
Volker Braun gravatar imageVolker Braun ( 2014-07-09 17:38:14 +0200 )edit

answered 2014-07-06 03:41:16 +0200

kcrisman gravatar image

This is a bit weird. (Not the blue, that shouldn't have been green in the first place, though I can confirm that with older Sage versions it is.)

The Schlegel projection stuff is still technically working, or at least something is happening:

sage: from sage.geometry.polyhedron.plot import Projection
sage: P = Projection(poly)
sage: P.schlegel([2,3,5,7]).coordinates_of([1])
[(0.0538250745189, 0.279021759081, 0.729415128204)]
sage: P.schlegel([2,5,11,17]).coordinates_of([1])
[(-0.209018866441, 0.144793545531, 0.852418369476)]

And luckily, there is a workaround.

sage: P.schlegel([2,5,11,17]).show()

sage: P.schlegel([2,3,5,7]).show()  # different!

But why the renderings directly from projection_direction are not different I can't say. To be fair, I don't see any difference in older (green) versions either, but I'm not that into polytopes or their projections myself so it could be inexperience. I'm putting some comments on some possible tickets that might have changed this in the hopes of getting you a better answer than this, though.

edit flag offensive delete link more


Um. When I execute that command, I get AttributeError: 'Polyhedra_ZZ_ppl_with_category.element_class' object has no attribute 'schlegel'

smbelcas gravatar imagesmbelcas ( 2014-07-06 05:22:11 +0200 )edit

?? Can you report exactly which version and OS you see that error on? This works for me both on bleeding-edge as well as a two-year-old copy of Sage.

kcrisman gravatar imagekcrisman ( 2014-07-07 14:43:02 +0200 )edit

Sage 6.2, Mac OS X 10.7.5. Let's be extra clear: I executed P8 = polytopes.n_cube(4) P8.schlegel([2,5,11,17]).show() (Sorry, I don't know how to get carriage returns or boxes in comments.)

smbelcas gravatar imagesmbelcas ( 2014-07-07 23:30:38 +0200 )edit

Okay, that is a different question (note that you did a different polytope than in your original question) and presumably a bug, which I can replicate (see Apparently `P8.schlegel_projection().show()` works but doesn't do anything different than `show()`.

kcrisman gravatar imagekcrisman ( 2014-07-08 15:29:23 +0200 )edit

Wait, how is that a different question? The schlegel command should work for all internally-defined sage polytopes equally well, shouldn't it? Plus, when I do poly = polytopes.twenty_four_cell() poly.schlegel([2,5,11,17]).show() I get AttributeError: 'Polyhedra_QQ_ppl_with_category.element_class' object has no attribute 'schlegel' Maybe this is because you loaded some extra package that I did not load (because I'm just trying to use stuff built in to sage at this point)?

smbelcas gravatar imagesmbelcas ( 2014-07-08 16:23:11 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-07-05 15:43:45 +0200

Seen: 406 times

Last updated: Jul 08 '14