Page 1 sur 1

### Idea: ans cmd with a second argument

Publié : dim. avr. 23, 2017 9:26 pm
Hello, to make the script of steps an easier to understand I propose that the ans command can accept an optional second argument, extract the x element from the previous list

ans(row pos)(element) -> ans(row pos, list element)

current: with ans(arg1)

Code : Tout sélectionner

``````x^2 = 2*x + 3 returns x^2=(2*x+3)
ans(-1) - (2*x + 3) returns x^2-2*x-3=0
factor(ans(-1)) returns (x-3)*(x+1)=0
[ part(left(ans(-1)),1)=0, part(left(ans(-1)),2)=0 ] returns [x-3=0,x+1=0]
[ ans(-1)(1)+3, ans(-1)(2)-1 ] returns [x=3,x=-1]
subst(y=x^2,ans(-1)(1)) returns y=9
subst(y=2*x + 3,ans(-2)(1)) returns y=9
subst(y=2*x + 3,[ans(-3)(1),ans(-1)]) returns 9=9
evalb(ans(-1)) returns 1 (true)``````
with ans(arg1, arg2)

1: x^2 = 2*x + 3 returns x^2=(2*x+3)
2: ans(-1) - (2*x + 3) returns x^2-2*x-3=0
3: factor(ans(-1)) returns (x-3)*(x+1)=0
4: [ part(left(ans(-1)),1)=0, part(left(ans(-1)),2)=0 ] returns [x-3=0,x+1=0]
5: [ ans(-1,1)+3, ans(-1,2)-1 ] returns [x=3,x=-1]
6: subst(y=x^2,ans(-1,1)) returns y=9
7: subst(y=2*x + 3,ans(-2,1)) returns y=9
8: subst(y=2*x + 3,[ans(-3,1),ans(-1)]) returns 9=9
9: evalb(ans(-1)) returns 1 (true)