Sponsored links: Algebra eBooks
 

Related

showratvars-sqrt

showratvars(sqrt(x));

Calculate

showratvars

? showratvars;

Calculate

showratvars-sqrt

showratvars(1/sqrt(x));

Calculate

showratvars-sqrt

showratvars(sqrt(x));

Calculate

showratvars

? showratvars;

Calculate

showratvars-sqrt

showratvars(1/sqrt(x));

Calculate

showratvars

Run Example
(%i1)ratprint:false;
(%o1)                                false
(%i2) lastdigits(fnum, lastn):=block([ratprint:false, m: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, ans:mod(m, (10^(-n))), return(float(ans)));
(%o2) lastdigits(fnum, lastn) := block([ratprint : false, m : fnum, ans, 
                                                      - n
         n : lastn], ratprint : false, ans : mod(m, 10   ), return(float(ans)))
(%i3) rat(0.1234);
                                     617
(%o3)/R/                             ----
                                     5000
(%i4) lastdigits(0.12345, 2);
(%o4)                               0.00345
(%i5) lastdigits(%pi, 3);
(%o5)                        5.9265358979310179E-4
(%i6) lastdigits(3.14159, 3);
(%o6)                        5.8999999999986841E-4
(%i7) mod(0.12345678910111213, 1/100), bfloat;
(%o7)                        3.456789101112134b-3
(%i8) ratfac:false;
(%o8)                                false
(%i9) rat(0.12345), ratfac:true, ratsimp:false, simp:false, ratdenomdivide:false;
                                     2469
(%o9)/R/                             -----
                                     20000
(%i10) keepfloat:false;
(%o10)                               false
(%i11) ratexpand(0.12345);
                                     2469
(%o11)                               -----
                                     20000
(%i12) ratdenomdivide:false;
(%o12)                               false
(%i13)  ratsimexpons:false;
(%o13)                               false
(%i14)  factorflag:false;
(%o14)                               false
(%i15) rat(0.12345);
                                     2469
(%o15)/R/                            -----
                                     20000
(%i16) showratvars(0.12345);
(%o16)                                []
(%i17) float(mod(num(rat(0.12345))*mod(12345, 10), 1000)/(mod(12345, 10)*denom(rat(0.12345))));
(%o17)                              0.00345
(%i18) mod(12345, 10);
(%o18)                                 5
(%i19) 
Run Example
ratprint:false;
(%o1)                                false
(%i2) lastdigits(fnum, lastn):=block([ratprint:false, m: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, ans:mod(m, (10^(-n))), return(float(ans)));
(%o2) lastdigits(fnum, lastn) := block([ratprint : false, m : fnum, ans, 
                                                      - n
         n : lastn], ratprint : false, ans : mod(m, 10   ), return(float(ans)))
(%i3) rat(0.1234);
                                     617
(%o3)/R/                             ----
                                     5000
(%i4) lastdigits(0.12345, 2);
(%o4)                               0.00345
(%i5) lastdigits(%pi, 3);
(%o5)                        5.9265358979310179E-4
(%i6) lastdigits(3.14159, 3);
(%o6)                        5.8999999999986841E-4
(%i7) mod(0.12345678910111213, 1/100), bfloat;
(%o7)                        3.456789101112134b-3
(%i8) ratfac:false;
(%o8)                                false
(%i9) rat(0.12345), ratfac:true, ratsimp:false, simp:false, ratdenomdivide:false;
                                     2469
(%o9)/R/                             -----
                                     20000
(%i10) keepfloat:true;
(%o10)                               true
(%i11) ratexpand(0.12345);
(%o11)                              0.12345
(%i12) ratdenomdivide:false;
(%o12)                               false
(%i13)  ratsimexpons:false;
(%o13)                               false
(%i14) rat(0.12345);
(%o14)/R/                           0.12345
(%i15) showratvars(0.12345);
(%o15)                                []
(%i16) float(mod(num(rat(0.12345))*mod(12345, 10), 1000)/(mod(12345, 10)*denom(rat(0.12345))));
(%o16)                              0.12345
(%i17) mod(12345, 10);
(%o17)                                 5
(%i18) 
Run Example
ratprint:false;
(%o1)                                false
(%i2) lastdigits(fnum, lastn):=block([ratprint:false, m: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, ans:mod(m, (10^(-n))), return(float(ans)));
(%o2) lastdigits(fnum, lastn) := block([ratprint : false, m : fnum, ans, 
                                                      - n
         n : lastn], ratprint : false, ans : mod(m, 10   ), return(float(ans)))
(%i3) rat(0.1234);
                                     617
(%o3)/R/                             ----
                                     5000
(%i4) lastdigits(0.12345, 2);
(%o4)                               0.00345
(%i5) lastdigits(%pi, 3);
(%o5)                        5.9265358979310179E-4
(%i6) lastdigits(3.14159, 3);
(%o6)                        5.8999999999986841E-4
(%i7) mod(0.12345678910111213, 1/100), bfloat;
(%o7)                        3.456789101112134b-3
(%i8) ratfac:false;
(%o8)                                false
(%i9) rat(0.12345), ratfac:true, ratsimp:false, simp:false, ratdenomdivide:false;
                                     2469
(%o9)/R/                             -----
                                     20000
(%i10) keepfloat:false;
(%o10)                               false
(%i11) ratexpand(0.12345);
                                     2469
(%o11)                               -----
                                     20000
(%i12) ratdenomdivide:false;
(%o12)                               false
(%i13)  ratsimexpons:false;
(%o13)                               false
(%i14)  factorflag:false;
(%o14)                               false
(%i15) rat(0.12345);
                                     2469
(%o15)/R/                            -----
                                     20000
(%i16) showratvars(0.12345);
(%o16)                                []
(%i17) float(mod(num(rat(0.12345))*mod(12345, 10), 1000)/(mod(12345, 10)*denom(rat(0.12345))));
(%o17)                              0.00345
(%i18) mod(12345, 10);
(%o18)                                 5
(%i19) denom(0.01);
(%o19)                                 1
(%i20) 

Related Help

Help for Showratvars