On Thu, May 29, 2014 at 8:59 AM, SiL588 . <[email protected]> wrote:
> The output i have is this:
>
> 12.0000000000000
>
> and I didn't want all those zeroes after the point.

Try doing

   int(m)

or floor(m)

William

>
> Il giorno giovedì 29 maggio 2014 17:46:51 UTC+2, Robert Bradshaw ha scritto:
>>
>> What exactly do you mean by "simplify a real number?"
>>
>> On Thu, May 29, 2014 at 8:32 AM, SiL588 . <[email protected]> wrote:
>> > Unfortunately I don't know the rules of Phyton language, i just started
>> > using Sage notebook to do linear algebra computation.
>> > I think I did what you said, I assinged m a value that was the result of
>> > multiplication between real numbers.
>> > So, if a real number have no simplify methods, how can I simplify it?
>> >
>> >
>> >
>> > Il giorno giovedì 29 maggio 2014 16:56:22 UTC+2, Simon King ha scritto:
>> >>
>> >> Hi!
>> >>
>> >> On 2014-05-29, SiL588 . <[email protected]> wrote:
>> >> > Hi, i tried to simplify a number doing this:
>> >> >  m1.simplify()
>> >> > but the output is
>> >> >
>> >> > AttributeError: 'sage.rings.real_mpfr.RealNumber' object has no
>> >> > attribute 'simplify'
>> >> >
>> >> >
>> >> > What does it mean?
>> >> > What did I do wrong? I declared m1 like this:
>> >> > m1 = var('m1')
>> >>
>> >> In order to be able to help, we need code that actually results in the
>> >> error you mention. If one just defines m1 as a symbolic variable, then
>> >> it works (in a trivial way, of course):
>> >>   sage: m1 = var('m1')
>> >>   sage: m1.simplify()
>> >>   m1
>> >>
>> >> But let me guess, based on your using the word "declare": Do you expect
>> >> that m1 will always be a symbolic variable after you did
>> >> "m1=var('m1')"?
>> >> That's not how Python works. In contrast to C, there are no static
>> >> types
>> >> associated with a variable.
>> >>
>> >> So, is it perhaps the case that at some point you did this:
>> >>   sage: m1 = 1324.67
>> >>   sage: m1.simplify()
>> >> ?
>> >> It is then no surprise to get an attribute error, because after
>> >> re-defining
>> >> m1 as 1324.67 it is a real number, and real numbers have no
>> >> simplify method.
>> >>
>> >> Best regards,
>> >> Simon
>> >>
>> >>
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "sage-support" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to [email protected].
>> > To post to this group, send email to [email protected].
>> > Visit this group at http://groups.google.com/group/sage-support.
>> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.



-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to