Re: Rational[a,b] vs Rational[1,2]
- To: mathgroup at smc.vnet.net
- Subject: [mg116655] Re: Rational[a,b] vs Rational[1,2]
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Wed, 23 Feb 2011 05:22:42 -0500 (EST)
That seems reasonable, but like Andrzej, I don't see why anybody would/should type Rational[a,b] if he doesn't know what he's doing. Bobby On Mon, 21 Feb 2011 23:21:07 -0600, Richard Fateman <fateman at eecs.berkeley.edu> wrote: > On 2/21/2011 6:26 PM, DrMajorBob wrote: >> I think Mathematica expects us to create rationals in the usual way... >> by dividing integers. When we do, Mathematica removes common factors >> and can end up with an Integer, a Rational, Indeterminate, or >> ComplexInfinity. >> >> If you try another method... good luck! > A simple solution is to define Rational[a_,b_] := a/b /; > Or[Not[IntegerQ[a],IntegerQ[b]] > > wouldn't you agree? > > RJF > -- DrMajorBob at yahoo.com