Ask Your Question
0

Output Types in Shell

asked 2012-05-29 07:30:57 +0100

yrogirg gravatar image

updated 2012-05-29 07:34:16 +0100

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2012-05-29 11:56:04 +0100

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'>
edit flag offensive delete link more

Comments

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

kcrisman gravatar imagekcrisman ( 2012-05-29 13:16:16 +0100 )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-05-29 07:30:57 +0100

Seen: 654 times

Last updated: May 29 '12