Post Reply 
[CHALLENGE] using the PART function to display the num and denominator of a fraction
06-06-2016, 03:07 AM (This post was last modified: 06-06-2016 12:28 PM by compsystems.)
Post: #1
[CHALLENGE] using the PART function to display the num and denominator of a fraction
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)

[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
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
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)