Ask Your Question
2

Project defined functions

asked 2017-09-26 00:44:54 +0200

lvnguyen gravatar image

updated 2017-09-27 07:35:13 +0200

eric_g gravatar image

Is it possible to define Project specific functions that all collaborators/students in the project can call as if it were globally defined?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2017-09-26 09:05:17 +0200

eric_g gravatar image

I guess your question is referring to a CoCalc project. Then, it suffices to place the definition of the function in the file .sage/init.sage in the home directory of the project.

You can do this, for instance, by clicking on Filesin the top menu bar, then click on the "eye" button on the top right (just at the left of the Backups button). The subdirectory .sage will then show up in the list; click on it and then click on init.sage to open it. You can enter the code of the function there and save it. As an example, if you type the following two lines in that file:

def f(x):
    return x^2

the function f will be available in any Sage session of the project.

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

1 follower

Stats

Asked: 2017-09-26 00:44:54 +0200

Seen: 355 times

Last updated: Sep 26 '17