Ask Your Question
0

Where should I put a user defined function?

asked 2013-03-16 01:22:58 +0100

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 08:58:53 +0100

ndomes gravatar image

updated 2013-03-16 09:02:37 +0100

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-20 04:01:51 +0100 )edit

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

Kushan.skm gravatar imageKushan.skm ( 2013-03-20 04:07:30 +0100 )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-16 01:22:58 +0100

Seen: 604 times

Last updated: Mar 16 '13