((a=b)*-1)|([a = 4,b = 3]) => -1 ?

Messages in english

Modérateur : xcasadmin

compsystems
Messages : 603
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

((a=b)*-1)|([a = 4,b = 3]) => -1 ?

Message par compsystems » sam. mai 11, 2024 11:13 pm

Hello
with autosimplify flag: none

((a=b)*-1 [enter] returns -a=(-b)
((a>b)*-1 [enter] returns (-b)>(-a)

((a=b)*-1)|([a = 4,b = 3]) [enter] returns (-4=-3)
((a>b)*-1)|([a = 4,b = 3]) [enter] returns (true)*-1 => -1 ? // Shouldn't the left side be resolved first?

((a>b)*-1)|([a = 4,b = 3]) => (-b)>(-a)|([a = 4,b = 3]) => -3 >-4 => true

I think the left side should do a low-level evaluation before replacing what the right side indicates.
Dernière modification par compsystems le mar. mai 14, 2024 12:30 am, modifié 1 fois.

compsystems
Messages : 603
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

Re: ((a=b)*-1)|([a = 4,b = 3]) => -1 ?

Message par compsystems » mar. mai 14, 2024 12:28 am

Another possible problem is when an expression is applied in an inequality.

(((x-2)/(x+2))<2)*(x+2) [Enter] ([(6+x)/(2+x),(12+2*x)/(2+x)])>0

=> (x-2) < (2*(x+2))

parisse
Messages : 5878
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: ((a=b)*-1)|([a = 4,b = 3]) => -1 ?

Message par parisse » mar. mai 14, 2024 11:16 am

You should eval the inequation*number before doing substitution.

compsystems
Messages : 603
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

Re: ((a=b)*-1)|([a = 4,b = 3]) => -1 ?

Message par compsystems » mar. mai 14, 2024 9:02 pm

I have noticed that depending on the simplification flag, an assignment is performed.
You can improve the xcas interpreter by adding a flag to the system that allows you to decide whether you want the equal sign to always act as an assignment or not,

Répondre