Ask Your Question
0

How to import sage library to my python program?

asked 2011-10-14 07:10:38 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

I write python program and must use SAGE to solve problem on my program,but i don't use command load "myprogram.py" on SAGE run program. How to run my program without this way? Thank you.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2011-10-14 07:23:10 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

If you run the program with sage's python (i.e., sage -python myprogram.py), then you can do this:

from sage.all import *

at the top and then use Sage as normal in the program.

Only importing part of Sage is not supported, as many parts of Sage depend on other parts. So import the whole thing in one go.

I think you might be able to also do:

import sage.all

and then use Sage features by prepending things with sage.all.<whatever_sage_function>, like sage.all.factorial()

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2011-10-14 07:10:38 -0500

Seen: 338 times

Last updated: Oct 14 '11