On Sun, 21 Jun 2009 at 12:15PM +0300, Jurgis Pralgauskis wrote:
> 
> hello,
> 
> I am constructing simple interact
> http://sagenb.org/home/pub/592/
> 
> in published worksheet, interact seems not to function
> so I give the picture..
> http://ftp.akl.lt/users/jurgis/etc/formule_show_precision--how.png
> 
> I want that
> show(function) would give me just 1 precision digit after comma
> how could I achieve this?

You can use Python's string formatting:
http://docs.python.org/library/stdtypes.html#string-formatting

To get floating-point numbers to display with one decimal point, do
something like this:

sage: '%.2f' % pi
'3.14'
sage: '%.1f' % pi
'3.1'
sage: '%.6f' % pi
'3.141593'

See the Python documentation I linked to above for more details.

Dan

-- 
---  Dan Drake <dr...@kaist.edu>
-----  KAIST Department of Mathematical Sciences
-------  http://mathsci.kaist.ac.kr/~drake

Attachment: signature.asc
Description: Digital signature

Reply via email to