Post Reply 
"Unmatch control word" - cause
03-31-2015, 06:13 AM
Post: #1
"Unmatch control word" - cause
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.
Find all posts by this user
Quote this message in a reply
03-31-2015, 09:05 AM
Post: #2
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.

hi,
you can perhaps read this thread about that error, in the Forum...

Salvo

∫aL√0 (@salvomic, IT9CLU) - HP Prime, 50g, 12C :: HP Prime Software Library
Find all posts by this user
Quote this message in a reply
03-31-2015, 10:45 AM
Post: #3
RE: "Unmatch control word" - cause
hi, could you be more Elaborate? I must admit I don't a true answer there. The error is not related to a program. Happens in cas-mode. Interesting fact is that type(2) works. I think I read somewhere something about different behaviour of type() and TYPE() but I cannot find it. The help Screen gives no hint. :-( Should I strictly use type() and not bother with TYPE() - or do you have to vary?
Find all posts by this user
Quote this message in a reply
03-31-2015, 12:34 PM (This post was last modified: 03-31-2015 12:37 PM by salvomic.)
Post: #4
RE: "Unmatch control word" - cause
shortly,
type(EXpr) Returns n in [1..12] that defines the type of the argument, so i.e. type("abc") return DOM_STRING.

TYPE() -you can read in the Help- Returns the type of the object:
0: Real
1: Integer
2: String
3: Complex
4: Matrix
5: Error
6: List
8: Function
9: Unit
14.?: cas object. the fractional part is the cas type

So they have different use.
For the rest, in the post I linked we discussed about "unlatch control word" error, that seem too strange also to me...

Some objects in the Prime are a bit complex, like Matrix that also a list, so in some cases you can get type 4 or type 6, but the context will be determinant every time...

About Type(), please, read also this thread.

∫aL√0 (@salvomic, IT9CLU) - HP Prime, 50g, 12C :: HP Prime Software Library
Find all posts by this user
Quote this message in a reply
03-31-2015, 12:44 PM
Post: #5
RE: "Unmatch control word" - cause
Thank you, Salvomic. I hope that I will be able to deal with the mess. atm I feel like getting more and more confused every day. :-(
Find all posts by this user
Quote this message in a reply
03-31-2015, 01:12 PM
Post: #6
RE: "Unmatch control word" - cause
(03-31-2015 12:44 PM)leprechaun Wrote:  I feel like getting more and more confused every day. :-(

never be confused: the entropy will be soon over us :-)
enjoy your Prime!

Salvo

∫aL√0 (@salvomic, IT9CLU) - HP Prime, 50g, 12C :: HP Prime Software Library
Find all posts by this user
Quote this message in a reply
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 




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