Post Reply 
Equation or not?
03-01-2017, 12:23 AM
Post: #10
RE: Equation or not?
(02-28-2017 10:32 PM)Arno K Wrote:  Better late than never, I thought there must be another way to get that done using the cas:
PHP Code:
EXPORT findeq2()
BEGIN
local j
,m;

L0:={"x+y=1","2x+2y<2","3x+3y<=3","4x+4y≤4","5x+5y>5","6x+6y>=6","7x+7y≥7","8x+8y<>8","9x+9y≠9"};
m:=size(L0);
for 
j from 1 to m do
L0(j):=CAS.expr(L0(j));
//use L9(j):= CAS.expr(L0(j)) to see the results and below here L9(j), too
IF (CAS.part(L0(j),0) == "=="
THEN return j
END;
end;
END
Notice, only 1 loop which is exited when the equal sign, transformed to == by the CAS-call, is found. I think that must be faster but cannot reproduce that timing procedure as TEVAL(findeq2()) returns 0.
Here some other "inconsistence" of the cas is found: the last 2 members of the list are transformed to 1 even as the cas does not know anything about x and y and the other inequalities are turned (I dare writing that) from left to right.
Arno

findeq2() seems to exit before it scans the entire list. If there is more than one equation, it only returns the first equation.

Also, getEq() and findeq2() do not return the same results in CAS view.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Equation or not? - DrD - 02-24-2017, 02:50 PM
RE: Equation or not? - Han - 02-24-2017, 03:59 PM
RE: Equation or not? - DrD - 02-24-2017, 04:22 PM
RE: Equation or not? - Han - 02-24-2017, 04:37 PM
RE: Equation or not? - Didier Lachieze - 02-24-2017, 08:02 PM
RE: Equation or not? - EdDereDdE - 02-24-2017, 11:34 PM
RE: Equation or not? - Didier Lachieze - 02-25-2017, 09:31 AM
RE: Equation or not? - DrD - 02-25-2017, 11:03 AM
RE: Equation or not? - Arno K - 02-28-2017, 10:32 PM
RE: Equation or not? - Han - 03-01-2017 12:23 AM
RE: Equation or not? - Arno K - 03-01-2017, 08:01 AM
RE: Equation or not? - Han - 03-01-2017, 04:04 PM
RE: Equation or not? - Arno K - 03-01-2017, 07:15 PM
RE: Equation or not? - Han - 03-01-2017, 07:22 PM
RE: Equation or not? - parisse - 03-02-2017, 07:35 AM
RE: Equation or not? - DrD - 03-02-2017, 12:31 PM



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