Page 1 sur 1

solve ( X, Y -> ... )

Publié : mer. avr. 11, 2018 1:18 pm
par compsystems
Hello BP

In the following sequence the use of the RIGHT command is observed, I think that the SOLVE command should accept the argument of a simple function (X,Y -> ...), in this way the use of right is avoided. the left part of the definition would be the variables, in this way it would also avoid adding the variables of the second argument

Example 1:

1:
V1(X,Y):=X-2*Y=7;
V2(X,Y):= 5*X-3*Y=2;

(X,Y)->X-2*Y=7, (X,Y)->5*X-3*Y=2

2:
solve([V1,V2],[X,Y]);
"Expecting an expression, not a function Error: Bad Argument Value"

3:
solve([right(V1), right(V2) ],[X,Y]);
[[-17/7,-33/7]]

4:
list2exp( solve([right(V1), right(V2) ],[X,Y]), [X,Y]);
X=(-17/7) and Y=(-33/7)

5:
subst( [right(V1), right(V2) ], [X=(-17/7) ,Y=(-33/7)] )
[7=7,2=2]

6:
evalb( subst( [right(V1), right(V2) ], [X=(-17/7) ,Y=(-33/7)] ))

[ true, true ]


Example 2:

1:
F1(X) := X^3-1.1*X^2-65.4*X+229.5
(X)->X^3-1.1*X^2-65.4*X+229.5


2:
solve(F1,X)
" Error: Bad Argument Value"

3:
solve(right(F1),X)
[-9.0,5.0,5.1]

4:
subst(F1,X=-9)
(-9)->0.0

5:
subst(right(F1),X=-9)
0.0

Re: solve ( X, Y -> ... )

Publié : mer. avr. 11, 2018 4:04 pm
par parisse
As explained in the error message, solve expects expressions. If you have a function, apply it to the variable(s) : solve([V1(X,Y),V2(X,Y)],[X,Y]); or define V1 and V2 as expressions, not functions.

Re: solve ( X, Y -> ... )

Publié : mer. avr. 11, 2018 9:02 pm
par compsystems
solve([V1(X,Y),V2(X,Y)],[X,Y]); OK =)

when writing the next entry, xCAS is restarted
solve([Y = (X-7)/2,Y = (5*X-2)/3],Y)

Re: solve ( X, Y -> ... )

Publié : jeu. avr. 12, 2018 5:55 am
par parisse
It returns [] here.

Re: solve ( X, Y -> ... )

Publié : jeu. avr. 12, 2018 1:17 pm
par compsystems
not on xcas 64 bits =(

Re: solve ( X, Y -> ... )

Publié : jeu. avr. 12, 2018 1:24 pm
par parisse
I checked on win64, mac 64, linux 64.