\documentclass[10pt,reqno,twoside,usenames,dvipsnames]{amsart}

\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{hyperref}
\usepackage{verbatim}
\hypersetup{breaklinks=true,
pagecolor=white,
colorlinks=true,
linkcolor= blue,
hyperfootnotes= true,
urlcolor=blue
}
\urlstyle{rm}

 

\newcommand{\margincomment}[1]
  {\mbox{}\marginpar{\tiny\hspace{0pt}#1}}

\newcommand{\comments}[1]{}
\renewcommand{\baselinestretch}{1.2}
 \parindent 24pt
 \parskip 10pt
\reversemarginpar
\topmargin -1in \oddsidemargin -.5in \evensidemargin -.5in
\textheight 10in \textwidth 7in


\begin{document}

\noindent
 Your name:
 

\vspace*{12pt}

\begin{center}

{\large {\bf   Homework 2.4b, September 27, 2021, NEW VERSION  (Division by 3,  Plotting Functions with Python)  
}}
\end{center}
 
 

 
Log onto the Internet from a computer (not a telephone, unless you {\it really} have to) and go to the site \href{https://www.codabrainy.com/en/python-compiler/}{https://www.codabrainy.com/en/python-compiler/}.  This is the Python compiler site we used in class. You will do the homework with it. 

\noindent
1. First, try out  a, short  program. Use CTRL-C and CTRL-V to copy a program into the code box of the compiler, which says ``main.py"" at the top. Then use your mouse to click the triangle button and see what output comes out in the other big box. 
\begin{verbatim}
y = 2+2
print(y)
\end{verbatim}

If you see ``4'' as output, it worked. 

 \bigskip
\noindent
2.    Cut and paste the code on the following page   into the Code box.    Click on the Triangle ``run"  button, and a line chart will appear in the output box. 


At the bottom of the output box, below the  graph, will appear the name ``trinket\_plot.png" with a blue box containing a white arrow next to it. Click on the blue box, and a big version of the graph will show up in your internet browser. ``Right-click"  on your mouse on that graph, and you will see a menu with ``Save Image As" as one of the options. Left-click on that option, and save the image to a place on the computer where you can find it later (the Downloads folder is the default in Windows, I think). Then go to the folder where the file trinket\_plot.png is, click on it to open it, and print it out. If you don't have a printer, send the file as an email attachment to me at erasmuse61@gmail.com. 

  If this last paragraph doesn"t work, you can use a telephone to take a picture of your bar graph and email me that picture. 

 
\bigskip
\noindent
3.  Now do it over again, but choose your own 3 formulas. 

 For example, you could try $fx =2*x +1$, which takes the number $x$, multiplies it by 2, and adds 1 to make $fx$.  Or you could try $gx = x + x**2$,  which takes the number $x$  and adds $x$-squared to make $gx$. 

\noindent
5. For each of the following numbers, all of them important dates, say whether they are divisible by 2, 3, 5, 7,  and 10. Show your work, as always.  \\
\noindent
(a) 1776. Declaration of Independence \\
\noindent
(b) 1066.  Battle of Hastings, Norman Invasion of England\\
\noindent
(c) 1453. Fall of Constantinople\\
\noindent
(d) 1945. End of World War II\\
\noindent
(e) 1918. End of World War I\\
\noindent
(f) 1861. Start of the Civil War\\
\noindent
(g) 1492. Columbus discovers America\\
\noindent
(h) 1958. Mr. Rasmusen is born. The Polya Conjecture is disproved.  \\
\noindent
(i) 20xx.  You are born


  
  \newpage
  
  \begin{verbatim}
#This code will plot some formulas.  
#September 23, 2021. Eric Rasmusen. erasmuse61@gmail.com

print("hello world") #Just to see if Python is working at all. 

import matplotlib.pyplot as plt;
import numpy as np
 
# Create 30  numbers between 0 and 20.
x = np.linspace(0,20,30)
 
#print your list of  numbers, to see what they look like.
print(x)

# Insert the functions to be plotted
#This is what you change to make your own formulas
fx = 5 +  3*x
gx = x**2
hx = 2**x

plt.plot(x,  fx,  linestyle="None", marker= ".") 
 
plt.plot(x,  gx,  linestyle="solid", marker= ".")   

plt.plot(x,  hx,  linestyle="dotted", marker= ".")  

# Set x, y limits for the points covered by the diagram:
plt.xlim(0, 21)
plt.ylim(0, 100)

#Label the horizontal and vertical axes
plt.xlabel("x")
plt.ylabel("y", rotation=  "horizontal", horizontalalignment="left" , labelpad=6)

plt.title("f(x)=some formula", color="red", fontsize = 20     )
plt.show()
\end{verbatim}
  
\end{document}
 