Home > documentation, Sage > Is the Sage command line limiting?

Is the Sage command line limiting?

The central issue I want to address in this post is: Does the Sage command line interface, which is text-based, limit what you could do with Sage?

My short answer is, “No”. With careful use and experience, the Sage command line interface can be a powerful tool. Say you want to step through a function to understand how it works. As of Sage 4.6, the Sage command line is the only place where you can interactively step through a calculation, via the function trace(). As another example, say you have a Sage script called

/home/username/myscript.sage

and you want to edit it and load it immediately after each edit. From the command line, do

sage: %edit /home/username/myscript.sage

to load your Sage script, and edit it. After you are done, quit your editor and you should be back at the Sage command line, with your updated script automatically loaded.

Or say you want to interact with your operating system without having to quit Sage. From the Sage command line, do

sage: !sh

and you should be presented with a shell for interacting with your system. When you are done, enter “exit” and you should be back to the Sage command line. From the Sage notebook interface, giving users a shell can open the door to many security issues. The issue becomes clear when you are managing a public Sage notebook server.

Or how do you view the Sage standard documentation from the command line? To view the documentation of function foo(), from the Sage command line do

sage: foo?

To view the source code of function bar(), from the Sage command line do

sage: bar??

To view the Sage tutorial, do

sage: tutorial()

To view the Sage reference manual, do

sage: reference()

How do you find that function you are looking for? Do

sage: search_src("the function name")  # or
sage: search_doc("the function name")  # or
sage: search_def("the function name")
Advertisements
Categories: documentation, Sage Tags: ,
  1. Heikki Arponen
    10 November 2010 at 10:40 am

    I completely disagree. These things may be trivial to those with experience in programming (and say UNIX or LINUX etc.), but I would argue that _most_ scientists (math, physics) don’t have that. Sure, careful study solves everything, but the mathematical formalism was developed to be what it is exactly because of its simplicity and clarity when doing mathematics. Even though a trained eye may be able to understand an expression, it will be much easier to _manipulate_ it in symbolic form since some human input will always be needed. At least there should be a simple function which displays an expression in math symbols (like TraditionalForm in Mathematica or variations).

    Now the SAGE project is of course being developed and followed mostly by the programming language literate, so I would guess most people who will comment here will disagree with me. You should really go ask that question somewhere else (say, physicsforums.com etc.)

  2. 10 November 2010 at 11:23 am

    I would like to point out that exactly none of your points show why the Sage command line interface is not limited compared to the graphical interface – rather, they show why the Sage graphical interface is limited, compared to the command line interface.

    That said, the limitations you expose in the graphical interface are generally ones shared by other CASes’ graphical interfaces. By the way, the ? operator works just fine in the notebook, and in fact gives some rather nice formatted output (though there are some spacing issues which need to be worked out, I think…).

  3. 10 November 2010 at 11:25 am

    On second glance, I see that you might have been saying that a lack of the ? operator was not a limitation that the command line interface had. Well, that is true, I suppose…

  4. 10 November 2010 at 3:36 pm

    Some things you *can* do in the notebook but not the command line: @interact’s, annotate your sessions with jsmath and HTML, easily use Sage without installing it on your computer or logging into another computer.

    Some things you can do on the command line but not the notebook: interactive debugger (%debug), profiling (%prun), the raw_input command (get input from the user).

  5. Eric Remington
    11 November 2010 at 4:53 am

    I have to agree with Heikki in part. The command line is cool for people who love command lines. But I like the idea of Sage and I’m not fluent at any programming language. And I can say it would be really nice if the learning curve weren’t quite so steep. I find myself spending way more time searching for syntax than getting things done. Part of the reason that I like Sage is it does force me to hunt around and I have learned a ton. But I think that the project needs to continue developing (and I think it is) into a more and more user friendly environment. And that is not and will never be the command line. It is useful in its place, but it is far more restrictive to those who are starting out.

  6. Ahmed Fasih
    2 December 2010 at 4:55 pm

    Sorry if this is a dead “thread”. Eric Remington wrote, “I find myself spending way more time searching for syntax than getting things done.” How is this different than any other computer math system? Being a beginner is always lousy; paying for familiarity with sweat and frustration is a better solution than waiting for someone in the Sage/software world to figure out a magic way of decreasing computer math systems’ learning curves. Especially since Sage is rapidly approaching GUI parity with existing systems.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: