[sage-devel] Rational construction

2007-03-11 Thread Robert Miller

Say I want a function to return a rational, and I have the integers
for numerator and denominator. Right now, I have to call the Rational
constructor twice:

return Rational(self.size())/Rational(n)

It seems natural to have something like
elif isinstance(x, tuple):
..

around line 165 or so in rational.pyx, to allow something like

return Rational(  (self.size()  ,  n)  )

Does anyone mind if I implement this?


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



[sage-devel] Re: Rational construction

2007-03-11 Thread William Stein

On 3/11/07, Robert Miller <[EMAIL PROTECTED]> wrote:
>
> Say I want a function to return a rational, and I have the integers
> for numerator and denominator. Right now, I have to call the Rational
> constructor twice:
>
> return Rational(self.size())/Rational(n)
>
> It seems natural to have something like
> elif isinstance(x, tuple):
> ..
>
> around line 165 or so in rational.pyx, to allow something like
>
> return Rational(  (self.size()  ,  n)  )
>
> Does anyone mind if I implement this?

Yes, please do that.   Alternatively, just do
 Integer(self.size()) / Integer(n)
since a quotient of two integers is *guaranteed* to be a rational.

William

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



[sage-devel] Fwd: I made a good edu app for notebook

2007-03-11 Thread Timothy Clemans

I made a quadratic factoring app that shows all three tables that I
need the kid I tutor to make. It can not deal with negatives right
now. I will work on adding that support. There are some HTML problems
with the app. It is very functional. Any comments would be nice. I
have saved the worksheet on my thumbdrive so it is ok to make more
examples.

http://www.sagenb.com/factorq

It would be nice someday to have an app site that included this so
that a user would not need to type in fq(A,B,C) nor would need
Firefox.

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