[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
 compsystems Senior Member Posts: 1,339 Joined: Dec 2013
[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

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

expr1 same expr2 yes
11-02-2016, 08:01 PM
Post: #2
 Tim Wessman Senior Member Posts: 2,284 Joined: Dec 2013
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.
11-02-2016, 08:31 PM
Post: #3
 Carlos295pz Senior Member Posts: 365 Joined: Sep 2015
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
11-02-2016, 11:23 PM (This post was last modified: 11-06-2016 04:36 PM by compsystems.)
Post: #4
 compsystems Senior Member Posts: 1,339 Joined: Dec 2013
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
11-03-2016, 08:24 PM
Post: #5
 Carlos295pz Senior Member Posts: 365 Joined: Sep 2015
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=Dat2END;
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
 « Next Oldest | Next Newest »