Post Reply 
CAS-> Variable() warning msg?
11-01-2014, 12:48 PM
Post: #10
RE: CAS-> Variable() warning msg?
(10-31-2014 11:04 PM)Han Wrote:  Try this:

restart;
a:=x^2;
x:={1,2,3,4};
a(1);
a(2);
a(3);
a(4);
a(-1);
a(5);

Restart, and restart() are cool! Learned something from that.

True, this example fails; but using variable 'x' is troublesome in the quoted example. If you use a different variable, say 'n', as the independent variable instead, the above works fine. Using 'x' in the defining expression, then using 'x' again as an independent variable, is asking for trouble. The independent 'x' became a pointer to the list 'x', in expression involving x^2. Using 'n' has no particular relationship to 'x^2'. I don't think that counts as a fail in this case.

I'm not really sure that there is a point to all of this, other than I just happened on to the prime's use of a variable to contain a function, returning the function value by containing an independent range within parentheses on it (not an index into it). Sort of a short hand way of using functions, more for the general good than anything.

Usually, when I discover something (new to me) like that, I find limitations I hadn't considered. So I hang back waiting for the recoil! This idea works pretty good, in spite of the cautions about it.

-Dale-
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
CAS-> Variable() warning msg? - DrD - 10-31-2014, 09:36 AM
RE: CAS-> Variable() warning msg? - DrD - 10-31-2014, 01:03 PM
RE: CAS-> Variable() warning msg? - Han - 10-31-2014, 03:42 PM
RE: CAS-> Variable() warning msg? - DrD - 10-31-2014, 04:39 PM
RE: CAS-> Variable() warning msg? - Han - 10-31-2014, 05:00 PM
RE: CAS-> Variable() warning msg? - DrD - 10-31-2014, 05:17 PM
RE: CAS-> Variable() warning msg? - Han - 10-31-2014, 11:04 PM
RE: CAS-> Variable() warning msg? - DrD - 11-01-2014 12:48 PM
RE: CAS-> Variable() warning msg? - Han - 11-01-2014, 01:13 PM
RE: CAS-> Variable() warning msg? - DrD - 11-01-2014, 01:25 PM



User(s) browsing this thread: 1 Guest(s)