Xcas Syntax / Prime Syntax (in particular computing in Z/pZ)

03082014, 08:04 PM
Post: #1




Xcas Syntax / Prime Syntax (in particular computing in Z/pZ)
(This can be understood as a general question about Xcas <> Prime compatibility.)
In Chapter 2.31 in the Xcas manual I read that I could define an object in Z/pZ as n:=12%13 (for example). However using this syntax on the Prime leads to an error. Later in the manual its said that the Xcas' Maple Mode is different in that "In Maple mode, integers modulo p are represented like usual integers instead of using specific modular integers. To avoid confusion with normal commands, modular commands are written with a capital letter (inert form) and followed by the mod command (see also the next section)." Has the Prime it's own Mode, or is it similiar to the Maple mode? And if the Prime has its own mode, is it documented further anywhere? I tried the following: 12 mod 13. However this also leads to an error. I get a result if I use a uppercase MOD, but does this mean that it uses then the HOME view MOD instead of the CAS view mod? (I feel, everytime I use my Prime, half an hour later I am writing a post to this forum :\ ) 

03092014, 01:26 AM
(This post was last modified: 03092014 01:48 AM by jebem.)
Post: #2




RE: Xcas Syntax / Prime Syntax (in particular computing in Z/pZ)
(03082014 08:04 PM)Stefan Wrote: I tried the following: 12 mod 13. However this also leads to an error. I get a result if I use a uppercase MOD, but does this mean that it uses then the HOME view MOD instead of the CAS view mod? Same question here... We saw similar questions raised here before, concerning the consistency of uppercase/lowercase usage in Home, CAS, and the Catalog entries. There are a few situations related to CAS environment that I am trying to understand (and failing so far): 1) When picking an uppercase function from the Catalog, it is copied to CAS entry area and converted to a lowercase function... that's what is happening here with this "MOD" command. There is no "mod" expression in lowercase listed in the Catalog, as there are no trigonometric functions listed in lowercase  all of them are listed in uppercase (for instance, "SIN", "COS", "TAN", and all of them will be converted to lowercase when displayed in the CAS entry area). 2) Also, when we manually type a function in the CAS entry area, it will be in lowercase as well (that's the default). So far, it looks to be consistent with point (1). 3) Now, after pressing the Enter key, usually the above functions are listed in the history area as uppercase... so it seems that CAS will "digest" these functions in uppercase, after all. The question is: how many? All of them? 4) After that, when we copy one expression from the history area to the entry area, the functions are converted back to lowercase! Again, it looks to be consistent with points (1), (2) and (3). 5) However, due to a unknown cause (at least to me!), some functions, like the "mod" here, are not being converted to uppercase by the system when we press the Enter key... and because the CAS system expect an uppercase expression, the result is a syntax error! In fact, the "MOD" function is NOT converted back to lowercase when copying a expression (where it exists) from the history area to the entry area! 6) As I see it, the system/parser tables are not updated with all the functions/expression names that must be converted between uppercase and lowercase when being copied between the different areas (Catalog, CAS entry area, and history area). At least, the "MOD" function is not included. So, there are a unknown number of uppercase functions in the Catalog that are invalid in CAS environment, due to this abnormal behavior, and for those we need to manually type them in uppercase to be accepted! The question here is: How many of these Catalog functions/expressions are invalid in the CAS environment? Does it make any sense at all? I'm sure it does for the good people working hard on this issues to be fixed in due time. Me? I'm lost here. I have to read the HP user guides in deeper detail to see if I can find some answers. Jose Mesquita RadioMuseum.org member 

03092014, 07:31 AM
Post: #3




RE: Xcas Syntax / Prime Syntax (in particular computing in Z/pZ)
Some clarifications:
Xcas has several syntax compatibility modes: maple, geogebra, ti, hp, that you can change with the xcas_mode and calc_mode commands. For example, calc_mode(38) on Xcas will somewhat simulate the Prime syntax compatibility mode, this make it easier for me to fix bugs for the Prime CAS. The Prime CAS parser does not recognize all the keywords that are recognized by Xcas. xcas_mode and calc_mode are not recognized on the Prime, you can not switch to Maple compatibility mode on the Prime. In addition, some keywords differ, like %, because % is a keyword on the HP. That's why on the Prime, you must use %% instead of % if you want to work in Z/pZ. For uppercase/lowercase commands: (almost) all the genuine HP38 uppercase commands are builtin CAS commands, which means no conversion happens if you are using them from the CAS. New Prime uppercase Home commands are not builtin CAS commands, if you are using them from the CAS, the call to the Home command is done with conversion to Home objects. 

03092014, 12:17 PM
Post: #4




RE: Xcas Syntax / Prime Syntax (in particular computing in Z/pZ)
Thank you parisse for the %% hint!
Is it intended that the Prime converts the expression 12%%13 in the history to %%(12,13)? That's a little bit confusing, because if I copy this to the entry line it is again converted back to 12%%13. However if I type it like its in the history and execute it there is an error. Also: I am not familiar to the HP38. How do I know whether a command is one of the "genuine HP38" commands and which not? 

03092014, 03:27 PM
Post: #5




RE: Xcas Syntax / Prime Syntax (in particular computing in Z/pZ)
There is indeed a display bug in textbook mode for %%. It works if you don't check textbook mode.
For the HP38 genuine commands, I guess the best is to get an HP39G manual from HP website. 

03092014, 04:20 PM
Post: #6




RE: Xcas Syntax / Prime Syntax (in particular computing in Z/pZ)
(03092014 03:27 PM)parisse Wrote: There is indeed a display bug in textbook mode for %%. It works if you don't check textbook mode.I cannot reproduce that it works when not set to Textbook: On my Prime, if I switch to "Algebraic" under Home settings, the calculator still converts it to %%(,). Or did you mean another setting? (However I found another bug while trying some settings, see my other thread) 

03092014, 04:33 PM
Post: #7




RE: Xcas Syntax / Prime Syntax (in particular computing in Z/pZ)
Yes I meant 2d display, not 2d input.
The %% bug with approx data has been fixed in source a few days ago, should be in the next firmware. 

10052014, 11:09 AM
Post: #8




RE: Xcas Syntax / Prime Syntax (in particular computing in Z/pZ)
Exactly what I am most interested about! As I work almost exclusively in the CAS environment of the Prime, I would be very grateful for any complete list of:
1) Which of the Xcas commands can be used there, and 2) What exactly is the syntax for them on the Prime. You see, most of the time the expressions I have to work with are large and completely "unpleasant". Now, the easily accessible commands (from the command catalog, or CASMenu etc.) either do not at all perform the expression manipulations the way I want to do them, or they... crash the calculator and I lose everything, having to restart from the beginning. And yes, I know that I could also copy parts of big expressions, paste them into history, do some work with them, and substitute them back to the original expression. But with such big expressions and such a small display it soon becames a nightmare. You know, scroll back and forth, try to select the right part of the expression, oh no it was a mistake, klickklickklick on the mouse button, oh no it was the false history item, and so on... This is only wasted time (and nerves.) So, it would be really a life saver for me to have such a commands list of Xcas on the Prime (along with their syntax), in order to program my set of CAS commands/programs for exploding expressions, doing some manipulations on particular parts of them, and recombining them back. Simply reading the Xcas manual and trying out the commands on the input line of the Prime is worse than playing roulette. BTW, it is a real pity to have such power under the hood and not being able to access it. (The Apps and the like constructs are perhaps good for commercials and fancy demonstrations, but for work beyond the "student level"..... Sorry, I don't "explore" (how fancy!!!) the quadratic equation anymore... ;)) Ciao, Nick. P.S.: Oh, yet another question: Why does the commands catalog of the Prime not include such things like for example op, union etc?? 

10052014, 12:46 PM
Post: #9




RE: Xcas Syntax / Prime Syntax (in particular computing in Z/pZ)
Here is a list of Giac/Xcas commands that are not available on the Prime:
Code:


10052014, 05:34 PM
Post: #10




RE: Xcas Syntax / Prime Syntax (in particular computing in Z/pZ)
(10052014 12:46 PM)parisse Wrote: Here is a list of Giac/Xcas commands that are not available on the Prime: Which makes 555 commands.... Sigh! That many! I guess that at least some of the calculation commands could be replaced by more or less adequate programs on the Prime. But my hopes for making good replacement programs ( based on onboard means of the Prime) for exploding and constructing expressions get vanishing by the minute. Anyway, thank you very much and ciao, Nick 

10052014, 06:04 PM
(This post was last modified: 10052014 06:08 PM by Tim Wessman.)
Post: #11




RE: Xcas Syntax / Prime Syntax (in particular computing in Z/pZ)
You appear to be counting lines and not actually looking at the list itself.
The vast majority of them fall into 3 categories. Commands that are complete synonymns of others and ARE in there, just under one name instead of 25 different names for the same command, commands that are for drawing and doing UI things on the calculator (created for the 39gII, and turned off since the native functions can be used directly in the CAS now), and then things that don't make sense at all for the calculator (writewav,csv2gen,spread2mathml, etc). Once you actually eliminate all of those, you are left with maybe 2030 commands that were turned off because they were completely undocumented, untested, and need to have that done before allowing them to be used. Are we really back to counting "functions" in order to determine capability? TW Although I work for HP, the views and opinions I post here are my own. 

10052014, 08:31 PM
Post: #12




RE: Xcas Syntax / Prime Syntax (in particular computing in Z/pZ)
(10052014 06:04 PM)Tim Wessman Wrote: You appear to be counting lines and not actually looking at the list itself. I do not remember having asked a question about "all possible" commands but especially for those that manipulate expressions and parts of expressions. I do admit that I was (and still am) quite surprised to see how big the missing part of the Xcas is, because I didn't expect that (and thus the sigh), but this is not my focus here. My focus is that this way it will be hardly possible to make programs for algebraic manipulations as I need them. And I need many of them. The more the better! So I guess, I will have to try whatever is available and see how far I can get.. Last remark: Remember, you neither define for me what "makes sense" on a tool that I use, nor what I consider important about the tool's capabilities, OK Tim? If for me the number of specific functions is important, then it is important for me whatever impression you might have about that. For I am the one depending on that, not you. Ciao, Nick 

10062014, 05:57 AM
Post: #13




RE: Xcas Syntax / Prime Syntax (in particular computing in Z/pZ)
If f is an expression, you can get the node operator/function with f[1], and all arguments with f[2], etc., size(f) is the number of args.


10062014, 06:58 AM
Post: #14




RE: Xcas Syntax / Prime Syntax (in particular computing in Z/pZ)
(10062014 05:57 AM)parisse Wrote: If f is an expression, you can get the node operator/function with f[1], and all arguments with f[2], etc., size(f) is the number of args. Great, thanks a lot! So, having this and also op(f) it seems possible to completely decompose any given expression for manipulating its parts in any thinkable way. Ciao, Nick 

« Next Oldest  Next Newest »

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