The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
PROBLEM in function PART, part({x,y^2}) returns → "x"
05-26-2016, 05:10 PM (This post was last modified: 06-07-2016 02:56 AM by compsystems.)
Post: #1
PROBLEM in function PART, part({x,y^2}) returns → "x"
Syntax:
part(Expr, Integer)

Returns the nth sub expression of an expression. If the second argument is empty, returns the number of parts.
If the second argument is ZERO, returns the operator if any, otherwise returns the same expression as string

samples OK

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) → "-" // operator "-"

part(X1) → 0 // No parts
part(X1,0) → "X1"

part(-1) → 0 // No parts OK
part(-X,0) → "-1"

part(-5!) → 0 // No parts OK
part(-5!,0)) → "-120"

--------------

BUG
part(e^x) → 1 // must be 2, e & x, with "^" operator, no consistency with string(e^x) -> "e^x" and not "exp(x)", this generates problems within a program code
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
PROBLEM in function PART, part({x,y^2}) returns → "x" - compsystems - 05-26-2016 05:10 PM
RE - compsystems - 05-26-2016, 05:50 PM
RE: - compsystems - 05-26-2016, 06:00 PM
RE: - compsystems - 06-02-2016, 03:07 AM
RE: - compsystems - 06-06-2016, 01:15 AM
Re: - compsystems - 06-06-2016, 12:21 PM



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