MAT 331留学生讲解、讲解Python,c/c++编程语言、c/c++,Java辅导
- 首页 >> 其他Spring 2019 HW1 MAT 331
Homework 1: MAT 331
Due: 11:59pm, Feb 5, 2019
Collaboration policy: You are welcome to work with others on this homework assignment. But
the code and explanations you turn in should actually be written by you. In particular, you should
not submit code that you copied from an email a friend sent you.
Submission instructions: You will submit the assignment in Blackboard, as Homework 1 in
the Assignments tab. You will submit a single Jupyter .ipynb notebook file for each of problems
2,3,4 below. For Problem 2, name the file problem2_{your NetID}.ipynb, and similarly for
the other problems. For instance, if I was submitting the homework, I would upload three files:
problem2_bdozier.ipynb, problem3_bdozier.ipynb, problem4_bdozier.ipynb.
Each file should include all the code you used to complete the problem. Do not include scratch
work that turned out to be unnecessary. When we test your code, we will run every cell in order,
and no error messages should be produced.
If you have a reason that your submission cannot conform to all the above criteria, please send
me an email and we will work something out.
1. (Nothing to turn in) Figure out a way to use SageMath with Jupyter outside of the classroom.
Here are some options:
(Recommended) Download SageMath 8.6 for your personal computer. Your
Computer will need to be reasonably modern, and you will need several GB of free disk
space. It is available for Mac, Windows, and Linux. See the “Useful resources” section of
the website for the download link.
Use SageMath via the online server Cocalc.com. With a free account, you should
be able to do everything you need, but it may not be very fast. You can also pay for an
upgraded account. By default Cocalc uses its own customized version of Jupyter, but
you should use it with Plain Jupyter (aka Classic Jupyter). To do this, once you have
created a project, but before adding files to it, click the Settings tab, and then go to the
Plain Jupyter section, and click the Plain Jupyter Server link. The page you get should
look quite similar to what we use in class. When you make a new file with the button
near the upper right, there will be a long list of options - you should select “SageMath
8.6”.
2. Draw a double helix picture figure like the one in Figure 1. It does not have to be exactly
the same, but make sure that the two curves winding around each other are different colors.
Don’t worry about what the numbers on the axes are, or how many times the curves wind
around each other.
Page 1 of 2
Spring 2019 HW1 MAT 331
Figure 1: Double helix
3. Find the sum of all postive integers less than 10, 000 that are multiples of both 3 and 7.
4. Write a function that takes in an integer and determines whether it is a prime (i.e. has no
divisors other than 1 and itself). There is a built in function is_prime that does this, but
don’t use it or any other built-in functions. Use your function to determine whether 2
19 1
is prime. Include in your Jupyter notebook a “Markdown” cell that contains a short written
explanation of the algorithm you are using to test whether numbers are prime.