Ask Your Question

How to use a software package available for SageMath

asked 2018-10-17 11:21:30 +0200

Matteo gravatar image

updated 2018-10-17 11:22:01 +0200

Hi. I know SageMath is meant for math (so here user should post questions related mainly to math problems with Sage), but I'm testing SageMath capabilities about use/loading of external libraries created by user (c, fortran, etc...), that is like a complete environment able to process other prog languages like C and Fortran (mainly for scientific purposes).

I've found here that SageMath can load and use some external libraries (not only python libraries) to allow user to perform some tasks with them.

For example I'd like to know how to use the Rubik program (a C program) for fun and for testing by using SageMath (specifically SageMathCell). It is listed in position 82 of the list here.

Can you kindly show me a procedure to load/compile/use this library available for SageMath? I'd like to run the compiled code to solve (only for fun) some virtual/random Rubik cubes. The procedure for Rubik library could help me to understand how to run other libraries listed in the link above.


edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2018-10-17 12:29:34 +0200

slelievre gravatar image

updated 2018-10-17 12:30:49 +0200

The reference manual available on the SageMath documentation site has a page about interfaces:

The list there includes an item for Rubik's cube solvers:

See also:

edit flag offensive delete link more


Nice! Thank you @slelievre, so SageMath has several interfaces for a lot of existing libraries!

And if I wanted to modify the source code of Rubik, by downloading the original version it in my cloud service and by modifying some pieces of code inside it, how could I reload it in SageMath (specifically SageMathCell) in order to use my modified code instead of the original one the user finds here?

In other words how could I modify the following sage commands (shown here) to use the modified version of "optimal.c" in my cloud?

from sage.interfaces.rubik import *
C = RubiksCube("R U")

Thank you

Matteo gravatar imageMatteo ( 2018-10-17 12:53:17 +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: 2018-10-17 11:21:30 +0200

Seen: 214 times

Last updated: Oct 17 '18