(Comp.sys.hp48) Item: 396 by detlef@mwhh.hanse.de Author: [Romain Desplats] Subj: Fraction library Date: Mon Dec 16 1991 Hi. I post this article for a friend of mine who has no news access. Please reply to him, not to me, if there are any questions/comments about the software. Bye, 8-),Detlef ----------------------------------------------------------------------------- FRACTION LIBRARY - This is a new "Frac" lib written originally in RPL then converted into ML routines. - This version is quick and small (in terms of memory). - I am not going to describe the advantages of ML versus RPL anymore. Let's look at the contents of this library. RX : Takes any numbers, list, algebraic, array of numbers and the program you want to apply to that object. eg. : 2:[[.1 .2]] 1:<<->Q>> T:.25_ms output {{1/10 1/5}} T:'1/4'*1_ms Note that arrays would be converted into lists if you didn't have reals or complex anymore. EC : Works with list to fully expand and fully collect. (Never gets stuck with the fully expand) PGCD : Called by Sã 12 : { 2 2 3 } Sã : Gets you : a/b square root c/d as 1/3 square root 2/3 from a number but also tries to get pi or 1/pi as a fraction. [ [1 .866 0] { {1 û3/2 0} [.866 1 0] {û3/2 1 0} [0 0 1] ] {0 1 0} } 90degre:1.5707_rad 90degre:pi/2*1_rad Note : this works for numbers (xl<1/308) because of pi. FR : Return one single fraction u+inv(A)/cosx/sinx/3 = ... works with lists try something like this: { { INV(x) } A+A/B } LX : Then there is the LX program which works about the same way with lists. Apply a program to all arguments of a list : eg. : {x { x2 } cosx} << / 2 >> RN : Tries to cancel machine rounding errors (it works as RX) IN {-0. 99999 [1.23456 1.20001]} OUT {-0.1 [1.23456 1.2]} have fun and e-mail me for any comments at dehon@platon.greco-prog.fr Romain Desplats