Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q 2 . ( 1 5 points ) Consider the following problem: Five points ( A , B , C , D , E )

Q2.(15 points) Consider the following problem:
Five points (A,B,C,D,E), not necessarily different, are selected on a number line so that the distance between any two of these points is at most 1. After calculating the distance between each pair of points, I add all ten distances. What is the greatest possible value of this sum?
Your task is not to solve this problem algebraically (which is tough!). Instead, write a code that takes advantage of the speed of modern computers by checking many possible solutions. For example, you might make a script to build an Nx6 matrix with the following constraints:
First column is 0(i.e. A =0)
Fifth column is 1(i.e. E =1, so the distance between A and E is 1)
Second, third and fourth columns are random real numbers between 0 and 1
Sixth column is the sum of the 10 distances between points (AB distance + AC distance + AD distance + AE distance {which is 1}+ BC distance +...+ DE distance)
Your output should look like:
Max value is x.xxx .
The 5 numbers are: 0,0.xxx,0.xxx,0.xxx,1
Initially you may want N to be a reasonably small integer so you can look at the data and debug. Once your code is working properly, run your code several times while increasing N as you go look for a pattern. Finally, report the specific output of your code when N is sufficiently large to be sure of your answer.
From the data you generated, replace the Xs in the sentence below by theorizing a general solution to the original question, and specify 5 numbers which would give your theorized max sum.
The maximum possible value is X.XXX .
Five numbers that give this are: 0,0.xxx,0.xxx,0.xxx,1.
IN MATLAB CODE

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2019 Wurzburg Germany September 16 20 2019 Proceedings Part 2 Lnai 11907

Authors: Ulf Brefeld ,Elisa Fromont ,Andreas Hotho ,Arno Knobbe ,Marloes Maathuis ,Celine Robardet

1st Edition

3030461467, 978-3030461461

More Books

Students also viewed these Databases questions