Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE USE PYTHON AND CLEAR CODE THANK YOU! (a) Let A=(a1,a2,,an) and B=(b1,b2,,bn) be two points in the n-dimensional space Rn. We can think of

image text in transcribed PLEASE USE PYTHON AND CLEAR CODE THANK YOU!

(a) Let A=(a1,a2,,an) and B=(b1,b2,,bn) be two points in the n-dimensional space Rn. We can think of each point as a tuple of n real numbers. Define the promixity- p metric between A and B using the formula: Dp(A,B)=(i=1naibip)p1 where the symbol x represents the absolute value of x. The proximity- p metric is a generalized way to measure 'distance' between A and B. Example: Suppose A=(1,1) and B=(5,4) in the 2-dimensional plane. - When p=1, we get the distance to travel along the lines of a square grid. In this case, D1(A,B)= proximity (1,(1,1),(5,4))=7. - When p=2, we get the familiar 'Euclidean distance' from Pythagoras Theorem. In this case, D2(A,B)= proximity (2,(1,1),(5,4))=5. Task: Implement the function proximity (p,A,B) that takes in an integer p, point A and point B (each represented as a tuple of n real numbers). The function should compute and return the value of Dp(A,B) using the given formula. (Note: the value of dimension n is implicit in the lengths of A and B so there is no need to pass it in as a separate argument.) (20 marks)

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_2

Step: 3

blur-text-image_3

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

User Defined Tensor Data Analysis

Authors: Bin Dong ,Kesheng Wu ,Suren Byna

1st Edition

3030707490, 978-3030707491

More Books

Students also viewed these Databases questions

Question

Which year had the best Monday sales?

Answered: 1 week ago

Question

10-9 How have social technologies changed e-commerce?

Answered: 1 week ago