Ask Your Question
0

Running Sage in command-line

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

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

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

[liuzw@ln01 ~]$ sage -c 'print(1+1)'
2
[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
3

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

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...
False
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: 2019-12-19 07:43:28 +0100

Seen: 367 times

Last updated: Dec 19 '19