### Related

a = 10;

b = rat(a + 1);

Calculate

##### rat-remainder-resultant

A:u^4+p*u+q;

B:v^3+a*v+b-u*(v^2+c*...

C:rat(resultant(A,B,u...

Calculate

##### rat

o: rat(c[i]/a,c[i]) /...

o[active]: o*a /* act...

o[inactive]: o*(1-a) ...

Calculate

##### rat

A:((x - 2*y)^4/(x^2 -...

rat (A, y, a, x);

rat(A, a,x,y);

Calculate

##### rat

n: 1;

rat((x-x^n)/(1-x)-n*x...

Calculate

##### rat

trsf: y=x^2-A*x-B-A/x...

eq: a*y^2+b*y+c;

eq1: rat(x^4*subs(trs...

Calculate

##### rat-rootscontract-sqrt

r:(4/sqrt(10+2*sqrt(5...

c:rat(r);

rootscontract(c);

Calculate

n1: a;

n2: b;

n3: (n1 + n2)/2;

Calculate

##### rat

n: 100000000;

k: 3;

rat((k+1)*n^k-n^(k+1)...

Calculate

eq1:x*2 + x;

rat(eq1);

Calculate

### rat

Run Example
```(%i1)rat(0.1234);

rat: replaced 0.1234 by 617/5000 = 0.1234
617
(%o1)/R/                             ----
5000
(%i2) rat(0.12345);

rat: replaced 0.12345 by 2469/20000 = 0.12345
2469
(%o2)/R/                             -----
20000
(%i3) rat(0.12345);

rat: replaced 0.12345 by 2469/20000 = 0.12345
2469
(%o3)/R/                             -----
20000
(%i4) mod(12345, 1000)/100000, numer;
(%o4)                               0.00345
(%i5) lastdigits(fnum, lastn):=block([m:10*fnum, ans, n:lastn], /* it doesn't help when lastn is bigger than the total digits in fnum it returns the whole digits in fnum anyway without erroring! and fnum=%pi stuff works only upto 8 digits cause num(rat(fnum)) has somuch only! */ratprint:false, k:rat(fnum), ans:mod(m, (10^-n))/(mod(m, 10)*denom(k)), return(float(ans)));
(%o5) lastdigits(fnum, lastn) := block([m : 10 fnum, ans, n : lastn],
- n
mod(m, 10   )
ratprint : false, k : rat(fnum), ans : -------------------, return(float(ans)))
mod(m, 10) denom(k)
(%i6) lastdigits(0.12345, 3);
(%o6)                        2.0251113811259619E-8
(%i7) ```
Run Example
```simp:false;
(%o1)                                false
(%o2)                                false
(%i3) 1/a, simp:false;
1
(%o3)                                  -
a
(%i4) 1/b, simp:false;
1
(%o4)                                  -
b
(%i5) 1/(a*b), simp:false;
1
(%o5)                                 ---
a b
(%i6) tellsimp(1/(a*b), ((1/a)*(1/b)));
(%o6)                         [/rule1, simpquot]
(%i7) 1/(a*b);
1
(%o7)                                 ---
a b
(%i8) disprule(all);
1     1  1
(%t8)                        /rule1 : --- -> - (-)
a b    a  b

(%o8)                                [%t8]
(%i9) 1/(a*b);
1
(%o9)                                 ---
a b
(%i10) properties("*");
(%o10)              [mirror symmetry, nary, rule, operator]
(%i11) rat(1/(a*b));
1
(%o11)/R/                             ---
a b
(%i12) map('ratsimp, 1/(a*b));
1
(%o12)                                ---
a b
(%i13) grind(1/(a*b));

1/(a*b)\$
(%o13)                               done
(%i14) partfrac(1/(a*b), a);
1  - 1
(%o14)                            + (- a   )
b
(%i15) a^-1;
- 1
(%o15)                               a
(%i16) ```
Run Example
```rat(+ 0.76895553987651);

rat: replaced 0.76895553987651 by 4513/5869 = 0.76895552905095
4513
(%o1)/R/                             ----
5869
(%i2) ```

Help for Rat