First time here? Check out the FAQ!

Ask Your Question
0

Output Types in Shell

asked 12 years ago

yrogirg gravatar image

updated 12 years ago

Does sage use essentially typeless language? If no, is there a way to output type in the shell, preferably always along with the answer. Just like Axiom does it:

(1) -> x := series 'x

   (1)  x
                  Type: UnivariatePuiseuxSeries(Expression(Integer),x,0)
(2) -> (sin x) / (cos x)

            1  3    2  5    17  7    62   9    1382   11      12
   (2)  x + - x  + -- x  + --- x  + ---- x  + ------ x   + O(x  )
            3      15      315      2835      155925
                  Type: UnivariatePuiseuxSeries(Expression(Integer),x,0)

Fore some reason unicode doesn't display here.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
3

answered 12 years ago

You can use the type command:

sage: a = Sq(3)
sage: type(a)
<class 'sage.algebras.steenrod.steenrod_algebra.SteenrodAlgebra_mod_two_with_category.element_class'>

sage: DE = y.diff(x,x) + y == 0
sage: z = desolve(DE, y)
sage: type(z)
<type 'sage.symbolic.expression.Expression'>
Preview: (hide)
link

Comments

Incidentally, this is a Python thing, not just Sage.

kcrisman gravatar imagekcrisman ( 12 years ago )

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

Seen: 774 times

Last updated: May 29 '12