suggestion: identify defined variables ( in cas )
|
03-27-2014, 02:11 PM
Post: #1
|
|||
|
|||
suggestion: identify defined variables ( in cas )
hi again,
I'd like to excuse myself for the mass of questions I asked during the last days. I try to play with the prime as often as possible. During breaks and in the evening. I hope a lot that this device will be like a helpful friend one day. As opposed to the thing it is up to now. I mean it is hard enough to do re-calculations of known things. I can't even think about unknown or new stuff right now. Being in cas mode I tried something like: solve( { x^2+a/b=0 , b*x=1 } , { a, x } ) results in {[-1/b 1/b]} whereas solve( { x^2+a/b=0 , b*x=1 } , { b, x } ) gives [[]] First I was perplexed but then I looked at the mem-viewer and found a list 'a' defined in cas. I have no idea what was in there nor when I stored it, because when I tried to look at it the prime kept rebooting. After deleting that list solve( { x^2+a/b=0 , b*x=1 } , { b, x } ) results in {[-1/a -a]} What do you guys advise students how to avoid such traps. If you don't know a priori what to expect you easily get fooled by the system I guess. Would it be an option to print defined Variables in capitalized letters? In home and apps things could be similar I guess. I only did calculations in home so no problems there. But having learned that programs are compiled as being in home that troubles me though. cheers |
|||
03-27-2014, 03:15 PM
(This post was last modified: 03-27-2014 03:19 PM by Han.)
Post: #2
|
|||
|
|||
RE: suggestion: identify defined variables ( in cas )
(03-27-2014 02:11 PM)Angus Wrote: hi again, Check its type before you do anything with it. Note that type() -- a CAS command -- is different from TYPE() -- a non-CAS command. If you use type(x) and it returns DOM_IDENT then you have an undefined variable. Otherwise, you will get the actual type of the object stored in x. The only possible scenario when this wouldn't work is if another variable is stored in x (e.g. if you do x:=y; first). So first check if type(x) == DOM_IDENT then double check that x=='x' (in which case x is an actual "empty" variable; i.e. x does not contain another variable name as its value). Graph 3D | QPI | SolveSys |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)