Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1) i) Write a Python function that takes two vectors, and returns the angle between them, in degrees. ii) Write a Python function that takes

1) i) Write a Python function that takes two vectors, and returns the angle between them, in degrees. ii) Write a Python function that takes 3 points A,B,C, and finds the angle ABC (i.e. angle between lines BA and BC).

This function should call your function written for part i) iii) Write a Python function that takes two vectors and returns their cross product (see page xxx in your text). Write

your own code to do this, i.e. do not use the numpy cross product function. iv) Write a Python function that takes two vectors, u and v, and returns the projection of u onto v. v) Build numpy vectors containing the points A=(2,-3,1), B=(0,0,1), C=(1,-1,-1). Use your code from above to find

a) the angle ABC, b) the normal vector to the plane ABC, c) the projection of the vecto AC onto the vector AB, d) the distance from the point C to the line passing through A and B. Print out these results.

2) i) Write a Python function that takes a point p, a normal vector n, and a point q, and returns the distance from the point q to the plane that passes though p having normal vector n.

ii) Write a Python function that takes a point p, a normal vector n, and a point q, and returns the projection of the point q to the plane that passes though p having normal vector n.

iii) Write a Python function that takes five points p1, p2, p3, p4 and p5. Your function should return the intersection of the line that passes though p4 and p5, and the plane that passes through p1, p2 and p3.

iv) Use your code to find the intersection of the plane through the points (1,0,0), (0,1,0) and (0,0,1) and the line through (0,0,0) and (2,3,5)

3) Consider the pyramid in 3d space with vertices v1 = (1, 1, 0), v2 = (1, 1, 0), v3 = (1, 1, 0), v4 = (1, 1, 0), v5 = (0, 0, 2).

i) Build a 3 5 matrix that has these vertices as its columns. ii) Using matplotlib.pyplot, plot these 5 vertices as a 3-d scatter plot. iii) Plot the lines connecting these 5 vertices, to draw the pyramid in a 3d plot. You should draw 8 lines total. iv) Calculate all of the angles in the faces of this pyramid.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

More Books

Students also viewed these Databases questions

Question

=+ How well do you think you could do your job?

Answered: 1 week ago