Ask Your Question

Running Sage in command-line

asked 2019-12-19 07:43:28 +0200

updated 2019-12-19 11:11:28 +0200

I know how to run a sage function in command-line:

[liuzw@ln01 ~]$ sage -c 'print(1+1)'
[liuzw@ln01 ~]

I know how to attach a code in command-line:

[liuzw@ln01 ~]$ sage fusion2.spyx
Compiling fusion2.spyx...
[liuzw@ln01 ~]$

But I don't know how to run a sage function after having attached a code:

[liuzw@ln01 ~]$ sage fusion2.spyx -c 'print(1+1)'
Compiling fusion2.spyx...
[liuzw@ln01 ~]$

Of course here print(1+1) is a trivial function to show an easy example.
Usually I need to use a function defined in the file fusion2.spyx.

Question: How to do this last step?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2019-12-19 12:28:04 +0200

rburing gravatar image

Here is a way, based on the example is2pow from the documentation:

$ sage -c 'load("power2.spyx"); print(is2pow(12))'
Compiling ./power2.spyx...
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


Asked: 2019-12-19 07:43:28 +0200

Seen: 291 times

Last updated: Dec 19 '19