07-04-2016, 01:18 AM
Hello, the part function works fine, but there is a problem. If the expression is a sum of n terms (a+b+c+d+e+f+.... n), returns the number of terms, that make within a program, the expression parser will be dificultier
part( a + b + c + d + e + f +.... n) returns n
the TI68k calculators return in a group of two terms
when nested part (hp-prime), the sums expressions are difficult to control.
Is possible to reprogram the PART function that groups of two terms in a sum? as the ti68k
hp-prime
part( quote( 1/1 + -1/2 + 1/3 + -1/4 + 1/5 + -1/6 + 1/7 + -1/8 + 1/9 + -1/10 ) )
RETURNS 10
part( quote( 1/1 + -1/2 + 1/3 + -1/4 + 1/5 + -1/6 + 1/7 + -1/8 + 1/9 + -1/10 ), 2 )
RETURNS -1/2
TI89
part( quote( 1/1 + -1/2 + 1/3 + -1/4 + 1/5 + -1/6 + 1/7 + -1/8 + 1/9 + -1/10 ) ) =>
part(quote( (1/1) + (-1/2 + 1/3 + -1/4 + 1/5 + -1/6 + 1/7 + -1/8 + 1/9 + -1/10) ))
RETURNS 2
part( quote( 1/1 + -1/2 + 1/3 + -1/4 + 1/5 + -1/6 + 1/7 + -1/8 + 1/9 + -1/10 ), 1 )
RETURNS 1/1
part( quote( 1/1 + -1/2 + 1/3 + -1/4 + 1/5 + -1/6 + 1/7 + -1/8 + 1/9 + -1/10 ) , 2 )
RETURNS (-1/2 + 1/3 + -1/4 + 1/5 + -1/6 + 1/7 + -1/8 + 1/9 + -1/10)
Thanks
part( a + b + c + d + e + f +.... n) returns n
the TI68k calculators return in a group of two terms
PHP Code:
part( a + b + c + d + e + f +.... n) => part( (a) +(b+c+d+e+f+.... n) ) returns 2
part( a + b + c + d + e + f +.... n, 1 ) => part( (a) +(b+c+d+e+f+.... n), 1 ) returns (a)
part( a + b + c + d + e + f +.... n, 2 ) => part( (a) +(b+c+d+e+f+.... n), 2 ) returns (b+c+d+e+f+.... n)
Is possible to reprogram the PART function that groups of two terms in a sum? as the ti68k
hp-prime
part( quote( 1/1 + -1/2 + 1/3 + -1/4 + 1/5 + -1/6 + 1/7 + -1/8 + 1/9 + -1/10 ) )
RETURNS 10
part( quote( 1/1 + -1/2 + 1/3 + -1/4 + 1/5 + -1/6 + 1/7 + -1/8 + 1/9 + -1/10 ), 2 )
RETURNS -1/2
TI89
part( quote( 1/1 + -1/2 + 1/3 + -1/4 + 1/5 + -1/6 + 1/7 + -1/8 + 1/9 + -1/10 ) ) =>
part(quote( (1/1) + (-1/2 + 1/3 + -1/4 + 1/5 + -1/6 + 1/7 + -1/8 + 1/9 + -1/10) ))
RETURNS 2
part( quote( 1/1 + -1/2 + 1/3 + -1/4 + 1/5 + -1/6 + 1/7 + -1/8 + 1/9 + -1/10 ), 1 )
RETURNS 1/1
part( quote( 1/1 + -1/2 + 1/3 + -1/4 + 1/5 + -1/6 + 1/7 + -1/8 + 1/9 + -1/10 ) , 2 )
RETURNS (-1/2 + 1/3 + -1/4 + 1/5 + -1/6 + 1/7 + -1/8 + 1/9 + -1/10)
Thanks