Ask Your Question
1

number formatting

asked 2011-09-04 08:11:09 +0100

Georg Damm gravatar image

Is it possible to display all numbers >= 10^4 (or <= 10^-4) in scientific notation?

Regards

Georg

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2011-09-04 10:46:57 +0100

niles gravatar image

You could use python's string formatting to print numbers in scientific notation:

sage: n = 215.685
sage: print "my number is %e"%n
my number is 2.156850e+02
sage: print "my number is %E"%n
my number is 2.156850E+02

Is that the kind of thing you're looking for?

edit flag offensive delete link more

Comments

No. I want something like that: sage: x=1.2345678 -> sage: x -> 1.2345678 sage: x = 0.00003 -> sage: x -> 3E-05. Sage print a number x in scientific notation if x>=10^7 or 0 < x <= 10^-7.

Georg Damm gravatar imageGeorg Damm ( 2011-09-04 11:03:04 +0100 )edit

Maybe the ticket http://trac.sagemath.org/sage_trac/ticket/7682 would resolve the issue?

Georg Damm gravatar imageGeorg Damm ( 2011-09-04 11:20:24 +0100 )edit

oh; yes, that ticket might help, but I don't know if conditional formatting is something they're thinking about. If you want to get involved, you could contribute there too :)

niles gravatar imageniles ( 2011-09-04 14:47:40 +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: 2011-09-04 08:11:09 +0100

Seen: 3,534 times

Last updated: Sep 04 '11