First time here? Check out the FAQ!

Ask Your Question
1

How to import sage library to my python program?

asked 13 years ago

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.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 13 years ago

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()

Preview: (hide)
link

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: 13 years ago

Seen: 1,326 times

Last updated: Oct 14 '11