Writing a program to define a user key assignment works in CAS for me, but does not seem to work in RPN/Home mode. If I write:
KEY K_Sq(A,B,C)
BEGIN
RETURN {(-B+(B*B-4*A*C)^0.5)/(2*A),(-B-(B*B-4*A*C)^0.5)/(2*A)};
END;
the program works as expected in CAS, but putting 3 numbers on the stack in Home/RPN and doing 1U +/- does not run the app but just negates the level 1 item.
Ideas? Or is this a limitation of RPN mode?
Thanks for the discussion and comments.
K_Sq assigns the x2 key, not +/-.
Indeed. The best way to make sure you did the right key is to use the little "Create User Key" helper which is found in the "menu" button while in the editor. [MENU][4] "Press any key..." and then press the one you want.
TW
Sorry, I knew that. It doesn't work on either key. I tried two different keys and both had the same problem. I just posted the wrong copy of the code.
Still have the problem (on both keys :)), any ideas?
Bruce
Would someone try it and see if it works on your?
Edited: 12 Oct 2013, 5:11 p.m.
I tried to do a similar code and can't get it to work in either RPN or Home Mode.
However, I can call a separate program with user keys.
EXPORT QUAD(A,B,C)
BEGIN
RETURN {0.5*(-B+sqrt(B^2-4*A*C))/A,
0.5*(-B-sqrt(B^2-4*A*C))/A};
END;
In a program file with user keys:
KEY K_Sq()
BEGIN
RETURN "QUAD()";
END;
In RPN, press Shift + Help (User), x^2. Run QUAD(3) as QUAD uses 3 arguments.
That works for me with the following caveats:
-- I can't use the K_Neg key, it only works on K_Sq (maybe others)
-- Don't know why I can't put the app in the K_Neg code, but doesn't work, you're correct
-- What do you *name* the program?
-- Do you have to Run the K_... program to install it?
Bruce
Edited: 13 Oct 2013, 5:47 p.m.
hello,
a user key assignement can not take input parameters...
your function declaration should read:
key K_Sq() begin
...
end;
cyrille
Thanks. Any idea why this can't be assigned to the K_Neg key?