Find ordered quadruples of integer \( (a,b,c,d) \) such that \[\begin{cases} a+b+c+d & =0\\ \sin a + \sin b+ \sin c +\sin d &=0. \end{cases}\]

I thought I had a solution to this question, and worked it out through pencil and paper. When I used Just-Basic (the free Windows version) to test all the possibilities, it confirmed my result. I was excited and submitted the answer, but was told that I was wrong so I filed a report. However, when I tested all the possibilities using a Python program in SAGE - I got a different answer. Intrigued, I have since gone back and found my mistakes and also why Just-Basic screwed up.

So what happened? We seldom get bit by the fact that calculators, computers, and poorly written programs can often miss things because of **rounding errors** or the fact that **binary conversions are not always exact**. The default precision of calculations is often unknown. Different machines and various programming languages combine to create peculiar results if we are not careful and fail to take these problems into consideration. It is never easy to know exactly what is happening "under the sheets".

Moral of the story - **Don't trust machines** - use what is between your ears better - especially when you are doing exact calculations in Algebra or Number Theory!

As a further illustration of this topic, try this question
Remember the "Windows Calculator" is running on a **machine**.

## Comments

Sort by:

TopNewestyou do not have to trust your machines, you have to trust yourself that you wrote the correct code. Do you mind sharing the basic code?

And yes, floating point arithmetic is like that. When you are doing numerical analysis, I suggest you watch out for small errors like that. That is why there is a whole branch of mathematics devoted to it – Agnishom Chattopadhyay · 4 months, 3 weeks ago

Log in to reply

LAST 2 LINES OF OUTPUT:

Here is the program, after the fix, which got the correct answer:

LAST 2 LINES OF OUTPUT:

This last program is in Python running on cloud.sagemath.com and it got the correct answer first try.

Sorry about the poor formatting - I'm just learning LaTeX. I hope Calvin Lin doesn't feel I've given too much away about his question. That's why I left out 'correct answer'

P.S. I have come across some of your work on Brilliant and found your animated graphs extraordinary!

Especially on this question where you made some graphs for Otto K Bretscher ! Just absolutely Brilliant ! – Bob Kadylo · 4 months, 3 weeks ago

Log in to reply

I am glad that you've figured the solution out. Dealing with numeric error is a common problem you've to deal with in the field of numeric analysis. It is easier for SAGE because SAGE is not just normal python, sage is a Computer Algebra System built on top of python which is optimised to deal specifically with mathematical problems.

I guess the moral isn't

Don't trust computersbutComputers are useful as long as you use your brain. Computing is an important part of the mathematics that is emerging today. You might want to check out this and Experimental Mathematics – Agnishom Chattopadhyay · 4 months, 3 weeks agoLog in to reply

The two Wikipedia references you suggested I check out were very interesting and linked to countless other articles I really enjoyed ! You've made this 'Note' twice as valuable. – Bob Kadylo · 4 months, 3 weeks ago

Log in to reply

Formatting Guide.

I got them from theGlad that you liked them :) – Agnishom Chattopadhyay · 4 months, 3 weeks ago

Log in to reply

I agree, except that in my case I can't trust the grey matter either. You might be interested in my solution to the first problem you mention above. – Bill Bell · 4 months, 3 weeks ago

Log in to reply

@bobbym none You might want to comment here. – Agnishom Chattopadhyay · 4 months, 3 weeks ago

Log in to reply

– Bobbym None · 4 months, 2 weeks ago

Comparing two floating point numbers for equality... a recipe for disaster.Log in to reply

– Agnishom Chattopadhyay · 4 months, 2 weeks ago

What is Donald Knuth's suggestion about that?Log in to reply

– Bob Kadylo · 4 months, 2 weeks ago

Nice point ! I think that sums up what happened here very well !Log in to reply

Hi Bob; Computers are tricky, the point is get answers out of them. That you did, so you did well. – Bobbym None · 4 months, 2 weeks ago

Log in to reply

Knuth does not have an email. I suggest you ask him directly.

– Agnishom Chattopadhyay · 4 months, 2 weeks agoLog in to reply