Post Reply 
[CAS] PART FUNCTION on sum of n terms
07-04-2016, 01:18 AM (This post was last modified: 03-02-2018 01:46 PM by compsystems.)
Post: #1
[CAS] PART FUNCTION on sum of n terms
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

PHP Code:
part+.... n)  => part( (a) +(b+c+d+e+f+.... n) ) returns 2
part
+.... n)  => part( (a) +(b+c+d+e+f+.... n), returns (a)
part+.... n)  => part( (a) +(b+c+d+e+f+.... n), returns (b+c+d+e+f+.... n
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
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
[CAS] PART FUNCTION on sum of n terms - compsystems - 07-04-2016 01:18 AM



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