solve ( X, Y -> ... )

Messages in english

Modérateur : xcasadmin

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

solve ( X, Y -> ... )

Message par compsystems » mer. avr. 11, 2018 1:18 pm

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

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

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

Message par parisse » mer. avr. 11, 2018 4:04 pm

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.

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

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

Message par compsystems » mer. avr. 11, 2018 9:02 pm

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)

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

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

Message par parisse » jeu. avr. 12, 2018 5:55 am

It returns [] here.

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

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

Message par compsystems » jeu. avr. 12, 2018 1:17 pm

not on xcas 64 bits =(

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

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

Message par parisse » jeu. avr. 12, 2018 1:24 pm

I checked on win64, mac 64, linux 64.

Répondre