Post Reply 
"Unmatch control word" - cause
03-31-2015, 01:42 PM
Post: #7
RE: "Unmatch control word" - cause
(03-31-2015 06:13 AM)leprechaun Wrote:  I have an expression f1:=x^2 and a function f2(x):=x^2.
type(f1) gives DOM_SYMBOLIC type(f2) gives DOM_FUNC. I agree with that. But TYPE(f1) is 8 and TYPE(f2) returns with an "Error: Unmatch control word". What is the meaning of that Error?
I cannot find anything mentioned with TYPE() in the online help. Even type and TYPE seem to be expected to behave the same.

What firmware are you running? Generally this error is due a reference to a function that does not exist. As an example, suppose you exported two programs: MYPROG1 and MYPROG2. If in MYPROG2, you call MYPROG1, and then later delete MYPROG1, then MYPROG2 has a reference to MYPROG1, which no longer exists.

It appears you are using the upper-case TYPE command in the CAS environment. Here is what I think is happening. When you type: TYPE(f2) in the CAS view, the CAS engine basically says: "Hey, TYPE() is a non-CAS command, but I am aware of what f2 is. So I'll resolve what I can and pass the rest to TYPE()." That is, the CAS basically hands over the expression:

TYPE((x)->x^2)

which is exactly TYPE(f2), but with f2 resolved from variable name to its content. However, this doesn't work since the functional syntax is a CAS construct. You can test this yourself with a much simpler example: STRING(X) in the CAS view doesn't return "X" but instead returns the content of X as a string.

A similar thing happens when in Home view and using CAS commands. If you type:

hessian(2*x^2*y-x*z,[x,y,z])

in the Home view, it will give you a syntax error because it tries to resolve all the inputs before it hands it over to hessian() -- a CAS command.

One of the things you can do to prevent this from happening is to pass arguments as strings. So in Home view, you could do:

hessian("2*x^2*y-x*z","[x,y,z]")

or even

hessian("2*x^2*y-x*z,[x,y,z]")

and it will work just fine. Of course, there are limitations (I believe this is only for using CAS commands in Home view). The CAS on the other hand is generally more robust than the Home environment usually has an equivalent command (e.g. type vs TYPE) so that one can usually get by without having to need "Home" commands.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: "Unmatch control word" - cause - Han - 03-31-2015 01:42 PM



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