Write a GCD program for the HP-41C with chatGPT - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: General Forum (/forum-4.html) +--- Thread: Write a GCD program for the HP-41C with chatGPT (/thread-19351.html) |
Write a GCD program for the HP-41C with chatGPT - Thomas Klemm - 12-28-2022 12:35 PM The first answer was a bit disappointing. At least it looks like a program for the HP-41C. But it's nice that when I asked to replace the labels, the goto commands were also replaced. This was my first try, so be kind to me. RE: Write a GCD program for the HP-41C with chatGPT - Didier Lachieze - 12-28-2022 02:10 PM I find quite impressive the way chatGPT answers look so human. However I find also quite puzzling how the answers look so authoritative, as from an expert on the topic, while clearly chatGPT has no understanding at all of how a 41C program is working, and you had to instruct it exactly how to modify the program to make it work. It's clear for us that the program provided initially is not a working HP-41 program, but on other more complex topics it could be easy for people to take answers from such IA programs as answers from experts and take them as expression of the truth. This will become a problem when people will not be able to differentiate information and data coming from a human expert or from such IA programs. Another problem is that these IA programs are fed with huge loads of data from the internet and their outputs is now part of internet content, thus polluting the reference used to build them. RE: Write a GCD program for the HP-41C with chatGPT - pier4r - 12-28-2022 02:28 PM Oh ChatGPT arrived also here. It is a really interesting development. As Didier pointed out, the model is often "confidently incorrect", especially on topics where the initial training data does not have many data points. I am surprised it knows the 41C as the datapoints in the training data (they used Common Crawl as the main dataset) surely are minimal. Other languages fails as well. For example if one asks about RPL, it tries with Lisp. Puppet is mixed with Ruby. Terraform is mixed with other programs too. In other words, it tries, and it shows confidence (that more often than not is enough for a human to accept the answer), but it can be subtly wrong. Instead of small code snippets in the most common languages (python, java, what have you, but also awk or bash) it works well. I find it neat to ask for pointers and directions rather than full solutions, a sort of "quick search engine". In that case it works really well. Much better is to work with human languages (again, the most common ones at least). I use it for German, English and Italian and it is pretty neat. Like checking the grammar, building example sentences with words or providing meaning of the words. I often double check with vocabularies and grammar books but in human languages it is really helpful. There are also many other usages. For example it could be an helper for the outline of an article or book, given some initial pointers. It also helps for recommendations, like "I liked this list of movies or books or places or what have you, what should I check next?". The recommendations weren't bad! The important part to keep in mind is though: it picks the next words based on statistics "what will likely be here given my training dataset", so it can be subtly wrong in all possible cases if one lowers the guard. Also because in the internet people like me write with broken grammar (or code or what have you) all the time and the training data comes from the net. RE: Write a GCD program for the HP-41C with chatGPT - Thomas Klemm - 12-28-2022 02:39 PM (12-28-2022 02:10 PM)Didier Lachieze Wrote: However I find also quite puzzling how the answers look so authoritative On the other hand also very submissive: Quote:I apologize for the oversight. A colleague asked the bot to rewrite some savage insults using Nonviolent Communication. The result was interesting and hilarious at the same time. This could be the future of all internet forums: no locked threads, but automatic moderation. RE: Write a GCD program for the HP-41C with chatGPT - EdS2 - 12-29-2022 09:50 AM I've seen two or three spam posts on the anycpu forum recently which have the feel of being automatically generated: broadly coherent with the existing thread but actually not useful contributions - and, as a giveaway, one punctuation character acts as a spam link. I suspect those of us who moderate are more likely to encounter this technology as a nuisance than as an assist. But those of us who don't moderate may not even see those problematic posts, and conclude that all is well... RE: Write a GCD program for the HP-41C with chatGPT - Thomas Klemm - 12-29-2022 12:43 PM (12-29-2022 09:50 AM)EdS2 Wrote: I suspect those of us who moderate are more likely to encounter this technology as a nuisance than as an assist. This is in response to a request to rewrite a recent post using Nonviolent Communication: Quote:I understand that it can be frustrating to encounter what may seem like irrational or baseless ideas. I'm curious if there might be a way to express your perspective without using derogatory language or suggesting that someone seek mental health treatment as a solution. Could you perhaps rephrase your comment to say something like: "I appreciate that people may have different perspectives, but I'm having a hard time understanding how this particular theory fits into the conversation. Could you perhaps explain your perspective further or provide some supporting evidence for your viewpoint?" This approach focuses on expressing your own feelings and needs, rather than attacking or belittling someone else's thoughts or experiences. This sounds pretty reasonable, doesn't it? RE: Write a GCD program for the HP-41C with chatGPT - Sylvain Cote - 12-29-2022 03:36 PM Interesting, but it definitively need to be trained on the HP-41. Nit-picking here, data registers on the HP-41 are numerical. (00 ... 99) → Ex.: STO 00 ; RCL 01 ; ST+ 02 RE: Write a GCD program for the HP-41C with chatGPT - Siegfried - 12-30-2022 07:04 AM Definitely spooky. RE: Write a GCD program for the HP-41C with chatGPT - Allen - 12-30-2022 04:57 PM During the holidays I've also been experimenting with the OpenAI Chatbots.. with not as impressive or promising results. When asked what the prime factors of 8633 (answer: 89 and 97), it produced a long paragraph of "correct sounding" drivel.. The other (non math) questions were pretty good, but I'm not prepared to spend much time even considering AI-generated software it can reliably answer some more 7th/8th grade math things correctly. Me: what are the prime factors of 8633? Quote:The prime factors of 8633 are 3, 3, 3, 3, 3, and 11. In a separate question, the chatbot insisted that 1024-4 = 1000. Me: Using only addition, add eight 8s to get the number 1,000. Quote:To add eight 8s to get the number 1,000 using only addition, you can use the following calculation: Other than a simple addition problem and "how many sides does a square have", few of the math questions were correct. The problem in using these for math/computer science isn't going to be when it's blatantly WRONG in the examples above. The challenge will be figuring out when it's nearly right- which is analogous to debugging intern code that works most of the time. I think if combined with a SAT-solver or similar, the code COULD work, but I'm not betting on it anytime soon. Me: how many edges does a 6 dimensional hyper-cube have? ( correct answer is 192) Quote:A 6-dimensional hypercube, also known as a tesseract, has 32 edges. RE: Write a GCD program for the HP-41C with chatGPT - pier4r - 12-30-2022 11:36 PM Nice ones Allen. Yes if asked about basic checkmates (on lichess.org there are chapters to train those), chatGPT is not even getting the position most of the time. I think that the current iteration is mostly tuned for natural languages (try translations or explanation of words) and most common code snippets. For the rest they need better training or data. RE: Write a GCD program for the HP-41C with chatGPT - Thomas Klemm - 06-21-2024 07:35 PM I thought to give it another try using copilot: Quote:Use the Euclidian algorithm to write a program for the old calculator HP-41C from Hewlett Packard that calculates the greatest common divisor of two numbers. To write a program for the HP-41C calculator that calculates the greatest common divisor (GCD) of two numbers using the Euclidean algorithm, follow these steps in pseudocode:
Now, translating this pseudocode into a program for the HP-41C, which uses RPN (Reverse Polish Notation) and has a specific set of instructions: Code: 01 LBL "GCD" ; Label the program GCD This program uses the HP-41C's capabilities to calculate the GCD of two numbers entered by the user. It utilizes registers for storing intermediate values and loops until the second number becomes 0, at which point the first number is the GCD. Quote:Do not prompt for the numbers but assume that the two numbers are already on the stack. To modify the program so it assumes the two numbers are already on the stack instead of prompting the user to enter them, we'll remove the PROMPT instructions and adjust the storage instructions accordingly. Here's the updated program: Code: 01 LBL "GCD" ; Label the program GCD This version assumes the user has already placed the two numbers on the stack with the first number entered being on the bottom (first to be stored in register 00) and the second number on top (to be stored in register 01). Quote:There's a problem with step 5: Set A to B and B to Remainder. The remainder has to be stored in register 01 (new B). The second number has to be stored in register 00 (new A). To do so, use the RDN (roll down) command. To correct the issue with step 5, where the remainder needs to be stored in register 01 (new B) and the second number in register 00 (new A), we can use the RDN (roll down) command to adjust the values accordingly. Here's the revised section of the program: Code: 01 LBL "GCD" ; Label the program GCD This adjustment ensures that after calculating the remainder (step 10), we swap the X and Y registers so that the remainder can be stored in register 01 as the new B (step 12). Then, we use the RDN command to roll down the stack, bringing the original second number into the X register, which is then stored as the new A in register 00 (step 14). This corrects the logic to match the intended algorithm steps. Quote:We're close. The swap command (X<>Y) in line 11 has the be removed. And thus the comment in line 12 has to be adjusted. Based on the feedback, here's the corrected excerpt without the swap command (X<>Y) in line 11, and with the adjusted comment in line 12: Code: 01 LBL "GCD" ; Label the program GCD Quote:Almost there: we need another RDN command after line 02. Otherwise the second number is also stored in register 00 in line 03. To ensure the correct order of storing the numbers in the registers and to avoid the second number being stored in both registers, an additional RDN command is needed after line 02. Here's the corrected code: Code: 01 LBL "GCD" ; Label the program GCD Quote:Drop the PSE command in line 18. Replace the RTN command in line 19 by the END command. Code: 01 LBL "GCD" ; Label the program GCD Quote:Perfect. Now I want to test the program. Can you give me two numbers that I could use? And what is the expected result? You can use the numbers 48 and 18. The expected result for the Greatest Common Divisor (GCD) of 48 and 18 is 6. |