+- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: [CHALLENGE] using the PART function to display the num and denominator of a fraction (/thread-6361.html) [CHALLENGE] using the PART function to display the num and denominator of a fraction - compsystems - 06-06-2016 03:07 AM 1: challenge using the PART function create a program that to display the numerator and denominator of a fraction considerations 1/x interprets the calculator as inv(x) part(1/x) -> 1 one part part(1/x,0) -> "inv" -1/x interprets the calculator as neg(1/x) part((2*x^3/(x^2+1))) -> 3 PARTS being that (2*x^3) /(x^2+1) -> 2* ((x^3) /(x^2+1)) part((2*x^3/(x^2+1)),1) -> 2 part((2*x^3/(x^2+1)),2) -> x^3 part((2*x^3/(x^2+1)),3) -> 1/(x^2+1) I leave the header Code: ```// version 0.1 Jun 5 2016 #cas num_dem(xpr):=     BEGIN         LOCAL nparts, operator, part1, part2, part3, num_, dem_;         print("");         // ...         return {num_, dem_};     END; #end``` can inspire in (program differentiation by tables and with PART FUNCTION): http://www.hpmuseum.org/forum/thread-6360.html