Post Reply 
[CAS] inconsistent evaluation
11-07-2016, 03:00 AM (This post was last modified: 11-07-2016 03:37 AM by compsystems.)
Post: #1
[CAS] inconsistent evaluation
Hello Hp-Prime user and developers

Flags: Simplify none, exact mode off, and cas mode on

run line by line the following script

Quote:c:=1+(-a-b); [enter] returns 1.-a-b
but
c1:=1-a-b; [enter] returns 1.-a-b

c==c1 [enter] returns true

x1:=1/10.;
y1:=1/9.;
x2:=100/8.;
y2:=100/3.;
x3:=100/4.;
y3:=100/9.;
x:=379/70.;
y:=904/63.;
d:=(y2-y3)*(x1-x3)+(x3-x2)*(y1-y3);
na:=(y2-y3)*(x-x3)+(x3-x2)*(y-y3);
nb:=(y3-y1)*(x-x3)+(x1-x3)*(y-y3);
a:=na/d;
b:=nb/d; [enter] ....

c:=1+(-a-b); [enter] returns 0
but
c1:=1-a-b; [enter] returns −1.7763568394*10^−15

Why when evaluate c <> c1? if c is equal to c1
Find all posts by this user
Quote this message in a reply
11-07-2016, 03:31 AM (This post was last modified: 11-07-2016 04:20 AM by compsystems.)
Post: #2
RE: [CAS] inconsistent evaluation
aslo I can not run the following program, I can not find error

PHP Code:
#cas
testP():=
    
begin
        local x1
,y1,x2,y2,x3,y3;
        
local x,y,d;
        
local na,nb,a,b,c,c1;
        
x1:=1/10.;
        
y1:=1/9.;
        
x2:=100/8.;
        
y2:=100/3.;
        
x3:=100/4.;
        
y3:=100/9.;
        
x:=379/70.;
        
y:=904/63.;
        
d:=(y2-y3)*(x1-x3)+(x3-x2)*(y1-y3);
        
na:=(y2-y3)*(x-x3)+(x3-x2)*(y-y3);
        
nb:=(y3-y1)*(x-x3)+(x1-x3)*(y-y3);
        
a:=na/d;
        
b:=nb/d;
        
c:=1+(-a-b);
        
c1:=1-a-b;
        return({ 
cc1 });
    
end;
#end 

Who can run the previous program?
Find all posts by this user
Quote this message in a reply
Post Reply 




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