# hw4 - [1/5 Checking the triangle inequality Homework 4...

This preview shows pages 1–3. Sign up to view the full content.

3/15/2016 [1/5] Checking the triangle inequality - Homework 4 - RELATE 1/2 Checking the triangle inequality In this problem, we will work on demonstrating the triangle inequality for norms using numpy and matplotlib. We are given two vectors x and y as 1D numpy arrays. In addition to regular -norms, we will speak about a "0.5-norm" below. By this we mean that you should use the expression for the -norm with . Note that this is not actually a norm. When plotting, be aware that the unit ball does not necessarily look like a circle. Its shape depends on the norm for which it is 'unit'. For example, the unit ball in the -norm is shown in the figure below: Do the following: a. Compute 1-norm, 2-norm, 5-norm, and "0.5-norm" of vector . Store these norms in a 1D array sum_norm in the order of 1, 2, 5, and 0.5. NOTE: Do NOT use numpy.linalg.norm to compute norms. b. Compute 1-norm, 2-norm, 5-norm, and the "0.5-norm" of vectors and . Store the sum in a 1D array norm_sum in the order of 1, 2, 5, and 0.5. p p p=0.5 x+y x y x + y

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
3/15/2016 [1/5] Checking the triangle inequality - Homework 4 - RELATE 2/2 Your code should produce the following four plots: c. Figure 1: Draw A 2D ball (with respect to the 1-norm) with radius centered around the origin.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern