# 6. New Experiments: Sum of Squares and Plotting I¶

## 6.1. Last Thoughts on the Conductor¶

Wait, I thought we were done with this after today’s homework? But…

**Question (almost) none of you thought of**: Is there such a thing as a
conductor for a set of *three* integers? That is, is there a conductor
for numbers of the form , for the set
?

Well, what about for ?

Okay, what about ?

Ah, but what about ?

With this last example, we see that the conductor *can* (sometimes) be
strictly less than the conductor for *any* group of two of them.

Do you think there a formula? What about for bigger sets?

For sets of two, it turns out there is a

*complete answer*which you have been busy discovering.For sets of three numbers, like , there is an efficient algorithm, but no exact formula.

Notice the connection between theory and practice! Solving this problem could easily solve a “real-life” business problem, so a good algorithm would be very important. But finding such an algorithm requires exploration and experimentation like we have been doing.

Click here if you want to go back to the table of content of this notebook. Otherwise, continue to the next Section.

## 6.2. New Experiment — Sum of Squares¶

With that in mind, let’s begin our next exploration. Hopefully you have had some fun experimenting with the condunctor problem. Today we will introduce a new problem to keep up the fun spirit of experimental mathematics. Namely, what numbers can be written in the form ?

Here are a cases that do and do not work.

works;

does not work, since we only allow integers. is too small, is too big;

actually does work, because we allow . (That’s just one of our rules; you could play a different game if you wanted.);

That means works.

works.

And so forth. Can you think of questions that you can explore experimentally? I can think of two questions:

Which positive integers can be written as a sum of two squares?

Which ones cannot?

More questions? [comment]: <> (* Are there any special types of numbers that can be written? ) [comment]: <> (* Are there any special types of numbers that cannot be written? ) [comment]: <> (* Can we get a formula for which numbers can be written? ) [comment]: <> (* What if we restrict and to be positive integers? ) [comment]: <> (* How many ways can you write as a sum of two squares? ) [comment]: <> (* Which numbers can be written as a sum of one square, and separately as a sum of two squares? )

You can start by hand, but I encourage you to use *SageMath* to explore
this soon too. And when you do, try to be more sophisticated than those
this

```
1^2+1^2
```

```
1^2+2^2
```

```
1^2+3^2
```

After a while, we will come back and I will ask you about possible ways to rethink the problem on the sum of squares.

Can you think of a way to solve this problem? *Hint: What do you know
about equations of this form :math:`n = a^{2} + b ^{2}`?*

This brings up the question of how to do such plotting in the first place? We will look at this in more detail in the next Section.

## 6.3. More Plotting and Graphics in Two Dimensions¶

There is absolutely no way we could cover all the graphics in *SageMath*
(or the program that does it for *SageMath*, matplotlib) in one day, or
even a week. We will look at a bunch of different resources you have
access to, and see lots of different plot types. As we go through these
resources, think of how they will be of in solving our new experiment or
where you could have used them some time back in your academic career. I
definitely do not know everything about the plotting command.
Nevertheless, you may interrupt me with your question so that we can
explore the solution together.

We will begin with the advanced 2D-plotting in the built-in live documentation. (This link only works if you are already using

*SageMath*; the non-live version is here.There are two very important pages with many, MANY examples - the documentation for plot and that for showing graphics.

The general plotting reference - there are a lot of surprises, like animation, etc.

*SageMath*to explore the sums of squares,

*or*try to recreate your favorite graphic using

*SageMath*!

< 3. Starting To Program|Table of contents >