![]() |
CAS: (2^10)! is undefined? - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: CAS: (2^10)! is undefined? (/thread-11679.html) Pages: 1 2 |
CAS: (2^10)! is undefined? - sasa - 10-27-2018 03:41 AM Trying factorial of 2^10, another unexpected result is shown... The same with all values overflow result... The same result with Gamma function... It is obvious bug in beta, however I wonder is this is existed bug in previous official releases... RE: CAS: (2^10)! is undefined? - parisse - 10-27-2018 04:58 AM It's not a bug, it's a well-known limitation. RE: CAS: (2^10)! is undefined? - sasa - 10-27-2018 05:13 AM (10-27-2018 04:58 AM)parisse Wrote: It's not a bug, it's a well-known limitation. Can you point in the User Guide where that is "defined"? The CAS in Prime definitely introduce new rules and quite a bit unexpected behaviour... The logical step is to avoid to test it further. RE: CAS: (2^10)! is undefined? - Voldemar - 10-27-2018 09:59 AM In CAS the largest integer number, for whitch the factorial is calculated is 1006. 1007! gives «undef». I think «undef» is not quite right. I think «overflow» would been better. RE: CAS: (2^10)! is undefined? - parisse - 10-27-2018 03:27 PM The fact that large integers must be limited in size can of course not be avoided, the limit being smaller on calculators than on PC. The CAS code is based on Giac which is also open-source licensed, you can therefore find useful informations in the source code if you don't want to make a small dichotomoy to find the limit, look in global.cc for FACTORIAL_SIZE_LIMIT (it's certainly possible to raise a little bit the limit, but the biginteger library used on the Prime is not very efficient compared to GMP or MPIR). BTW, the largest factorial that the nspire can compute exactly seems to be 446! Once you can not compute exactly (and you can't convert to a floating point number), returning undef is a good option, because you are sure that it will remain so in further computation. Introducing an overflow constant would not bring much additional information, but would increase the code complexity because we would have to deal with arithmetic operations like overflow+1=overflow (ok), overflow*0= well is it 0 or undefined? 1/overflow= hum, should I define underflow also? Then, should I defined +overflow and -overflow...? @sasa: I'm in general open to constructive discussions that can help improve Giac, but please consider that I'm not really a newcomer : I'm coding CAS software since 25 years, I think I know a little bit how to do it. Of course, I may miss something that someone could point to me, but your last post about solving z=sqrt(i) giving "unexpected" results does not help considering your comments very seriously. RE: CAS: (2^10)! is undefined? - John Keith - 10-27-2018 03:48 PM I understand that the Prime's computing power is limited compared to a PC. However, I cannot understand why the sizes of integers are restricted to less than those of the HP50g. The 50g can (slowly) calculate 5000! exactly (it has 16326 digits). The only limitation seems to be available memory. I would respectfully request that these limitations be removed if possible. I realize that the average user does not need 16000-digit integers every day but it seems sad that the Prime, which is much faster and has much more RAM, is more limited in capabilities than the 50g. John RE: CAS: (2^10)! is undefined? - sasa - 10-27-2018 04:56 PM (10-27-2018 03:27 PM)parisse Wrote: @sasa: I'm in general open to constructive discussions that can help improve Giac, but please consider that I'm not really a newcomer : I'm coding CAS software since 25 years, I think I know a little bit how to do it. Of course, I may miss something that someone could point to me, but your last post about solving z=sqrt(i) giving "unexpected" results does not help considering your comments very seriously. We both share the same fields of interest/profession (probably age as well) and we both was done the same - only difference is that I done my own for fun only. Thus I'm quite serious about both matters and I'm quite surprised with your comment that "It's not a bug, it's a well-known limitation" which pointed to me that you deny existence of any error... If you are open to make corrections, please consider to perform it. I could not know that you have not implemented overflow/underflow mechanism, since I did not looked in your source (nor have a time for that). I assumed that exists, as it is mandatory in order to distinguish weather it is hardware/software limitation for number storage or it is documented math function limitation. You should also seriously consider not to mix concept and state (infinity, dividing by zero...) and numbers, as that makes real headache as I already mentioned in some earlier posts. If some function may rise dividing by zero, there is no other way than handle that in the code. Checking that state will slow down a bit execution, however from other side you will stop execution immediately instead to perform calculation to the end, which will anyway return wrong/not enough precise/unexpected result (you may formulate it as you prefer). Please take a look at IEEE-754 how they defined handling unexpected float operation. Since on PC IEEE-754 is implemented in hardware, there no other way to control workflow in users program than to analyse output. However, instead to encode error in the number format, you hence probably works with objects and you can control workflow precisely. I personally do not really prefer to keep value on overflow/underflow (as I avoid to do that in library I made for 8-bit MCUs), as that may be only helpful indeed rarely during analyzing last received format number result in debug mode, but you may consider that option as well... RE: CAS: (2^10)! is undefined? - parisse - 10-27-2018 06:31 PM @sasa: I insist: it's not a bug, a bug is a logic error that you can fix, but here you can not avoid an upper limit for integer factorial computations because memory and time is limited. The only questions are: what is the limit and what do we do if we are above the limit (I agree that 1000 could probably be raised a little, but if it's one million or 1000, the question remains : what do we do above). I explained why I decided to return undef instead of introducing things like overflow. Perhaps +infinity would be better in some situations (that is what you would probably get with floats), but in other situations it is not: for example if you divide 1007! by 1007. You compare with floating points, but approx computations are different from exact computations, for example there is no limit command, and detecting undef is very important in limit in order to call the mrv algorithm if it is required. Now, you say:"We both share the same fields of interest/profession (probably age as well) and we both was done the same - only difference is that I done my own for fun only". But I don't believe it's the only difference, at least not without testing your software. Perhaps your software is a toy-CAS and you do not really realize all the constraints to run a full-featured CAS. Let us see your system and it's capabilities before continuing the discussion ... speaking is easy. RE: CAS: (2^10)! is undefined? - sasa - 10-27-2018 07:59 PM Look at wikipedia, bug is a wide range of reasons caused improper software functionality: https://en.wikipedia.org/wiki/Software_bug But I will not talk about semantic, that is not important at all... I considered it as a minor bug, as anyone would expected "overflow" error instead "undefined". Since you did not implemented the overflow/underflow mechanism which was mandatory, that may be quite bigger problem which probably require core redesigning, which is often not naive at all... Also there is no difference in logic regarding handling operation failures, thus IEEE-754 is quite valid reference. It show basic you have to consider in order to avoid problems as reported. I have had found more unexpected results, but I do not have any more time to spend on this, especially if you are not ready to do anything about and refuse any valid suggestions, even from someone made fully functional 64-bit floating point library on plain 16MHz MCUs from ground recently with efficiency suitable to be used in any time critical application and as well a lite version of CAS in the past (actually, it was called differently ten)... You have a point, it is easy to talk and fairly easier to deny existence of any issue which require fixing. Perfect program by definition does not exist, why denying obvious? You have a daily job as anyone else, but as well probably responsibility to maintenance CAS for HP. BTW, If I ever manage to find the backup CD with the old version, I will first send to you to test. It was a toy, yes, made for fun only as a challenge to spare time for mainly symbolic higher order derivation and desired 2D and 3D graph displaying, but what was capable to do was done properly and fast. I have also had much better things to do in multiple fields in past 30+ years, than improving that single project to a powerful CAS... And the last unexpected result I have found in Prime was: limit(x/ABS(x),x,0) => 0 ?!? (including limit from left and right) At end, if you treat all as personal attacks, it is really no point to waste more time on this. It is anyway up to you what to do. If you, HP and customers are happy with current state, there is no point for evidence of any bug existence... I wish you all the best, whatever you decide. RE: CAS: (2^10)! is undefined? - Mark Hardman - 10-27-2018 08:40 PM (10-27-2018 07:59 PM)sasa Wrote: And the last unexpected result I have found in Prime was: Are you sure you're holding it right? RE: CAS: (2^10)! is undefined? - sasa - 10-27-2018 08:55 PM (10-27-2018 08:40 PM)Mark Hardman Wrote: Are you sure you're holding it right? Yes, at least in latest beta on 64-bit Linux. RE: CAS: (2^10)! is undefined? - Mark Hardman - 10-27-2018 09:43 PM (10-27-2018 08:55 PM)sasa Wrote: Yes, at least in latest beta on 64-bit Linux. You're using results from an alpha version of the Linux VC as the source of your criticism? That is very sad indeed. It shows that you are willing to use deception in order to criticize Bernard's CAS. (09-18-2018 01:32 AM)Tim Wessman Wrote: While you can post in forums such as this at your discretion, we ask that the primary way of reporting be to send reports to calcbeta@hp.com. Basically, the goal is avoid disruption or annoyance to other forum participants. (09-18-2018 01:32 AM)Tim Wessman Wrote: There is now a "technical preview" of ONLY the HP Prime Virtual Calculator for Linux (not the Connkit since all communication forms (usb, etc) are not ready for that yet). Primarily, this is to determine if our method of using an appimage (https://appimage.org/) for distribution will be a good way to deliver HP Prime software. RE: CAS: (2^10)! is undefined? - CyberAngel - 10-27-2018 10:04 PM (10-27-2018 09:43 PM)Mark Hardman Wrote:(10-27-2018 08:55 PM)sasa Wrote: Yes, at least in latest beta on 64-bit Linux. Deception I think you should edit or delete your post. There is a limit. Please, consider choosing your words more wisely. RE: CAS: (2^10)! is undefined? - sasa - 10-27-2018 10:17 PM (10-27-2018 09:43 PM)Mark Hardman Wrote: You're using results from an alpha version of the Linux VC as the source of your criticism? That is very sad indeed. It shows that you are willing to use deception in order to criticize Bernard's CAS. You making wrong conclusions and indeed publicly insults without reasons... In every post I have noted about version and asked about official release behaviour. Bernard itself admitted the same results. As well I have no physical device, Bernard itself know that very well, which I have wrote numerous of times. And as well, all of this was primarily sent to HP. People are in general quite sensitive on any constructive discussion and then all turns to accusations and personal attacks. It turns that I'm guilty for pointing obvious problems with CAS? As I said already, I will avoid any further public mention of even minor problem regarding CAS, as it is evident what is going on... It is really no need for all of this. RE: CAS: (2^10)! is undefined? - Mark Hardman - 10-27-2018 10:40 PM (10-27-2018 10:17 PM)sasa Wrote: You making wrong conclusions and indeed publicly insults without reasons... I have not insulted you. If you feel you are being publicly insulted, perhaps a public forum is not the place for you. (10-27-2018 10:17 PM)sasa Wrote: In every post I have noted about version and asked about official release behaviour. Bernard itself admitted the same results. In this thread, the first mention of "Linux VC" comes after I pointed out your deceptive "bug report". Perhaps you are using hyperbole when you say, "every post"? (10-27-2018 10:17 PM)sasa Wrote: It is really no need for all of this. Yes there is. This forum is a historic repository of information about HP Calculators. When deceptive or false information is posted it needs to be corrected so that people searching the forum in the future are not presented with misleading data. RE: CAS: (2^10)! is undefined? - CyberAngel - 10-27-2018 11:13 PM (10-27-2018 10:40 PM)Mark Hardman Wrote:(10-27-2018 10:17 PM)sasa Wrote: You making wrong conclusions and indeed publicly insults without reasons... Emphasis mine but Why? I once again disagree with the wording RE: CAS: (2^10)! is undefined? - NetMage - 10-28-2018 03:14 AM (10-27-2018 08:40 PM)Mark Hardman Wrote: Are you sure you're holding it right? Those absolute bars are way too tall - looks like some type of pi symbol. Sad. RE: CAS: (2^10)! is undefined? - parisse - 10-28-2018 06:17 AM (10-27-2018 07:59 PM)sasa Wrote: Also there is no difference in logic regarding handling operation failures, thus IEEE-754 is quite valid reference. It show basic you have to consider in order to avoid problems as reported.You probably think so because your experience with coding CAS seems rather limited: Quote:It was a toy, yes, made for fun only as a challenge to spare time for mainly symbolic higher order derivation and desired 2D and 3D graph displaying, but what was capable to do was done properly and fast.Computation of limits, integrals, solution of differential equations, solving in general as well as simplifications of expressions with algebraic relations between variables or some linear/polynomial algebra is much more complicated, especially if you want to be efficient. Quote:And the last unexpected result I have found in Prime was:As reported by other users, I can not reproduce this, I get correct answers. There are probably still bugs in limit or other complex algorithms, but since Giac is also used by Geogebra, I expect they will appear for more unusual inputs. Quote:At end, if you treat all as personal attacks, it is really no point to waste more time on this. It is anyway up to you what to do. If you, HP and customers are happy with current state, there is no point for evidence of any bug existence...Actually, when someone is only posting to say "Ha! this CAS does not even simplify this properly" or "this CAS does not return the expected result for that", etc. and pretend he knows better than me how to code CAS software because he wrote some symbolic code in the past, shoud I react by asking "Great, send me more?" RE: CAS: (2^10)! is undefined? - CyberAngel - 10-28-2018 09:57 AM (10-28-2018 06:17 AM)parisse Wrote: X Obviously, yes! ;-) :-D The thing is that CAS systems are different. It is possible to go on different routes, for example: A) Develop a CAS with High School and university first year math "usual" answers (I call this Fake CAS) B) Develop a CAS that unusable for the poor undergraduate student with no Thesis in CAS building thus making the CAS unusable to anyone else except for specialists C) Balanced CAS - somewhere in between the extremes The main problem is that you can't please everyone. One solution would be a specific CAS settings application - if HP likes the idea - where all these requests would be gathered along with additions to the [Help]. Who pays for this? Who has the time to develop, test, and maintain it? Will it bring HP an advantage in the market? Without it would HP Prime be consider somewhat inferior to, say, TI-Nspire CX CAS (which I also own both in a PC and physically) I think HP should be superior in every way and since many people here point out errors/incompleteness/different behavior they still should be taken as a positive feedback and considered seriously. Not every (old) High School teacher have the capability to explain CAS quirks to students, therefore I strongly recommend you consider adding for the user (teacher/student) to optionally "stupefy" your CAS even if you thing that for higher math the result is wrong. On the other hand this would IMHO require feedback from the educators in France. How to make Giac, KhiCAS, GeoGebra, HP Prime CAS, more user friendly? I'm again talking about high school level math (or first year university). What about HP? Tim Wessman? VPN RE: CAS: (2^10)! is undefined? - Aries - 10-28-2018 10:30 AM Factorials of large numbers are often necessary to evaluate binomial distributions for the statistics. An accurate approximation is Stirling's approximation (also helpful for approximating the log of a factorial): n! = (n^n)*(e^(-n))*(sqrt(2*pi*n)) But at the end of the day … you have to use logs of logs … ![]() Best, Aries ![]() |