Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Is n() the same as N() if not why not

I am trying to use Sage as a simple numerical calculator but sometimes have to fight with more advanced features, things I think are number are not. I starting using n() to fix this up, but in some cases it did not work. Bug big N N() did. Is this the way it is supposed to be ( if so why ). Identical commands ( symbols..... ) except for capitilization seems like a bad idea. Here is the code:

Is n() the same as N() if not why not

xll = 1. / ( pi * ( 2. ^ .5 ) )

xll = 22. * 2

print "xll is of type", type( xll ) print ""

print "Big N next" print N( ll )

print "" print "Little n next" print n( xll )

click to hide/show revision 2
for better formatting, thought stackoverflow had a code icon?

Is n() the same as N() if not why not

I am trying to use Sage as a simple numerical calculator but sometimes have to fight with more advanced features, things I think are number are not. I starting using n() to fix this up, but in some cases it did not work. Bug big N N() did. Is this the way it is supposed to be ( if so why ). Identical commands ( symbols..... ) except for capitilization seems like a bad idea. Here is the code:

# Is n() the same as N() if not why not

not

xll = 1. / ( pi * ( 2. ^ .5 ) )

xll = 22. * 2

2

print "xll is of type", type( xll ) print ""

""

print "Big N next" next" print N( ll )

) print ""

print "" print "Little n next" next" print n( xll )

)

Is n() the same as N() if not why not

I am trying to use Sage as a simple numerical calculator but sometimes have to fight with more advanced features, things I think are number are not. I starting using n() to fix this up, but in some cases it did not work. Bug big N N() did. Is this the way it is supposed to be ( if so why ). Identical commands ( symbols..... ) except for capitilization seems like a bad idea. Here is the code:

# Is n() the same as N() if not why not


xll = 1. / ( pi * ( 2. ^ .5 )   ) 

xll = 22. * 2

print "xll is of type", type( xll )
print ""

print "Big N next" 
print N( ll )

print "" 
print "Little n next" 
print n( xll )

produced output:

xll is of type <type 'sage.rings.real_mpfr.RealNumber'>

Big N next 
0.0000120042175487614

Little N next 
Traceback (click to the left of this block for traceback) ...       
TypeError: 'sage.rings.real_mpfr.RealLiteral' object is not callable