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**.

No vote yet

1 vote

×

Problem Loading...

Note Loading...

Set Loading...

Easy Math Editor

`*italics*`

or`_italics_`

italics`**bold**`

or`__bold__`

boldNote: you must add a full line of space before and after lists for them to show up correctlyparagraph 1

paragraph 2

`[example link](https://brilliant.org)`

`> This is a quote`

Remember to wrap math in \( ... \) or \[ ... \] to ensure proper formatting.`2 \times 3`

`2^{34}`

`a_{i-1}`

`\frac{2}{3}`

`\sqrt{2}`

`\sum_{i=1}^3`

`\sin \theta`

`\boxed{123}`

## 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

Log in to reply

Here is the first program that missed some valid ordered quadruples (a,b,c,d) and gave 1025 (wrong):

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 !

Log in to reply

That's nice. Thanks. I fixed your formatting.

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 MathematicsLog 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.

Log in to reply

Formatting Guide.

I got them from theGlad that you liked them :)

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.

Log in to reply

@bobbym none You might want to comment here.

Log in to reply

Comparing two floating point numbers for equality... a recipe for disaster.

Log in to reply

What is Donald Knuth's suggestion about that?

Log in to reply

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.

Log in to reply

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

Log in to reply