First time here? Check out the FAQ!

Ask Your Question
0

Running Sage in command-line

asked 5 years ago

updated 5 years ago

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?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
3

answered 5 years ago

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
Preview: (hide)
link

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: 5 years ago

Seen: 380 times

Last updated: Dec 19 '19