[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
 compsystems Senior Member Posts: 1,380 Joined: Dec 2013
[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( a + b + c + d + e + f +.... n)  => part( (a) +(b+c+d+e+f+.... n) ) returns 2part( 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)
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
 « Next Oldest | Next Newest »

 Messages In This Thread [CAS] PART FUNCTION on sum of n terms - compsystems - 07-04-2016 01:18 AM RE: [CAS] PART FUNCTION on sum of n terms - parisse - 07-04-2016, 11:00 AM RE: [CAS] PART FUNCTION on sum of n terms - compsystems - 07-09-2016, 02:10 AM RE: [CAS] PART FUNCTION on sum of n terms - parisse - 07-09-2016, 08:03 AM RE: [CAS] PART FUNCTION on sum of n terms - Claudio L. - 07-09-2016, 10:13 AM

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