Post Reply 
[Help: CAS Code] Comparing answers history view
11-02-2016, 07:56 PM (This post was last modified: 02-10-2018 07:01 PM by compsystems.)
Post: #1
[Help: CAS Code] Comparing answers history view
Example #1:

Steps

Step 1:
root:=√(2.) [enter] 1.41421356237

Step 2:
exact(root) == approx(root) [enter] true

Where:
left(exact(root)) ->1607521/1136689
right(approx(root)) -> 1.41421356237
then
1607521/1136689 == 1.41421356237 -> true

now

Step 3:
approx(root) [enter] 1.41421356237
Step 4:
exact(root) [enter] 1607521/1136689
Step 5:
Ans == [up][up][up] -> (0) false
1607521/1136689 == 1.41421356237 -> 0 // expr 2

Why two different answers?

1607521/1136689 == 1.41421356237 // expr1
1607521/1136689 == 1.41421356237 // expr2

expr1 same expr2 yes
Find all posts by this user
Quote this message in a reply
11-02-2016, 08:01 PM
Post: #2
RE: Comparing expressions
Because they are two different things.

TW

Although I work for HP, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
11-02-2016, 08:31 PM
Post: #3
RE: Comparing expressions
Si quieres comparar 2 datos, puedes crear un función que identifique si es una 'expresión', en caso de serlo lo evaluas, y puedes realizar la comparación.

Viga C | TD | FB
Visit this user's website Find all posts by this user
Quote this message in a reply
11-02-2016, 11:23 PM (This post was last modified: 11-06-2016 04:36 PM by compsystems.)
Post: #4
RE:
(11-02-2016 08:01 PM)Tim Wessman Wrote:  Because they are two different things.
Ok Ans Documentation
A value in Ans is stored internally with the full precision of the calculated result,

(11-02-2016 08:31 PM)Carlos295pz Wrote:  Si quieres comparar 2 datos, puedes crear un función que identifique si es una 'expresión', en caso de serlo lo evaluas, y puedes realizar la comparación.
ok
http://www.hpmuseum.org/forum/thread-7173.html
Find all posts by this user
Quote this message in a reply
11-03-2016, 08:24 PM
Post: #5
RE: [Help: CAS Code] Comparing math expressions
Una modo simple en HOME
PHP Code:
Igual(Dat1,Dat2)
BEGIN
 IFTE
(TYPE(Dat1)=8,EVAL(Dat1)▶Dat1,0);
 
IFTE(TYPE(Dat2)=8,EVAL(Dat2)▶Dat2,0);
 
Dat1=Dat2
END

Funciona para CAS, falta asignarle un nivel de precisión en decimales.

Pruebas:
Igual(0.75, 3/4) -> true
Igual(2, 4/2) -> true

Viga C | TD | FB
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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