i found that
>>>sqrt(4.41)
2.10000000

i guess we have no problem with this .

the problem we have is with .is_rational (rational checking function)

so when sqrt(4.41).is_rational is called , we should call

sqrt(nsimplify(4.41,rational=True)).is_rational

which gives True in sympy ...

also sqrt(4.41).is_rational would be more user friendly term than
sqrt(nsimplify(4.41,rational=True)).is_rational

On Sun, Mar 4, 2012 at 10:24 AM, prateek papriwal <papriwalprat...@gmail.com
> wrote:

> so somehow we need to merge nsimplify() method into sqrt() method .
>
> in that case when we call sqrt(4.41)
>
> automatically sqrt(nsimplify(4.41,rational=True)) will be called .
>
>
>
>
> On Sun, Mar 4, 2012 at 10:07 AM, Aaron Meurer <asmeu...@gmail.com> wrote:
>
>> Exactly. This happens automatically for rational numbers, so that if
>> the number is a perfect square, then they will be reduced (indeed, it
>> will reduce any perfect square factors if the number is not too big).
>>  sqrt() of a Float will just give you another Float, so if you want to
>> test that, you have to convert it to a Rational first.  Normally, I
>> would suggest calling Rational on it to do that, but that won't work
>> because of issue http://code.google.com/p/sympy/issues/detail?id=2950.
>>
>> So instead, you should use nsimplify(rational=True), like
>>
>> In [58]: nsimplify(4.41, rational=True)
>> Out[58]:
>> 441
>> ───
>> 100
>>
>> In [59]: sqrt(nsimplify(4.41, rational=True))
>> Out[59]:
>> 21
>> ──
>> 10
>>
>> Aaron Meurer
>>
>> On Sat, Mar 3, 2012 at 9:09 PM, prateek papriwal
>> <papriwalprat...@gmail.com> wrote:
>> > we can do the following thing (talking about square roots)
>> >
>> > For integer inputs, only the square roots of the square numbers are
>> > rationals. So our problem boils down to find if our number is a square
>> > number . in this way sqrt(3) can be checked .
>> > If we have rational numbers as inputs (that is, a number given as the
>> ratio
>> > between two integer numbers), check that both divisor and dividend are
>> > perfect squares. in this way 4.41 can be checked .
>> >
>> > Finally we know that any finite floating point number is a rational
>> number
>> > ..
>> > On Sun, Mar 4, 2012 at 5:05 AM, Aaron Meurer <asmeu...@gmail.com>
>> wrote:
>> >>
>> >> On Sat, Mar 3, 2012 at 12:17 PM, Sergiu Ivanov
>> >> <unlimitedscol...@gmail.com> wrote:
>> >> > On Sat, Mar 3, 2012 at 6:29 PM, prateek papriwal
>> >> > <papriwalprat...@gmail.com> wrote:
>> >> >> yes u were right i had an old version 6.7 , now i have a new version
>> >> >> which
>> >> >> gives "NONE" for
>> >> >>
>> >> >>>>>sqrt(3).is_rational
>> >> >> and
>> >> >>
>> >> >>>>>sqrt(3).is_irrational
>> >> >>
>> >> >> this need to be corrected
>> >> >
>> >> > Yes, this would be highly desired, but, as Aaron has said, there is
>> no
>> >> > simple general way to check the rationality of an expression.
>> >> >
>> >> > Could you please describe what you are trying to achieve?  If you can
>> >> > narrow down your problem sufficiently well, you may be able to devise
>> >> > an ad-hoc way to check the rationality of an expression in your
>> >> > domain.
>> >> >
>> >> > Sergiu
>> >>
>> >> Problems only arise if you have transcendental numbers, or if you have
>> >> symbolic expressions with some assumptions on them.  If you are
>> >> dealing with a non-symbolic algebraic number, it is always possible to
>> >> tell if it's rational or not.  One way is to use minpoly() and see if
>> >> the minimal polynomial is linear or not.  We don't currently do this
>> >> because minpoly() is too slow for non-trivial algebraic numbers (if I
>> >> remember correctly).
>> >>
>> >> Aaron Meurer
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> Groups
>> >> "sympy" group.
>> >> To post to this group, send email to sympy@googlegroups.com.
>> >> To unsubscribe from this group, send email to
>> >> sympy+unsubscr...@googlegroups.com.
>> >> For more options, visit this group at
>> >> http://groups.google.com/group/sympy?hl=en.
>> >>
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "sympy" group.
>> > To post to this group, send email to sympy@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > sympy+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/sympy?hl=en.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sympy" group.
>> To post to this group, send email to sympy@googlegroups.com.
>> To unsubscribe from this group, send email to
>> sympy+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/sympy?hl=en.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com.
To unsubscribe from this group, send email to 
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to