ChatGPT

MrAl

Joined Jun 17, 2014
13,707
I thought I'd share this, this is a dialog between me and Copilot AI about the NRF24L01+, look near the end where I accuse it of contradicting itself, it is eerie, it was correct and this was similar to a conversation I'd have with an expert, scroll down to this question I asked to see why I accused it of contradicting itself:

View attachment 348195

https://copilot.microsoft.com/shares/7mVxQ3YAvTT6BuMqQ6xBc
Hi,

At this point in time I don't think anyone should be too surprised if any 'ai' bot contradicts itself, especially with highly technical stuff. It's really a language model not so much a technical model. It can answer some questions quite well, but other more in-depth questions we would be lucky if it can answer at all.

Once these came online I tested one with some simple questions that had answers that were not very well known in any field like mathematics. The questions were simple but the answer was not your typical answer. It was about code to calculate the sine (and cosine) of an angle, of which there are well-known solutions out there. The more typical solutions use a series to calculate this and the more terms you use the more accurate the result becomes. This is used for large number calculations where the CPU is not directly ready for. The idea is to be able to calculate the sine of an angle to any number of digits, which might be 100 or so but could even go up higher like 1000, 10000, etc. This of course is for special purpose calculations.

The solution I was looking for was an algorithm I had found a very long time ago that was very different than the series type solutions like a Taylor series or Chebyshev series or similar. This algorithm could take an angle (number like 1.234) and by repeating the algorithm several times could come up with a solution that is highly accurate to any number of digits the user preferred. In fact, it would DOUBLE the number of accurate digits with each pass. That means that if the first pass was 0.94, the second pass would yield 0.9438, and the third pass 0.94381820 or 0.94381821 and the next pass would produce a result that had 16 accurate digits, etc.
So this was not a series, but a function that simply repeats itself using the result of the previous calculation to calculate a more accurate result. It's amazing how that works.
Anyway, I asked the bot how to do this and first it gave me an algorithm, then when I said that did not work it agreed then gave me another algorithm, then when I said that didn't work it gave me another algorithm, etc. After about five attempts I gave up and closed out that session.
Now later I come back and start a new session and ask the very same question, and it says there is no such algorithm. That was kind of funny.

I have not tried this again since then though maybe it got smarter, but I know the algorithm works because I used it many times in the past when working with a computer language that could not calculate 16 digit results for sine and cosine. Also, I have found what I think is the algorithm and tested it a few times and it does in fact work.
The only thing is it is in a computer language form with several goto's and subroutines that check for certain conditions (like an exit condition) and it also has some calculations, but I have not deciphered it yet into the original math form which would be fairly simple like the recursive algorithm for square root (a little more to it though). I managed to translate it into a more modern language and it works, but that's as far as I got. I wanted to get back to the original form which does not include anything but the calculation itself. That illustrates how interesting this algorithm is and that's what I am after next.
It may be written somewhere on the web because I published it several years ago, but unfortunately, I don't even remember where I published it now. It was probably more than two decades ago and I've worked on so much more after that.
I also tried to recreate the algorithm from scratch many times but failed even after hours of trial and error sessions. I can't believe I forgot that much about it over 20 years of not using it.

The main point though is that the 'ai' bots do not seem to work well with deep technical issues. It's sort of like the web itself, which unless you find research papers you don't get in-depth information only more general stuff.
 

Futurist

Joined Apr 8, 2025
763
Hi,

At this point in time I don't think anyone should be too surprised if any 'ai' bot contradicts itself, especially with highly technical stuff. It's really a language model not so much a technical model. It can answer some questions quite well, but other more in-depth questions we would be lucky if it can answer at all.

Once these came online I tested one with some simple questions that had answers that were not very well known in any field like mathematics. The questions were simple but the answer was not your typical answer. It was about code to calculate the sine (and cosine) of an angle, of which there are well-known solutions out there. The more typical solutions use a series to calculate this and the more terms you use the more accurate the result becomes. This is used for large number calculations where the CPU is not directly ready for. The idea is to be able to calculate the sine of an angle to any number of digits, which might be 100 or so but could even go up higher like 1000, 10000, etc. This of course is for special purpose calculations.

The solution I was looking for was an algorithm I had found a very long time ago that was very different than the series type solutions like a Taylor series or Chebyshev series or similar. This algorithm could take an angle (number like 1.234) and by repeating the algorithm several times could come up with a solution that is highly accurate to any number of digits the user preferred. In fact, it would DOUBLE the number of accurate digits with each pass. That means that if the first pass was 0.94, the second pass would yield 0.9438, and the third pass 0.94381820 or 0.94381821 and the next pass would produce a result that had 16 accurate digits, etc.
So this was not a series, but a function that simply repeats itself using the result of the previous calculation to calculate a more accurate result. It's amazing how that works.
Anyway, I asked the bot how to do this and first it gave me an algorithm, then when I said that did not work it agreed then gave me another algorithm, then when I said that didn't work it gave me another algorithm, etc. After about five attempts I gave up and closed out that session.
Now later I come back and start a new session and ask the very same question, and it says there is no such algorithm. That was kind of funny.

I have not tried this again since then though maybe it got smarter, but I know the algorithm works because I used it many times in the past when working with a computer language that could not calculate 16 digit results for sine and cosine. Also, I have found what I think is the algorithm and tested it a few times and it does in fact work.
The only thing is it is in a computer language form with several goto's and subroutines that check for certain conditions (like an exit condition) and it also has some calculations, but I have not deciphered it yet into the original math form which would be fairly simple like the recursive algorithm for square root (a little more to it though). I managed to translate it into a more modern language and it works, but that's as far as I got. I wanted to get back to the original form which does not include anything but the calculation itself. That illustrates how interesting this algorithm is and that's what I am after next.
It may be written somewhere on the web because I published it several years ago, but unfortunately, I don't even remember where I published it now. It was probably more than two decades ago and I've worked on so much more after that.
I also tried to recreate the algorithm from scratch many times but failed even after hours of trial and error sessions. I can't believe I forgot that much about it over 20 years of not using it.

The main point though is that the 'ai' bots do not seem to work well with deep technical issues. It's sort of like the web itself, which unless you find research papers you don't get in-depth information only more general stuff.
Yes, that's very interesting and I found the same kind of thing. It was good at answering factual answers like "is register X relevant to a receiver?". I try to phrase my question as clearly as I can, minimizing possible ambiguities.

I've never heard of this iterative sine calculation, sounds interesting.

Try asking it stuff like "list some of the different algorithms for computing Pi" and use words like "computing" or "approximating" I found that varying such terms often seemed to generate helpful results just because they have to play a role in the linguistic analysis.
 
Last edited:

BobTPH

Joined Jun 5, 2013
11,523
Reply of Google to the search:

“Iterative algorithm for sine”

An iterative algorithm for calculating the sine of a number can be implemented using several methods, including CORDIC algorithm and Taylor series expansions. These algorithms iteratively refine an approximation of the sine value until a desired accuracy is achieved.

CORDIC Algorithm:
  1. 1. Initialization:
    Start with an initial approximation for the angle and its sine/cosine values.
  2. 2. Iteration:
    For a specified number of iterations, perform the following steps:
    • If the current angle is greater than the target angle, subtract a small angle (atan(1/2^i)) from the current angle and add the corresponding value to the sine/cosine values.
    • If the current angle is less than or equal to the target angle, add a small angle (atan(1/2^i)) to the current angle and subtract the corresponding value from the sine/cosine values.
  3. 3. Refinement:
    After each iteration, adjust the sine/cosine values using the formula: x' = x cos(a) - y sin(a) and y' = x sin(a) + y cos(a), where a is a small angle.
  4. 4. Termination:
    Repeat the iteration process until the desired accuracy is achieved.
Is this what you were looking for?
 

Futurist

Joined Apr 8, 2025
763
Something I did many years ago on a weak computer, was to pre-populate a table with the values of Pi, say an array of 90 entries for example (and use a simple symmetry adjustment when its > 90) and then just access that as if it were a function. This is OK if the resolution (e.g. one degree) is OK (it was in my case, 3D graphic calculations).
 

MrAl

Joined Jun 17, 2014
13,707
Yes, that's very interesting and I found the same kind of thing. It was good at answering factual answers like "is register X relevant to a receiver?". I try to phrase my question as clearly as I can, minimizing possible ambiguities.

I've never heard of this iterative sine calculation, sounds interesting.

Try asking it stuff like "list some of the different algorithms for computing Pi" and use words like "computing" or "approximating" I found that varying such terms often seemed to generate helpful results just because they have to play a role in the linguistic analysis.
Hi,

Yeah I gave up after some attempts (ha ha).

There are a lot of iterative sine algorithms, but the one I am talking about converged 2nd order, which sort of means we get twice the number of correct digits per pass.
I am going to look over the old algorithm I found on a computer disk I had many years ago and see if that's the right one.
I found several others that do converge, but more slowly. Maybe not that bad anyway though, but in calculating the sine of 1.000 it took at least 12 passes to get to 16 digits (or maybe it was 19 passes).

Maybe I should ask an 'ai' bot if it understands that one first.
 

Futurist

Joined Apr 8, 2025
763
Hi,

Yeah I gave up after some attempts (ha ha).

There are a lot of iterative sine algorithms, but the one I am talking about converged 2nd order, which sort of means we get twice the number of correct digits per pass.
I am going to look over the old algorithm I found on a computer disk I had many years ago and see if that's the right one.
I found several others that do converge, but more slowly. Maybe not that bad anyway though, but in calculating the sine of 1.000 it took at least 12 passes to get to 16 digits (or maybe it was 19 passes).

Maybe I should ask an 'ai' bot if it understands that one first.
One difficulty with stuff like this is will you be able to definitively recognize it if you stumble upon it, sometimes our memory misleads and we don't recall well enough and so you might never find this...
 

BobTPH

Joined Jun 5, 2013
11,523
Newton’s iteration would work, but you would need to compute both sine and cosine since the derivative of the original function is used in the formula. This might be a good way to get a double precision result for sine and cosine given a single precision estimate of both.
 

MrAl

Joined Jun 17, 2014
13,707
One difficulty with stuff like this is will you be able to definitively recognize it if you stumble upon it, sometimes our memory misleads and we don't recall well enough and so you might never find this...
Yes this is going back some 35 years or so. I used it every day too, but once I got it going it was on disk and I never questioned it or looked it over after that, so it's hard to remember.
The real b**** of this is that I cannot for the life of me remember how I got to the resulting algorithm, which I used to remember and even told someone about it in a PM I think on this web site (not sure). That was probably 10 years ago.
The derivation was not that difficult, but there was a trick to it and I can't remember what it was (ha ha).
 

MrAl

Joined Jun 17, 2014
13,707
Newton’s iteration would work, but you would need to compute both sine and cosine since the derivative of the original function is used in the formula. This might be a good way to get a double precision result for sine and cosine given a single precision estimate of both.
Hi Bob,

Thanks for reminding me about that. I think I tried that, and it may even have been part of the algorithm, but I could not derive it again even though I tried many different ideas.

I guess I forgot about it because it was used for an older computer that could only do 8 digit sines and cosines and I constantly needed 16 digits at least for a lot of different math like circuit analysis. I needed it for that, but then back maybe around 1998 I started using a more advanced computer that could easily do 16 digit sine and cosine so I did not need it for a very long time, except when I told someone else about it in a PM maybe 10 years back. The older computer was a (don't laugh) TRS80 portable model (ha ha). I loved that thing though for the time I used it. It's amazing it still works and it's from the 1980's. It was really fast though using a Z80 cpu running at a whopping 4 Megahertz (ha ha ha).

Same one being sold in eBay:
VINTAGE RADIO SHACK TRS-80 PORTABLE COMPUTER POWERS ON SEE PHOTOS | eBay

They are asking over $400 for it, when new though it was around $2k USD.
 

cmartinez

Joined Jan 17, 2007
8,768
I've just realized one thing in which LLM (I refuse to call it AI) could be quite useful: material optimization when cutting plaque or sheet metal. It should be a breeze for that sort of software to find the best arrangement to optimize material available in any shape.
 

MrAl

Joined Jun 17, 2014
13,707
I've just realized one thing in which LLM (I refuse to call it AI) could be quite useful: material optimization when cutting plaque or sheet metal. It should be a breeze for that sort of software to find the best arrangement to optimize material available in any shape.
For any kind of technical question like that I would not trust it. It may help but then we should test the design to make sure it makes sense.
I've gotten all kinds of crazy answers when it comes to technical stuff.

One example is:
"How do you cut a cardboard box so that you can make the height shorter?".
The answer was to lay the carboard flat and then mark and cut some area off one set of flaps so the then the width is smaller. When it is all folded up into a box it will be shorter that's all.
But the thing it forgot was you also have to cut the cardboard in each of the four corners so that the flaps fold over all the way. Without that, you have one set of flaps that does not fold over enough to close the box at the top.
I reminded it of that fact, and it corrected its answer.

So even with that relatively simple technical question it could not get all the details, and those details were important. If that was sheet metal and it was shipped that way, the end user would have no way to cut the corners unless they had the tools to do that.

It did give me some interesting facts and ideas about some movies I watched. It had what I might call "insight".
I gave it a continuation of the movie "Lost In Translation" and it built on that, and also suggested some other ideas that could be a continuation of that movie.
For that it was very insightful if you can call it that.

The designation "Artificial Intelligence" may be a correct way to describe this phenomenon though. The key word is "Artiificial" of which one definition is:
"Made or produced by human beings rather than occurring naturally, especially as a copy of something natural."
So it certainly is artificial.
The only catch is maybe that when we paint a picture of a mountain scene, we don't call it "Artificial Nature" :)
 
Last edited:

Futurist

Joined Apr 8, 2025
763
I found the AI assist yesterday, extremely helpful. I wrote some initial C# code to talk to an NRF24 over serial (USB). Within seconds it was second guessing me almost perfectly and reduced what might have been an hours drudgery into ten minutes high productivity.

I suspect Visual Studio "knows" my coding habits from my other recent C work, I login to VS so there's an account and it likely knows the names and details of all the NRF registers.

Because I'll be writing unit tests, I'm not concerned about minor mishaps it might make, the unit tests more than compensate for any unintended flaws made by AI, and once unit tests are passing the code is already very solid.

This has let me focus more on refactoring arguably the key to quality code development these days.
 
Last edited:

WBahn

Joined Mar 31, 2012
32,871
I've just realized one thing in which LLM (I refuse to call it AI) could be quite useful: material optimization when cutting plaque or sheet metal. It should be a breeze for that sort of software to find the best arrangement to optimize material available in any shape.
I'm curious what the line of reasoning is that would lead to his conclusion. Maybe what I think of as a Large Language Model system is too restrictive compared to what you do, but I don't see a solid connection between a system that has built up a statistical model of relationships between words and strings of words so as to string them together is such a way as to conform to that model would make it particularly good at optimizing geometrical layouts.
 
Top