Re: Polynomial program Message #10 Posted by Han on 20 Nov 2013, 3:33 p.m., in response to message #1 by Michael Carey
Quote:
I have written a program to automate the process of entering a polynomial. But I am having trouble with the variables, the old variable being used previously problem I think? Here is the code:
EXPORT QPOLY(V)
BEGIN
LOCAL A,Y;
A:=CAS.poly2symb(V);
Y:=CAS.simplify(A);
END;
It gets upset infrequently and evaluates the whole expression to a number. For example QPLOY([1,1,1]) currently gives: 57, where it should give x^2+x+1.
I have tried to clear X, but cannot seem to do so, and there is no x (lower case) in the variable list.
Thank you, Michael Carey
Clearing X will have no effect on this because X is never used in the program or in any of the CAS commands used in the program. Did you mean to write lower case x? That variable, on the other hand, does affect the program. Also, x defined from CAS is different from x created in Home -- yeah, I know... what a mess ;_;
I am willing to bet that there is a variable called 'x' (lower case) whose value is 7. This variable likely appears in the CAS view -- try typing: purge(x) in CAS view.
|