I'm just trying to make sure that input is a real number.

On 5/9/07, William Stein <[EMAIL PROTECTED]> wrote:
>
> On 5/9/07, Timothy Clemans <[EMAIL PROTECTED]> wrote:
> >
> > Oh. How do I check if something is an integer, rational, real, or complex?
> >
>
> In general, in mathematics, it can be very hard to determine whether
> or not a number is real, etc. -- many subtle problems can be phrased
> in terms of asking whether or not a number is rational, etc.   Do you
> know how to prove that pi is irrational?  transcendental?  However in
> SAGE in most cases you can use "in", e.g.,
>
> sage: 3 in ZZ
> True
> sage: 3/1 in ZZ
> True
> sage: 2/3 in ZZ
> False
> sage: sqrt(2) in QQ
> False
>
>
>
> > On 5/9/07, William Stein <[EMAIL PROTECTED]> wrote:
> > > is_RealNumber checks that the data type of the input is a RealNumber,
> > > i.e., has parent a real field.   It does not check whether the object
> > > itself has some sort of abstract mathematical meaning as a real
> > > number.
> > >
> > > On 5/9/07, Timothy Clemans <[EMAIL PROTECTED]> wrote:
> > > > {{{
> > > > is_RealNumber(3)
> > > > ///
> > > > False
> > > > }}}
> > > >
> > > > {{{
> > > > is_RealNumber(sqrt(2))
> > > > ///
> > > > False
> > > > }}}
> > > >
> > > > {{{
> > > > is_RealNumber(pi)
> > > > ///
> > > > False
> > > > }}}
> > > >
> > >
> > >
> > > --
> > > William Stein
> > > Associate Professor of Mathematics
> > > University of Washington
> > > http://www.williamstein.org
> > >
> >
> > >
> >
>
>
> --
> William Stein
> Associate Professor of Mathematics
> University of Washington
> http://www.williamstein.org
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to