equal prefix cmds

Messages in english

Modérateur : xcasadmin

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

equal prefix cmds

Message par compsystems » lun. avr. 09, 2018 2:35 pm

Hello BP, why when generating the equation equal(y,x^2) is defined later as y:=x^2, I think this is not very useful, because within the code it is very recurrent to make expressions that remain as they are.

equal2list(equal(x+1,2))*6 the output should be list[ 6*x+1, 6*2 ], and not a sequence 12*(x+1)

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

Re: equal prefix cmds

Message par parisse » mar. avr. 10, 2018 11:10 am

= is sometimes evaled to := for compatibility reason (inside programs).

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

Re: equal prefix cmds

Message par compsystems » mar. avr. 10, 2018 8:40 pm

but in the worksheet, is better not to evaluate to :=

example

1: y=x^2
2: subst(ans(-1),[x=-1,y=1]) returns 1 =( expected 1=1

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

Re: equal prefix cmds

Message par parisse » mer. avr. 11, 2018 6:27 am

Just give a name to your objects (and avoid ans)
eq:=y=x^2; subst(eq,[x=-1,y=1])
= is evaluated like := at top-level because many users from other programming languages forget the :, but this is done only at top-level.

Répondre