HP Forums

Full Version: [CHALLENGE] using the PART function to display the num and denominator of a fraction
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
1: challenge using the PART function create a program that to display the numerator and denominator of a fraction


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)

[Image: front%2Bdemonstration.jpg]

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
// version 0.1 Jun 5 2016
        LOCAL nparts, operator, part1, part2, part3, num_, dem_;
        // ...
        return {num_, dem_};

can inspire in (program differentiation by tables and with PART FUNCTION):

Reference URL's