Ask Your Question
0

Where should I put a user defined function?

asked 2013-03-15 19:22:58 -0500

If I wrote a function and want it to be available in sage as a global function (not in a single worksheet), where should I put it ? I mean what directory within sage directory tree ?

Thanks.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2013-03-16 02:58:53 -0500

ndomes gravatar image

updated 2013-03-16 03:02:37 -0500

Provided you have access to the Sage directory tree, you may put it in an appropriate subfolder of

sage-x.y/devel/sage/sage/

for example in

sage-x.y/devel/sage/sage/misc/

Let's say your file is named myfunctions.py, then

from sage.misc.myfunctions import *

will give you access to all functions defined in myfunctions.py

edit flag offensive delete link more

Comments

No module named 'myfunctions'

Kushan.skm gravatar imageKushan.skm ( 2013-03-19 22:01:51 -0500 )edit

Do you think I should modify `sage-x.y/devel/sage/sage/misc/all.py` ?

Kushan.skm gravatar imageKushan.skm ( 2013-03-19 22:07:30 -0500 )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

Stats

Asked: 2013-03-15 19:22:58 -0500

Seen: 78 times

Last updated: Mar 16 '13