Post Reply 
Equation or not?
02-24-2017, 03:59 PM (This post was last modified: 02-24-2017 04:13 PM by Han.)
Post: #2
RE: Equation or not?
This program returns the index (in L0) of the formula having only = as the "comparison" operator. You can easily change it to p(0):=L0(j); rather than p(0):=j; Note that we are assuming the strings are validly formed inequalities/equalities.

PHP Code:
export findeq()
begin

local j
,k,n,m,p;

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"};
L1:={"<","<=","≤",">",">=","≥","<>","≠"}; // note the removal of "="

m:=size(L0);
n:=size(L1);
p:={};

for 
j from 1 to m do
  for 
k from 1 to n do
    
// if one of the other comparisons is found, skip to next equation
    
if instring(L0(j),L1(k)) then continue(2); end;
  
end;
  
// now check for = symbol
  
if instring(L0(j),"="then p(0):=jend;
end;

return(
p);

end

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: 2 Guest(s)