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
can inspire in (program differentiation by tables and with PART FUNCTION):
http://www.hpmuseum.org/forum/thread-6360.html
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