Ask Your Question
0

Getting help inside Sage

asked 2012-02-11 13:38:50 +0200

Green diod gravatar image

updated 2012-02-11 13:39:11 +0200

Sorry if it's a dumb question, folks.

What are all the ways of getting help inside Sage? I would like some table like this:

item?? | see code
help(item) | see help about item

I ask this question because I only know the ?? and help() ways. But they don't always work: I tried simplify_full?? and help(simplify_full) but ... got errors!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2012-02-11 14:26:55 +0200

DSM gravatar image

updated 2012-02-11 14:27:58 +0200

No, you've basically got it. To look at the docs for some object:

help(some_function)
some_function?
some_function?? # also shows the source code

The reason that help(simplify_full) didn't work was that it isn't an object which is in scope; it's a method, and methods are functions which live inside objects. As you have to type some_object.method() to call them, you need to type

help(Expression.simplify_full)
Expression.simplify_full?
Expression.simplify_full??

where Expression is the class, or if you have an object instance around like x, you could use that:

sage: type(x)
<type 'sage.symbolic.expression.Expression'>
sage: help(x.simplify_full) # or x.simplify_full?, or x.simplify_full??

Does that make sense? The help/?/?? things need access to an object, and it needs to be pretty direct.

[Technical note: help(sin(x)) will give you the help for the Expression class, because sin(x) is evaluated, it's an Expression instance, and so help() shows the docs for that. sin(x)? won't work, because the "?" tries to look to see whether the object before it exists, and there is no object called "sin(x)".]

edit flag offensive delete link more

Comments

Thanks!! I knew it was a method but I didn't know how to access to its help.

Green diod gravatar imageGreen diod ( 2012-02-12 11:44:01 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-02-11 13:38:50 +0200

Seen: 437 times

Last updated: Feb 11 '12