MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Rational[a,b] vs Rational[1,2]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg116630] Re: Rational[a,b] vs Rational[1,2]
  • From: Richard Fateman <fateman at eecs.berkeley.edu>
  • Date: Tue, 22 Feb 2011 04:43:04 -0500 (EST)

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



  • Prev by Date: Re: FinancialData Function Not Working for Property "Members"
  • Next by Date: Re: Delete elements from list..
  • Previous by thread: Rational[a,b] vs Rational[1,2]
  • Next by thread: Re: Rational[a,b] vs Rational[1,2]