PART function (TI89, HPPRIME) for HP48/49/50
|
06-08-2016, 01:40 AM
(This post was last modified: 03-02-2018 01:39 PM by compsystems.)
Post: #1
|
|||
|
|||
PART function (TI89, HPPRIME) for HP48/49/50
sorry for my bad English
Hi I have managed create the same PART function (TI89, HPPRIME) for HP48/49/50 calculators, this function to extract each part of an expression, very useful to analyze the algebraic expression, PART function SOURCE CODE: used as main function obj-> PHP Code: « 0 0 { } -> EXPRESSION XPART NPARTS OPERATOR OBJECTS Syntax: part(Expr, Integer) Returns the nth sub expression of an expression. If the second argument is empty (-1 for hp48/49/50), returns the number of parts. If the second argument is ZERO, returns the operator if any, otherwise returns the same expression as string Examples: TI89/TIVOYAGE200PLT AND HPPRIME part(sin(x)+cos(y)) → 2 // two parts sin(x) & cos(y) part(sin(x)+cos(y),1) → sin(x) // first part part(sin(x)+cos(y),2) → cos(y) // second part part(sin(x)+cos(y),3) → "nonexistent part in the expression" part(sin(x)+cos(y),0) → "+" // operator between parts part( part(sin(x)+cos(y),1)) → 1 // number of parts of the first part part( part(sin(x)+cos(y),2)) → 1 // number of parts of the second part part( part(sin(x)+cos(y),1),1) → x // firts part of the firts part, sin(x)→ x part( part(sin(x)+cos(y),2),1) → y // firts part of the second part, cos(y)→ y part( part(sin(x)+cos(y),1),0) → "sin" // operator of the firts part, sin(x)→ "sin" part( part(sin(x)+cos(y),2),0) → "cos" // operator of the second part, cos(x)→ "cos" part(sin(x)) → 1 // one part part(sin(x),1) → x // first part part(sin(x),0) → "sin" // operator "sin" part(part(exp(x)*sin(x) + cos(x),1),2) → sin(x) // second part of the first part exp(x)*sin(x) → sin(x) part(part(exp(x)*sin(x) + cos(x),1),0) → "*" // operator of the first part exp(x)*sin(x) → "*" part(part(exp(x)*sin(x) + cos(x),2),0) → "cos" // operator of the second part cos(x)→ "cos" part(part(exp(x)*sin(x) + cos(x),2),1) → "x" part(part(exp(x)*sin(x) + cos(x),1)) → 2 part(part(exp(x)*sin(x) + cos(x),1),1) → exp(x) part(part(part(e^x*sin(x) + cos(x),1),1),1) → x part(part(part(e^x*sin(x) + cos(x),1),1),0) → "exp" special cases part(-X) → 1 // one parts part(-X,1) → 1 // firts part, X part(-X,0) → 1 // operator "-" part(X1) → 0 // No parts part(X1,0) → "X1" part(-1) → 0 // No parts part(-X,0) → 1 // "-1" -------------- hp48/49/50 SERIES 'sin(x)+cos(x))' -1 → 2 // 2 parts 'sin(x)+cos(x)' 0 → "+" // operator 'sin(x)+cos(x)' 1 → 'sin(x)' // part1 'sin(x)+cos(x)' 2 → 'cos(x)' // part2 'sin(x)+cos(x)' 3 → "nonexistent part in the expression" application of the PART function TI89 Code PHP Code: difstep(f,x) hpprime example One way to make a Derivative is through tables rather by a selection of cases, analyzing the parts of the expression PHP Code: // version 0.2 Jun 6 2016 by COMPSYSTEMS COPYLEFT inv(©) Examples CASE 1: diff_table(x,x) -> 1 CASE 2: diff_table(x,y) -> 0 diff_table(y,x) -> 0 CASE 3: diff_table(i,x) -> 0 diff_table(√(-1),x) -> 0 diff_table(5,x) -> 0 diff_table(PI,x) -> 0 diff_table(-1,x) -> 0 CASE 4: diff_table(-x,x) -> -1 CASE 5: diff_table(-3*x,x) -> -3 diff_table(3*x,x) -> 3 diff_table(+3*x,x) -> 3 CASE 6: diff_table(abs(x),x) -> sign(x) CASE 7: diff_table(abs(-x),x) -> sign(x) CASE 8: diff_table(ln(x),x) -> 1/x CASE 9: diff_table(ln(-x),x) -> 1/x CASE 10: diff_table(sin(x),x) -> cos(x) CASE 11: diff_table(sin(-x),x) -> -cos(x) CASE 12: diff_table(cos(x),x) -> -sin(x) CASE 13: diff_table(cos(x),x) -> -sin(x) CASE 14: diff_table(tan(x),x)-> (1/cos(x))^2 = sec(x)^2 CASE 15: diff_table(tan(-x),x)-> -(1/cos(x))^2 = -sec(x)^2 CASE 16: diff_table(asin(x),x) -> 1/√(1-x^2) CASE 17: diff_table(asin(x),x) -> -1/√(1-x^2) CASE 18: diff_table(acos(x),x) -> -1/√(1-x^2) CASE 20: diff_table(atan(x),x) -> 1/(1+x^2) CASE 21: diff_table(atan(-x),x) -> -1/(1+x^2) CASE ...: writing ... |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
PART function (TI89, HPPRIME) for HP48/49/50 - compsystems - 06-08-2016 01:40 AM
RE: PART function (TI89, HPPRIME) for HP48/49/50 - Gilles - 06-08-2016, 04:03 PM
|
User(s) browsing this thread: 1 Guest(s)